Files
screeps/job_reserver.js
2022-04-15 14:29:07 +02:00

16 lines
554 B
JavaScript

/* ###########################################
# Go to a controller and reserve the room #
###########################################*/
module.exports = {
do: function(creep){
if(Game.flags[creep.memory.target].room != undefined && Game.flags[creep.memory.target].room == creep.room){
if(creep.reserveController(creep.room.controller) == ERR_NOT_IN_RANGE){
creep.moveTo(creep.room.controller);
}
} else {
creep.moveTo(Game.flags[creep.memory.target]);
}
}
};