diff --git a/src/programs/city/construct.js b/src/programs/city/construct.js index bfafcf2..0716ec1 100644 --- a/src/programs/city/construct.js +++ b/src/programs/city/construct.js @@ -65,7 +65,7 @@ class CityConstruct extends kernel.process { const sites = this.room.find(FIND_MY_CONSTRUCTION_SITES, { filter: function (structure) { - return !ignoreConstructionSites.includes(structure) + return !ignoreConstructionSites.includes(structure.structureType) } }) diff --git a/src/programs/city/fortify.js b/src/programs/city/fortify.js index b012109..731e6b1 100644 --- a/src/programs/city/fortify.js +++ b/src/programs/city/fortify.js @@ -156,6 +156,7 @@ class CityFortify extends kernel.process { } } + let target if (decaying.length > 0) { decaying.sort((a, b) => a.hits - b.hits) @@ -166,13 +167,14 @@ class CityFortify extends kernel.process { }) target = potentialTargets.length > 0 ? Game.getObjectById(potentialTargets[0]) : false } + if (missing.length > 0 && (!target || target.hits > DECAY_LIMIT)) { - // Add structure - let type = STRUCTURE_RAMPART - if (this.defenses.getStructureAt(missing[0].x, missing[0].y) === WALL_GATEWAY) { - type = STRUCTURE_WALL + + //Don't let misplaced fortifications block fortifying + let i = 0 + while( i < missing.length && this.room.createConstructionSite(missing[i], this.defenses.getStructureAt(missing[i].x, missing[i].y) === WALL_GATEWAY ? STRUCTURE_WALL : STRUCTURE_RAMPART) != 0) { + i++ } - this.room.createConstructionSite(missing[0], type) return false } if (!target) {