screeps/role.miner.js

14 lines
533 B
JavaScript
Raw Normal View History

2017-06-06 13:17:26 -05:00
let buildparts=require('bodypartbuilder')
2016-09-28 08:37:28 -05:00
let roleMiner = {
2016-09-23 00:12:42 -05:00
run: function(creep) {
2016-09-28 08:37:28 -05:00
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);
}
2016-09-23 00:12:42 -05:00
}
2016-09-15 00:30:24 -05:00
};
module.exports = roleMiner;