screep/controller_contributer.js

16 lines
445 B
JavaScript

/* eslint-disable no-undef */
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);
}
}
},
};