Skip to content

Instantly share code, notes, and snippets.

@styks1987
Created April 17, 2016 15:21
Show Gist options
  • Save styks1987/52ef74b1d09fe217967209a69cae5af5 to your computer and use it in GitHub Desktop.
Save styks1987/52ef74b1d09fe217967209a69cae5af5 to your computer and use it in GitHub Desktop.
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