screeps/role.claimer.js
2017-07-13 23:24:42 -05:00

22 lines
761 B
JavaScript

let roleClaimer = {
run: function(creep) {
if(creep.memory.originroom === undefined){
creep.memory.originroom = creep.room.name
}
//let mycontroller= creep.room.find(STRUCTURE_CONTROLLER)
if(!creep.room.controller.my){
creep.say('claiming')
if(creep.claimController(creep.room.controller) == ERR_NOT_IN_RANGE) {
creep.moveTo(creep.room.controller);
}
} else if(Game.flags.claim){
creep.say('claim')
creep.moveTo(Game.flags.claim)
} else{
creep.say('parking')
creep.moveTo(creep.room.memory.claimerparkx,creep.room.memory.claimerparky,creep.room)
}
}
};
module.exports = roleClaimer;