diff --git a/.gitignore b/.gitignore index 88ee37e..041cd4a 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ luac.out /.emacs.desktop /.emacs.desktop.lock /README.html +/c.org diff --git a/changelog.txt b/changelog.txt index 534bfda..955eefa 100644 --- a/changelog.txt +++ b/changelog.txt @@ -33,6 +33,7 @@ Version: 3.2.0 - Fixed alignmentTable being nil due to an invalid reference to the neutral faction - Bases can no longer spend points that exceed the overflow limit (Dagothur) - Fixed death pheromone spread being initialized to 0 instead of max negative number causing victory scent to spread incorrectly + - Fixed chunk scanning have a false negative for impassable chunks Optimizations: - Moved most constants out of global - Removed new enemy variations setting diff --git a/libs/ChunkUtils.lua b/libs/ChunkUtils.lua index 622b9f5..bda5afa 100644 --- a/libs/ChunkUtils.lua +++ b/libs/ChunkUtils.lua @@ -223,14 +223,11 @@ function chunkUtils.initialScan(chunk, map, tick) local surface = map.surface local universe = map.universe setAreaInQueryChunkSize(universe.isFilteredTilesQuery, chunk) - local waterTiles = (1 - (surface.count_tiles_filtered(universe.isFilteredTilesQuery) * 0.0009765625)) * 0.80 + local pass = scanPaths(chunk, map) local enemyBuildings = surface.find_entities_filtered(universe.isFilteredEntitiesEnemyStructureQuery) + local playerObjects = scorePlayerBuildings(map, chunk) - if (waterTiles >= CHUNK_PASS_THRESHOLD) or (#enemyBuildings > 0) then - local pass = scanPaths(chunk, map) - - local playerObjects = scorePlayerBuildings(map, chunk) - + if (pass ~= CHUNK_IMPASSABLE) or (#enemyBuildings > 0) or (playerObjects > 0) then if ((playerObjects > 0) or (#enemyBuildings > 0)) and (pass == CHUNK_IMPASSABLE) then pass = CHUNK_ALL_DIRECTIONS end @@ -241,6 +238,8 @@ function chunkUtils.initialScan(chunk, map, tick) 1) * 0.20) setPassable(map, chunk, pass) + + local waterTiles = (1 - (surface.count_tiles_filtered(universe.isFilteredTilesQuery) * 0.0009765625)) * 0.80 setPathRating(map, chunk, waterTiles + neutralObjects) setPlayerBaseGenerator(map, chunk, playerObjects) @@ -299,16 +298,15 @@ function chunkUtils.chunkPassScan(chunk, map) local surface = map.surface local universe = map.universe setAreaInQueryChunkSize(universe.cpsFilteredTilesQuery, chunk) - local waterTiles = (1 - (surface.count_tiles_filtered(universe.cpsFilteredTilesQuery) * 0.0009765625)) * 0.80 + local pass = scanPaths(chunk, map) local enemyCount = surface.count_entities_filtered(universe.cpsFilteredEnemyAnyFound) + local playerObjects = getPlayerBaseGenerator(map, chunk) - if (waterTiles >= CHUNK_PASS_THRESHOLD) or (enemyCount > 0) then + if (pass ~= CHUNK_IMPASSABLE) or (enemyCount > 0) or (playerObjects > 0) then local neutralObjects = mMax(0, mMin(1 - (surface.count_entities_filtered(universe.cpsFilteredEntitiesChunkNeutral) * 0.005), 1) * 0.20) - local pass = scanPaths(chunk, map) - - local playerObjects = getPlayerBaseGenerator(map, chunk) + local waterTiles = (1 - (surface.count_tiles_filtered(universe.cpsFilteredTilesQuery) * 0.0009765625)) * 0.80 if ((playerObjects > 0) or (enemyCount > 0)) and (pass == CHUNK_IMPASSABLE) then pass = CHUNK_ALL_DIRECTIONS @@ -317,10 +315,6 @@ function chunkUtils.chunkPassScan(chunk, map) setPassable(map, chunk, pass) setPathRating(map, chunk, waterTiles + neutralObjects) - if pass == CHUNK_IMPASSABLE then - return -1 - end - return chunk end