diff --git a/Empire.js b/Empire.js index b593bd2..fcc5e78 100644 --- a/Empire.js +++ b/Empire.js @@ -96,6 +96,20 @@ module.exports = { Game.rooms[name].memory.minablepositions = minablepositions } }, + computeMineralAccess: function(){ + for(let myroom of _.filter(Game.rooms, 'controller.my')) { + let name = myroom.name + let mineralminablepositions = 0 + let minerals = Game.rooms[name].find(FIND_MINERALS); + for(let i = 0;i 0)&&(creepcounts["miner"] < 1 || creepcounts["miner"]==undefined)&&(Game.rooms[room].energyAvailable >= Game.rooms[room].energyCapacityAvailable)){ - if(Game.rooms[room].find(FIND_MINERALS)[0].ticksToRegeneration < 1000){ + if((Game.rooms[room].find(FIND_MY_STRUCTURES, {filter: {structureType: STRUCTURE_EXTRACTOR}}).length > 0)&&(creepcounts["miner"] < Game.rooms[room].memory.mineralminablepositions || creepcounts["miner"]==undefined)&&(Game.rooms[room].energyAvailable >= Game.rooms[room].energyCapacityAvailable)){ + if(Game.rooms[room].find(FIND_MINERALS)[0].ticksToRegeneration == undefined || 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")}} diff --git a/RoomInit.js b/RoomInit.js index bcd5aa6..1a983a2 100644 --- a/RoomInit.js +++ b/RoomInit.js @@ -10,6 +10,15 @@ let initroom = { Game.rooms[name].memory.tickssofar=0 Game.rooms[name].memory.maphits={} //Game.rooms[name].memory.minablepositions= this.checkminablepositions(name) + let mineralminablepositions = 0 + let minerals = Game.rooms[name].find(FIND_MINERALS); + for(let i = 0;i