Changed miner movement;
This commit is contained in:
@@ -4,8 +4,7 @@ module.exports = {
|
||||
tick(creep){
|
||||
const source = Game.getObjectById(creep.memory.job.source);
|
||||
if(!creep.pos.isNearTo(source)) { creep.moveTo(source); return; }
|
||||
if(creep.memory.aboveContainer) { creep.harvest(source); return; }
|
||||
if(creep.memory.container) { moveToContainer(creep); return; }
|
||||
if(creep.memory.container) moveToContainer(creep);
|
||||
if(!(Game.time%100)) scanForContainer(creep, source);
|
||||
creep.harvest(source);
|
||||
}
|
||||
@@ -13,8 +12,8 @@ module.exports = {
|
||||
|
||||
function moveToContainer(creep){
|
||||
const container = Game.getObjectById(creep.memory.container);
|
||||
if(container.pos.x === creep.pos.x && container.pos.y === creep.pos.y) creep.memory.aboveContainer = true;
|
||||
else creep.moveTo(container);
|
||||
if(container.pos.x === creep.pos.x && container.pos.y === creep.pos.y) return;
|
||||
creep.moveTo(container);
|
||||
}
|
||||
|
||||
function scanForContainer(creep, source){
|
||||
|
||||
Reference in New Issue
Block a user