1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-28 21:08:22 +02:00

added logic to reset pending upgrade table

This commit is contained in:
Aaron Veden 2021-12-05 14:39:50 -08:00
parent 82058d16d4
commit 38e83283fc
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84

View File

@ -144,16 +144,20 @@ function chunkProcessor.processPendingUpgrades(map, tick)
else
entityData = map.pendingUpgrades[entityId]
end
if entityId then
if not entityId then
map.pendingUpgradeIterator = nil
if table_size(map.pendingUpgrades) == 0 then
map.pendingUpgrades = {}
end
else
local entity = entityData.entity
if entity.valid then
map.pendingUpgradeIterator = next(map.pendingUpgrades, entityId)
map.pendingUpgrades[entityId] = nil
local universe = map.universe
local query = universe.upgradeEntityQuery
local surface = entity.surface
local query = map.universe.upgradeEntityQuery
query.position = entityData.position or entity.position
query.name = entityData.name
local surface = entity.surface
unregisterEnemyBaseStructure(map, entity)
entity.destroy()
local createdEntity = surface.create_entity(query)