screep/controller_contributer.js

14 lines
349 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);
}
}
},
};