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:
parent
eaaf116e54
commit
cca1598de9
25
Upgrade.lua
25
Upgrade.lua
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user