From c03125c5c0580e384d6a9e8b0bf2b741d494f0f8 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 17 Nov 2020 11:47:15 -0600 Subject: [PATCH] Fixup --- Room.Phase1.js | 5 ----- main.js | 6 ++++-- role.miner.js | 4 ---- role.warrior.js | 6 +++--- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Room.Phase1.js b/Room.Phase1.js index 50a2656..55cc258 100644 --- a/Room.Phase1.js +++ b/Room.Phase1.js @@ -44,15 +44,10 @@ let Phase1 = { require('proc.spawning').spawnmover(room) } if((Game.rooms[room].find(FIND_MY_STRUCTURES, {filter: {structureType: STRUCTURE_EXTRACTOR}}).length > 0)&&(creepcounts["miner"] < 1 || creepcounts["miner"]==undefined)&&(Game.rooms[room].energyAvailable >= Game.rooms[room].energyCapacityAvailable)){ -<<<<<<< HEAD if(Game.rooms[room].find(FIND_MINERALS)[0].ticksToRegeneration < 1000){ console.log("Spawning Miner in " + room) require('proc.spawning').spawnminer(room) } else { if(Game.flags.debug && Game.flags.debug.room == Game.rooms[room]){console.log("Not spawning miner in " + room + ", waiting for regen")}} -======= - console.log("Spawning Miner in " + room) - require('proc.spawning').spawnminer(room) ->>>>>>> 1ff4251f0330951b8788d86218fc0b5a1906d5f4 } //require('proc.market').sellEnergy(room) } diff --git a/main.js b/main.js index 682e0cb..bb09b63 100644 --- a/main.js +++ b/main.js @@ -68,15 +68,17 @@ module.exports.loop = function () { console.log(e) } } + //console.log('done running creeps') } let flags = Game.flags for(let flag in flags){ + //console.log('running flags') require('flag.' + flag ).run() } for(let name in Memory.rooms) { + // console.log('cleaning up old rooms') let myroom = Game.rooms[name] if(!Game.rooms[name]){delete Memory.rooms[name]} } console.log("----End loop for "+ Game.time +'----') - } - \ No newline at end of file +} \ No newline at end of file diff --git a/role.miner.js b/role.miner.js index 87ca687..5882fed 100644 --- a/role.miner.js +++ b/role.miner.js @@ -16,7 +16,6 @@ let roleMiner = { if(creep.harvest(mysource) == ERR_NOT_IN_RANGE) { creep.travelTo(mysource); } -<<<<<<< HEAD } 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)}})) ) { if(creep.memory.renewto == undefined){ creep.memory.renewto = 1200 @@ -33,9 +32,6 @@ let roleMiner = { creep.moveTo(spawn); } } else { -======= - } else { ->>>>>>> 1ff4251f0330951b8788d86218fc0b5a1906d5f4 let storagetargets = creep.pos.findClosestByRange(FIND_STRUCTURES, {filter: (s) => {return ((s.structureType == STRUCTURE_STORAGE || s.structureType == STRUCTURE_CONTAINER || s.structureType == STRUCTURE_TERMINAL || s.structureType == STRUCTURE_FACTORY ) && _.sum(s.store) < s.storeCapacity) ;}}); if(storagetargets){ if(this.transferAll(creep,storagetargets) == ERR_NOT_IN_RANGE) { diff --git a/role.warrior.js b/role.warrior.js index deff1f0..ea1b314 100644 --- a/role.warrior.js +++ b/role.warrior.js @@ -1,8 +1,8 @@ let rolewarrior = { run: function(creep) { - var hostile = creep.pos.findClosestByRange(FIND_HOSTILE_CREEPS); - var hostilebuilding = creep.pos.findClosestByRange(FIND_HOSTILE_SPAWNS ); - if(hostile!=undefined) { + var hostile = creep.pos.findClosestByRange(FIND_HOSTILE_CREEPS); + var hostilebuilding = creep.pos.findClosestByRange(FIND_HOSTILE_SPAWNS ); + if(hostile!=undefined) { creep.say('Sorry') creep.travelTo(hostile,{ignoreCreeps:true}); creep.attack(hostile);