diff --git a/Upgrade.lua b/Upgrade.lua index 4fde8c6..9b6bc8c 100644 --- a/Upgrade.lua +++ b/Upgrade.lua @@ -213,6 +213,15 @@ local function addCommandSet(queriesAndCommands) "simple-entity" } } + queriesAndCommands.cpsFilteredEnemyAnyFound = { + area=cpsSharedChunkArea, + force=queriesAndCommands.enemyForces, + type={ + "turret", + "unit-spawner" + }, + limit = 1 + } -- msrc local msrcSharedChunkArea = { @@ -468,7 +477,6 @@ function upgrade.attempt(universe) if global.version < 204 then global.version = 204 - addCommandSet(universe) universe.eventId = 0 universe.chunkId = 0 universe.randomGenerator = nil @@ -509,8 +517,12 @@ function upgrade.attempt(universe) universe.chunkToPassScanIterator = nil universe.baseId = 0 universe.awake = false + end + if global.version < 205 then + global.version = 205 - game.print("Rampant - Version 2.0.0") + addCommandSet(universe) + game.print("Rampant - Version 2.0.1") end return (starting ~= global.version) and global.version diff --git a/changelog.txt b/changelog.txt index 443553c..915e0f4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,8 @@ Version: 2.0.1 Date: 23. 11. 2021 Contributions: - RealSimplyData fixed missing map parameter in onUnitGroupCreated (Thanks illiander42 for reporting) + Bugfixes: + - Fixed chunkPassScanning not checking for enemy structures when determining passability --------------------------------------------------------------------------------------------------- Version: 2.0.0 diff --git a/info.json b/info.json index f09ee18..074baec 100644 --- a/info.json +++ b/info.json @@ -1,7 +1,7 @@ { "name" : "Rampant", "factorio_version" : "1.1", - "version" : "2.0.0", + "version" : "2.0.1", "title" : "Rampant", "author" : "Veden", "homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445", diff --git a/libs/ChunkUtils.lua b/libs/ChunkUtils.lua index 3e9a1d7..1eeb7ce 100644 --- a/libs/ChunkUtils.lua +++ b/libs/ChunkUtils.lua @@ -276,8 +276,9 @@ function chunkUtils.chunkPassScan(chunk, map) local universe = map.universe setAreaInQueryChunkSize(universe.cpsFilteredTilesQuery, chunk) local waterTiles = (1 - (surface.count_tiles_filtered(universe.cpsFilteredTilesQuery) * 0.0009765625)) * 0.80 + local enemyCount = surface.count_entities_filtered(universe.cpsFilteredEnemyAnyFound) - if (waterTiles >= CHUNK_PASS_THRESHOLD) then + if (waterTiles >= CHUNK_PASS_THRESHOLD) or (enemyCount > 0) then local neutralObjects = mMax(0, mMin(1 - (surface.count_entities_filtered(universe.cpsFilteredEntitiesChunkNeutral) * 0.005), 1) * 0.20) @@ -285,9 +286,7 @@ function chunkUtils.chunkPassScan(chunk, map) local playerObjects = getPlayerBaseGenerator(map, chunk) - local nests = getNestCount(map, chunk) - - if ((playerObjects > 0) or (nests > 0)) and (pass == CHUNK_IMPASSABLE) then + if ((playerObjects > 0) or (enemyCount > 0)) and (pass == CHUNK_IMPASSABLE) then pass = CHUNK_ALL_DIRECTIONS end