screep/controller_contributer.js

16 lines
445 B
JavaScript
Raw Normal View History

2020-10-26 16:15:52 +08:00
/* eslint-disable no-undef */
2020-10-18 22:00:22 +08:00
module.exports = {
2020-10-26 16:45:02 +08:00
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);
}
}
},
2020-10-26 16:15:52 +08:00
};