diff --git a/control.lua b/control.lua index b0e2589..eaaffc9 100644 --- a/control.lua +++ b/control.lua @@ -466,7 +466,7 @@ local function onDeath(event) local artilleryBlast = (cause and ((cause.type == "artillery-wagon") or (cause.type == "artillery-turret"))) if (entityType == "unit") and not ENTITY_SKIP_COUNT_LOOKUP[entity.name] then - deathScent(map, chunk) + deathScent(chunk) if base then base.lostEnemyUnits = base.lostEnemyUnits + 1 if damageTypeName then @@ -803,8 +803,6 @@ local function onUnitGroupCreated(event) squad = createSquad(nil, map, group, settler, base) Universe.groupNumberToSquad[group.group_number] = squad - squad.base = base - if settler then Universe.builderCount = Universe.builderCount + 1 else @@ -816,7 +814,7 @@ local function onUnitGroupCreated(event) return end - local settler = canMigrate(map, base) and + local settler = canMigrate(base) and (Universe.builderCount < Universe.AI_MAX_VANILLA_BUILDER_COUNT) and (Universe.random() < 0.25) @@ -833,8 +831,6 @@ local function onUnitGroupCreated(event) squad = createSquad(nil, map, group, settler, base) Universe.groupNumberToSquad[group.group_number] = squad - squad.base = base - if settler then Universe.builderCount = Universe.builderCount + 1 else diff --git a/libs/MapUtils.lua b/libs/MapUtils.lua index 8fc471d..1a14987 100644 --- a/libs/MapUtils.lua +++ b/libs/MapUtils.lua @@ -238,6 +238,8 @@ function MapUtils.prepMap(surface) end end + Universe.flushPendingChunks = true + return map end diff --git a/libs/Processor.lua b/libs/Processor.lua index c968eda..07298b5 100644 --- a/libs/Processor.lua +++ b/libs/Processor.lua @@ -455,11 +455,13 @@ function Processor.processPendingChunks(tick, flush) end local endCount = 1 - if flush then + local flushAllChunks = flush or Universe.flushPendingChunks + if flushAllChunks then endCount = tableSize(pendingChunks) + Universe.flushPendingChunks = false end for _=1,endCount do - if not flush and (event.tick > tick) then + if not flushAllChunks and (event.tick > tick) then return end local newEventId, newEvent = next(pendingChunks, eventId) diff --git a/libs/Upgrade.lua b/libs/Upgrade.lua index 840ea9a..c07132d 100644 --- a/libs/Upgrade.lua +++ b/libs/Upgrade.lua @@ -419,6 +419,7 @@ function Upgrade.addUniverseProperties() global.universePropertyVersion = 1 Universe.safeEntities = {} + Universe.flushPendingChunks = false Universe.aiPointsScaler = settings.global["rampant--aiPointsScaler"].value