mirror of
https://github.com/veden/Rampant.git
synced 2025-03-17 20:58:35 +02:00
e96108b: Fixed chunk scanning causing a false negative
This commit is contained in:
parent
32080f09bf
commit
8006a047f0
1
.gitignore
vendored
1
.gitignore
vendored
@ -48,3 +48,4 @@ luac.out
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
/README.html
|
||||
/c.org
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user