1
0
mirror of https://github.com/veden/Rampant.git synced 2025-03-17 20:58:35 +02:00

restore missing chunks due to skipped processing

This commit is contained in:
Aaron Veden 2021-11-30 22:19:25 -08:00
parent eaaf116e54
commit cca1598de9
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84

View File

@ -4,6 +4,7 @@ local upgrade = {}
local constants = require("libs/Constants")
local mathUtils = require("libs/MathUtils")
local mapUtils = require("libs/MapUtils")
-- constants
@ -27,6 +28,8 @@ local TRIPLE_CHUNK_SIZE = constants.TRIPLE_CHUNK_SIZE
-- imported functions
local queueGeneratedChunk = mapUtils.queueGeneratedChunk
local euclideanDistancePoints = mathUtils.euclideanDistancePoints
local mAbs = math.abs
@ -440,9 +443,29 @@ function upgrade.attempt(universe)
map.pendingUpgrades = {}
map.sentAggressiveGroups = 0
map.maxAggressiveGroups = 1
for chunkXY in map.surface.get_chunks() do
local x = chunkXY.x * 32
local y = chunkXY.y * 32
if not map[x] then
map[x] = {}
end
if not map[x][y] then
queueGeneratedChunk(universe,
{
surface = map.surface,
area = {
left_top = {
x = x,
y = y
}
}
}
)
end
end
for i=1,#map.processQueue do
local chunk = map.processQueue[i]
map.processQueue[i].dOrigin = euclideanDistancePoints(chunk.x, chunk.y, 0, 0)
chunk.dOrigin = euclideanDistancePoints(chunk.x, chunk.y, 0, 0)
end
for _,squad in pairs(map.groupNumberToSquad) do
squad.commandTick = tick