mirror of
https://github.com/veden/Rampant.git
synced 2025-03-17 20:58:35 +02:00
now upgrades are processed across all chunks
This commit is contained in:
parent
893bd393ff
commit
b81c96c043
@ -425,7 +425,9 @@ function upgrade.attempt(universe)
|
||||
game.forces.enemy.kill_all_units()
|
||||
universe.maps = {}
|
||||
universe.groupNumberToSquad = {}
|
||||
universe.pendingUpgrades = {}
|
||||
universe.deployVengenceIterator = nil
|
||||
universe.pendingUpgradeIterator = nil
|
||||
universe.squadIterator = nil
|
||||
universe.vengenceQueue = {}
|
||||
universe.activeMap = nil
|
||||
@ -479,7 +481,6 @@ function upgrade.prepMap(universe, surface)
|
||||
map.outgoingScanWave = true
|
||||
map.outgoingStaticScanWave = true
|
||||
|
||||
map.pendingUpgrades = {}
|
||||
map.pendingChunks = {}
|
||||
map.chunkToBase = {}
|
||||
map.chunkToNests = {}
|
||||
@ -515,7 +516,6 @@ function upgrade.prepMap(universe, surface)
|
||||
map.chunkToActiveRaidNest = {}
|
||||
|
||||
map.chunkToPassScanIterator = nil
|
||||
map.pendingUpgradeIterator = nil
|
||||
map.recycleBaseIterator = nil
|
||||
map.processActiveSpawnerIterator = nil
|
||||
map.processActiveRaidSpawnerIterator = nil
|
||||
|
@ -16,7 +16,8 @@ Date: 23. 11. 2021
|
||||
- Factorissimo, Space Exploration Orbits, asteroid belts, secret maps, starmap, AAI-signal, NiceFill, Blueprint lab surfaces are no longer processed
|
||||
- Map processing around player now changes to the surface the player is standing on
|
||||
- Squads now get processed regardless of the current active surface being processed
|
||||
- Added max number of move commands that touch the same chunk to squads before disbanding or settling based on if migration is enabled
|
||||
- Added max number of move commands that touch the same chunk to squads before disbanding or settling based on if migration is enabled
|
||||
- Enemy structure upgrades now are processed regardless of active surface
|
||||
Tweaks:
|
||||
- Increase chance to upgrade an enemy structure from 5% to 30%
|
||||
- New enemy regional bases that have two factions now do 75% on one faction and 25% on the faction for building and upgrading enemy structures
|
||||
|
@ -1007,8 +1007,8 @@ script.on_event(defines.events.on_tick,
|
||||
end
|
||||
|
||||
processActiveNests(map, tick)
|
||||
processPendingUpgrades(map, tick)
|
||||
processPendingUpgrades(map, tick)
|
||||
processPendingUpgrades(universe, tick)
|
||||
processPendingUpgrades(universe, tick)
|
||||
cleanSquads(universe, tick)
|
||||
|
||||
-- game.print({"", "--dispatch4 ", profiler, ", ", pick, ", ", game.tick, " ", universe.random()})
|
||||
|
@ -282,10 +282,11 @@ function baseUtils.upgradeEntity(entity, base, map, disPos, evolve, register)
|
||||
["name"] = spawnerName,
|
||||
["position"] = disPos,
|
||||
["register"] = register,
|
||||
["map"] = map,
|
||||
["base"] = base,
|
||||
["entity"] = entity
|
||||
}
|
||||
map.pendingUpgrades[entity.unit_number] = entityData
|
||||
map.universe.pendingUpgrades[entity.unit_number] = entityData
|
||||
return spawnerName
|
||||
end
|
||||
return nil
|
||||
|
@ -136,40 +136,40 @@ function chunkProcessor.processPendingChunks(map, tick, flush)
|
||||
map.chunkProcessorIterator = eventId
|
||||
end
|
||||
|
||||
function chunkProcessor.processPendingUpgrades(map, tick)
|
||||
local entityId = map.pendingUpgradeIterator
|
||||
function chunkProcessor.processPendingUpgrades(universe, tick)
|
||||
local entityId = universe.pendingUpgradeIterator
|
||||
local entityData
|
||||
if not entityId then
|
||||
entityId, entityData = next(map.pendingUpgrades, nil)
|
||||
entityId, entityData = next(universe.pendingUpgrades, nil)
|
||||
else
|
||||
entityData = map.pendingUpgrades[entityId]
|
||||
entityData = universe.pendingUpgrades[entityId]
|
||||
end
|
||||
if not entityId then
|
||||
map.pendingUpgradeIterator = nil
|
||||
if table_size(map.pendingUpgrades) == 0 then
|
||||
map.pendingUpgrades = {}
|
||||
universe.pendingUpgradeIterator = nil
|
||||
if table_size(universe.pendingUpgrades) == 0 then
|
||||
universe.pendingUpgrades = {}
|
||||
end
|
||||
else
|
||||
local entity = entityData.entity
|
||||
if entity.valid then
|
||||
map.pendingUpgradeIterator = next(map.pendingUpgrades, entityId)
|
||||
map.pendingUpgrades[entityId] = nil
|
||||
universe.pendingUpgradeIterator = next(universe.pendingUpgrades, entityId)
|
||||
universe.pendingUpgrades[entityId] = nil
|
||||
local surface = entity.surface
|
||||
local query = map.universe.upgradeEntityQuery
|
||||
local query = universe.upgradeEntityQuery
|
||||
query.position = entityData.position or entity.position
|
||||
query.name = entityData.name
|
||||
unregisterEnemyBaseStructure(map, entity)
|
||||
unregisterEnemyBaseStructure(entityData.map, entity)
|
||||
entity.destroy()
|
||||
local createdEntity = surface.create_entity(query)
|
||||
if createdEntity and createdEntity.valid then
|
||||
registerEnemyBaseStructure(map, createdEntity, tick, entityData.base)
|
||||
registerEnemyBaseStructure(entityData.map, createdEntity, tick, entityData.base)
|
||||
if remote.interfaces["kr-creep"] then
|
||||
remote.call("kr-creep", "spawn_creep_at_position", surface, query.position)
|
||||
end
|
||||
end
|
||||
else
|
||||
map.pendingUpgradeIterator = next(map.pendingUpgrades, entityId)
|
||||
map.pendingUpgrades[entityId] = nil
|
||||
universe.pendingUpgradeIterator = next(universe.pendingUpgrades, entityId)
|
||||
universe.pendingUpgrades[entityId] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user