-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrole.explorer.js
23 lines (22 loc) · 1.09 KB
/
role.explorer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var roleExplorer = {
/** @param {Creep} creep **/
run: function(creep) {
if (creep.memory.target == creep.room.name){
//Save the room in Memory.rooms, thein suicide to save CPU
if (!Game.spawns[creep.memory.queen].memory.remote || !Game.spawns[creep.memory.queen].memory.remote[creep.memory.target]){
Room.prototype.adquireRemoteRoom(creep.memory.queen,creep.memory.target,1);
//Add the workers of this new remote room to the Spawner Queen
Game.spawns[creep.memory.queen].memory.minClaimers +=1;
Game.spawns[creep.memory.queen].memory.minMiners +=1;
Game.spawns[creep.memory.queen].memory.minTransporters +=3;
console.log(creep.memory.target + " adquired to " + creep.memory.queen );
creep.suicide();
}
}else{
//Move to the target room
let exitToTarget = creep.pos.findClosestByRange(creep.room.findExitTo(creep.memory.target));
creep.moveTo(exitToTarget);
}
}
};
module.exports = roleExplorer;