From 62419d54d87516b842bbf805e9cdc7b5854a8073 Mon Sep 17 00:00:00 2001 From: Dan Hamik Date: Tue, 26 Apr 2022 23:41:43 -0500 Subject: [PATCH] catch up --- flag.claim.js | 2 +- role.mover.js | 9 ++++++--- role.phase1worker.js | 8 +++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/flag.claim.js b/flag.claim.js index d39c328..c0baa3c 100644 --- a/flag.claim.js +++ b/flag.claim.js @@ -21,7 +21,7 @@ let claim = { if(!Game.flags.claim.room.controller.my){ //console.log('not my controller') } - console.log("CreepCount:"+creepcount+"| Lifetime:" + avglife + "|Request Time:" + Game.flags.claim.memory.requesttime ) + console.log("Room: " + Game.flags.claim.room + "CreepCount:"+creepcount+"| Lifetime:" + avglife + "|Request Time:" + Game.flags.claim.memory.requesttime ) } } diff --git a/role.mover.js b/role.mover.js index f82476f..a5247c3 100644 --- a/role.mover.js +++ b/role.mover.js @@ -36,7 +36,7 @@ let mover={ creep.say('Putting Energy') creep.travelTo(terminaltarget); } - } else if ((creep.ticksToLive < 300 || creep.ticksToLive <= creep.memory.renewto) && (Game.rooms[creep.room.name].find(FIND_MY_SPAWNS, {filter: (r) =>{return ( r.store[RESOURCE_ENERGY]>1)}})) ) { + } else if ((creep.ticksToLive < 300 || creep.ticksToLive <= creep.memory.renewto) && (Game.rooms[creep.room.name].find(FIND_MY_SPAWNS, {filter: (r) =>{return ( r.store[RESOURCE_ENERGY]>200)}})) ) { if(creep.memory.renewto == undefined){ creep.memory.renewto = 1200 } else { @@ -53,8 +53,8 @@ let mover={ } } else { if(filllevel < creep.carryCapacity){ - let storagetarget = creep.pos.findClosestByRange(FIND_STRUCTURES, {filter: (s) => {return ((s.structureType == STRUCTURE_STORAGE || s.structureType == STRUCTURE_CONTAINER) && _.sum(s.store) >= 500) ;}}); - let droppedenergy = creep.pos.findClosestByRange(FIND_DROPPED_RESOURCES, {filter: (r) =>{return ( r.resourceType==RESOURCE_ENERGY&& r.amount>200)}}); + let storagetarget = creep.pos.findClosestByRange(FIND_STRUCTURES, {filter: (s) => {return ((s.structureType == STRUCTURE_STORAGE || s.structureType == STRUCTURE_CONTAINER) && _.sum(s.store) >= 10) ;}}); + let droppedenergy = creep.pos.findClosestByRange(FIND_DROPPED_RESOURCES, {filter: (r) =>{return ( r.resourceType==RESOURCE_ENERGY&& r.amount>10)}}); let tombstone = creep.pos.findClosestByRange(FIND_TOMBSTONES, {filter: (r) =>{return ( r.store[RESOURCE_ENERGY]>200)}}); if((droppedenergy == undefined) && (tombstone==undefined)){ if(creep.withdraw(storagetarget,RESOURCE_ENERGY)== ERR_NOT_IN_RANGE) { @@ -78,6 +78,9 @@ let mover={ } } } + if(!storagetarget && (creep.carry > 0)){ + creep.memory.working=true + } } } creep.memory.lastpos=creep.pos diff --git a/role.phase1worker.js b/role.phase1worker.js index 623d2df..1199a61 100644 --- a/role.phase1worker.js +++ b/role.phase1worker.js @@ -36,8 +36,7 @@ let Phase1Worker = { let storagetargets = creep.pos.findClosestByRange(FIND_STRUCTURES, {filter: (s) => {return ((s.structureType == STRUCTURE_STORAGE || s.structureType == STRUCTURE_CONTAINER || s.structureType == STRUCTURE_TERMINAL ) && _.sum(s.store) < s.storeCapacity) ;}}); if(creep.room.memory.NeedsRecharge==1){ if(creep.upgradeController(creep.room.controller) == ERR_NOT_IN_RANGE) { - creep.say('!MTRC!') - creep.say(creep.room.controller.ticksToDowngrade) + creep.say(creep.room.controller.ticksToDowngrade + " of " + CONTROLLER_DOWNGRADE[creep.room.controller.level] * .2) creep.moveTo(creep.room.controller) } } else if((creep.pos.findClosestByPath(FIND_STRUCTURES, {filter: (s) => {return ((([STRUCTURE_SPAWN, STRUCTURE_EXTENSION, STRUCTURE_TOWER].includes(s.structureType)) && s.energy < s.energyCapacity))}}))&& (creep.room.memory.movercount<1||creep.room.memory.movercount==undefined)){ @@ -68,7 +67,7 @@ let Phase1Worker = { creep.moveTo(Game.rooms[creep.memory.assignedroom].controller,{ignoreCreeps:ignorecreeps}) } } - } else if ((creep.ticksToLive < 300 || creep.ticksToLive <= creep.memory.renewto) && (Game.rooms[creep.room.name].find(FIND_MY_SPAWNS, {filter: (r) =>{return ( r.store[RESOURCE_ENERGY]>1)}})) ) { + } else if ((creep.ticksToLive < 300 || creep.ticksToLive <= creep.memory.renewto) && (Game.rooms[creep.room.name].find(FIND_MY_SPAWNS, {filter: (r) =>{return ( r.store[RESOURCE_ENERGY]>200)}})) ) { if(creep.memory.renewto == undefined){ creep.memory.renewto = 1200 } else { @@ -81,8 +80,7 @@ let Phase1Worker = { let spawn = creep.pos.findClosestByRange(FIND_MY_SPAWNS) if(creep.room.memory.NeedsRecharge==1 && creep.carry.energy>0){ if(creep.upgradeController(creep.room.controller) == ERR_NOT_IN_RANGE) { - creep.say('!MTRC!') - creep.say(creep.room.controller.ticksToDowngrade) + creep.say(creep.room.controller.ticksToDowngrade + " of " + (CONTROLLER_DOWNGRADE[creep.room.controller.level] * .2)) creep.moveTo(creep.room.controller) } } else {