screeps/role.miner.js
2020-11-09 19:31:39 -06:00

12 lines
396 B
JavaScript

let roleMiner = {
run: function(creep) {
if(Game.getObjectById(creep.memory.destsource.id)==undefined){creep.memory.destsource=undefined}
let mysource=Game.getObjectById(creep.memory.destsource.id)
{
if(creep.harvest(mysource) == ERR_NOT_IN_RANGE) {
creep.travelTo(mysource);
}
}
}
};
module.exports = roleMiner;