16 lines
554 B
JavaScript
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]);
|
|
}
|
|
}
|
|
}; |