14 lines
484 B
JavaScript
14 lines
484 B
JavaScript
module.exports = {
|
|
run(creep) {
|
|
if (creep.carry.energy < creep.carryCapacity){
|
|
if(ERR_NOT_IN_RANGE==creep.withdraw(Game.spawns.Spawn1,RESOURCE_ENERGY)){
|
|
creep.moveTo(Game.spawns.Spawn1);
|
|
}
|
|
}else{
|
|
let construction_site=creep.room.find(FIND_CONSTRUCTION_SITES);
|
|
if(ERR_NOT_IN_RANGE==creep.build(construction_site[0])){
|
|
creep.moveTo(construction_site[0]);
|
|
}
|
|
}
|
|
}
|
|
} |