This commit is contained in:
Dan Hamik 2022-04-26 23:41:43 -05:00
parent 39e648ff87
commit 62419d54d8
3 changed files with 10 additions and 9 deletions

View File

@ -21,7 +21,7 @@ let claim = {
if(!Game.flags.claim.room.controller.my){ if(!Game.flags.claim.room.controller.my){
//console.log('not my controller') //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 )
} }
} }

View File

@ -36,7 +36,7 @@ let mover={
creep.say('Putting Energy') creep.say('Putting Energy')
creep.travelTo(terminaltarget); 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){ if(creep.memory.renewto == undefined){
creep.memory.renewto = 1200 creep.memory.renewto = 1200
} else { } else {
@ -53,8 +53,8 @@ let mover={
} }
} else { } else {
if(filllevel < creep.carryCapacity){ 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 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>200)}}); 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)}}); let tombstone = creep.pos.findClosestByRange(FIND_TOMBSTONES, {filter: (r) =>{return ( r.store[RESOURCE_ENERGY]>200)}});
if((droppedenergy == undefined) && (tombstone==undefined)){ if((droppedenergy == undefined) && (tombstone==undefined)){
if(creep.withdraw(storagetarget,RESOURCE_ENERGY)== ERR_NOT_IN_RANGE) { 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 creep.memory.lastpos=creep.pos

View File

@ -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) ;}}); 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.room.memory.NeedsRecharge==1){
if(creep.upgradeController(creep.room.controller) == ERR_NOT_IN_RANGE) { if(creep.upgradeController(creep.room.controller) == ERR_NOT_IN_RANGE) {
creep.say('!MTRC!') creep.say(creep.room.controller.ticksToDowngrade + " of " + CONTROLLER_DOWNGRADE[creep.room.controller.level] * .2)
creep.say(creep.room.controller.ticksToDowngrade)
creep.moveTo(creep.room.controller) 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)){ } 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}) 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){ if(creep.memory.renewto == undefined){
creep.memory.renewto = 1200 creep.memory.renewto = 1200
} else { } else {
@ -81,8 +80,7 @@ let Phase1Worker = {
let spawn = creep.pos.findClosestByRange(FIND_MY_SPAWNS) let spawn = creep.pos.findClosestByRange(FIND_MY_SPAWNS)
if(creep.room.memory.NeedsRecharge==1 && creep.carry.energy>0){ if(creep.room.memory.NeedsRecharge==1 && creep.carry.energy>0){
if(creep.upgradeController(creep.room.controller) == ERR_NOT_IN_RANGE) { if(creep.upgradeController(creep.room.controller) == ERR_NOT_IN_RANGE) {
creep.say('!MTRC!') creep.say(creep.room.controller.ticksToDowngrade + " of " + (CONTROLLER_DOWNGRADE[creep.room.controller.level] * .2))
creep.say(creep.room.controller.ticksToDowngrade)
creep.moveTo(creep.room.controller) creep.moveTo(creep.room.controller)
} }
} else { } else {