screeps/role.miner2.js
2017-06-06 13:17:26 -05:00

13 lines
493 B
JavaScript

let roleMiner2 = {
run: function(creep) {
if(creep.memory.originroom === undefined){
creep.memory.originroom = creep.room.name
}
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.moveTo(mysource);
}
}
};
module.exports = roleMiner2;