mirror of
https://github.com/paradizelost/screeps.git
synced 2024-11-25 02:14:44 -06:00
21 lines
760 B
JavaScript
21 lines
760 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; |