From 949f1d0e648a75f53884d95fd28608061d8642a7 Mon Sep 17 00:00:00 2001 From: Dan Hamik Date: Wed, 1 Jun 2022 09:39:13 -0500 Subject: [PATCH] changes --- Room.Phase0.js | 8 +++++--- main.js | 2 +- role.mover.js | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Room.Phase0.js b/Room.Phase0.js index 28ad4e4..4c69131 100644 --- a/Room.Phase0.js +++ b/Room.Phase0.js @@ -1,7 +1,9 @@ let Phase0 = { run: function(room) { require('assignsources').tick(room) - creepcounts = _.countBy(Game.rooms[room].find(FIND_MY_CREEPS), c => c.memory.role) + let creepcounts = _.countBy(Game.rooms[room].find(FIND_MY_CREEPS), c => c.memory.role) + if(creepcounts===undefined){creepcounts['phase' + Game.rooms[room].memory.phase +'worker']=0} + Game.rooms[room].memory.creepcounts=creepcounts let myspawns = Game.rooms[room].find(FIND_MY_SPAWNS) let sources = Game.rooms[room].find(FIND_SOURCES ) if(myspawns.length<1){ @@ -24,8 +26,8 @@ let Phase0 = { } else { let workerrolename = 'phase' + Game.rooms[room].memory.phase +'worker' console.log(room) - console.log(workerrolename + " : " + creepcounts[workerrolename]) - if(((creepcounts[workerrolename]< (sources.length * 1) || creepcounts[workerrolename]==undefined) && !myspawns[0].spawning && Game.rooms[room].energyAvailable == Game.rooms[room].energyCapacityAvailable) || (creepcounts[workerrolename] ==0 && Game.rooms[room].energyAvailable==300) ){ + console.log("room.phase0.js "+workerrolename + " : " + creepcounts[workerrolename]) + if(( creepcounts[workerrolename] == undefined ||(creepcounts[workerrolename]< (sources.length * 1) || creepcounts[workerrolename]==undefined) && !myspawns[0].spawning && Game.rooms[room].energyAvailable == Game.rooms[room].energyCapacityAvailable) || (creepcounts[workerrolename] ==0 && Game.rooms[room].energyAvailable==300) ){ if(Game.rooms[room].energyAvailable == Game.rooms[room].energyCapacityAvailable){ require('proc.spawning').spawnworker(room) } diff --git a/main.js b/main.js index 4cbf2ab..0a1176e 100644 --- a/main.js +++ b/main.js @@ -25,7 +25,7 @@ module.exports.loop = function () { try{ require('Room.Phase' + myroom.memory.phase).run(name) } catch(e){ - console.log(e) + console.log(myroom.name + ": " + e) } } diff --git a/role.mover.js b/role.mover.js index acfe09a..7d2663f 100644 --- a/role.mover.js +++ b/role.mover.js @@ -30,7 +30,7 @@ let mover={ } if(creep.room.name != creep.memory.assignedroom){ creep.moveTo(Game.rooms[creep.memory.assignedroom].controller) - Game.notify(creep.name + " Not in assigned room") + //Game.notify(creep.name + " Not in assigned room") } else { if(creep.memory.working){ //let terminaltarget = creep.room.terminal