Created
April 17, 2016 15:21
-
-
Save styks1987/52ef74b1d09fe217967209a69cae5af5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
findClosestSource: (creep) => { | |
return creep.pos.findClosestByPath(FIND_SOURCES); | |
}, | |
moveToSource: (creep, source) => { | |
creep.moveTo(source); | |
}, | |
moveToStorage: (creep, source) => { | |
creep.moveTo(source); | |
}, | |
harvest: (creep, source) => { | |
var result = creep.harvest(source); | |
switch(result){ | |
case OK: | |
break; | |
case ERR_NOT_IN_RANGE: | |
this.moveToSource(creep, source); | |
break; | |
} | |
creepError.error(result); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment