screep/controller_contributer.js

9 lines
322 B
JavaScript
Raw Normal View History

2020-10-18 22:00:22 +08:00
module.exports = {
run(creep) {
if (Game.spawns.Spawn1.store.getFreeCapacity(RESOURCE_ENERGY) == 0) {
if (creep.transfer(Game.spawns.Spawn1.room.controller, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
creep.moveTo(Game.spawns.Spawn1.room.controller.pos);
}
}
}
}