mirror of
https://github.com/veden/Rampant.git
synced 2025-03-17 20:58:35 +02:00
non covered spawners are now processed regardless of active map
This commit is contained in:
parent
acc62fdf50
commit
71e40a9c46
@ -450,11 +450,13 @@ function upgrade.attempt(universe)
|
||||
universe.victoryScentIterator = nil
|
||||
universe.squadIterator = nil
|
||||
universe.processMapAIIterator = nil
|
||||
universe.processNestIterator = nil
|
||||
universe.vengenceQueue = {}
|
||||
universe.activeMap = nil
|
||||
universe.mapIterator = nil
|
||||
universe.builderCount = 0
|
||||
universe.squadCount = 0
|
||||
universe.chunkToNests = {}
|
||||
|
||||
game.print("Rampant - Version 2.0.0")
|
||||
end
|
||||
@ -503,7 +505,6 @@ function upgrade.prepMap(universe, surface)
|
||||
|
||||
map.pendingChunks = {}
|
||||
map.chunkToBase = {}
|
||||
map.chunkToNests = {}
|
||||
map.chunkToTurrets = {}
|
||||
map.chunkToTraps = {}
|
||||
map.chunkToUtilities = {}
|
||||
@ -537,7 +538,6 @@ function upgrade.prepMap(universe, surface)
|
||||
map.processActiveSpawnerIterator = nil
|
||||
map.processActiveRaidSpawnerIterator = nil
|
||||
map.processMigrationIterator = nil
|
||||
map.processNestIterator = nil
|
||||
|
||||
map.chunkScanCounts = {}
|
||||
|
||||
|
@ -26,6 +26,7 @@ Date: 23. 11. 2021
|
||||
- Victory scent is now processed regardless of current active surface
|
||||
- Pheromone map processing only does upto 5% of generated chunks on a surface before switching to the next surface
|
||||
- AI Planning will now happen on upto 15 surface per cycle
|
||||
- Spawners not covered by pollution are now processed regardless of current 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
|
||||
|
@ -1026,7 +1026,7 @@ script.on_event(defines.events.on_tick,
|
||||
scanEnemyMap(map, tick)
|
||||
elseif (pick == 6) then
|
||||
scanPlayerMap(map, tick)
|
||||
processNests(map, tick)
|
||||
processNests(universe, tick)
|
||||
elseif (pick == 7) then
|
||||
processPendingChunks(universe, tick)
|
||||
processScanChunks(map)
|
||||
|
@ -21,10 +21,6 @@ local mMin = math.min
|
||||
|
||||
-- module code
|
||||
|
||||
function chunkPropertyUtils.getNestCount(map, chunk)
|
||||
return map.chunkToNests[chunk.id] or 0
|
||||
end
|
||||
|
||||
function chunkPropertyUtils.getTurretCount(map, chunk)
|
||||
return map.chunkToTurrets[chunk.id] or 0
|
||||
end
|
||||
@ -126,34 +122,49 @@ function chunkPropertyUtils.removeHiveCount(map, chunk, unitNumber)
|
||||
end
|
||||
|
||||
function chunkPropertyUtils.addNestCount(map, chunk, unitNumber)
|
||||
if not map.chunkToNestIds[chunk.id] then
|
||||
map.chunkToNestIds[chunk.id] = {}
|
||||
local chunkId = chunk.id
|
||||
if not map.chunkToNestIds[chunkId] then
|
||||
map.chunkToNestIds[chunkId] = {}
|
||||
end
|
||||
if not map.chunkToNestIds[chunk.id][unitNumber] then
|
||||
map.chunkToNestIds[chunk.id][unitNumber] = true
|
||||
map.chunkToNests[chunk.id] = (map.chunkToNests[chunk.id] or 0) + 1
|
||||
if not map.chunkToNestIds[chunkId][unitNumber] then
|
||||
map.chunkToNestIds[chunkId][unitNumber] = true
|
||||
local cToN = map.universe.chunkToNests
|
||||
local pack = cToN[chunkId]
|
||||
if not pack then
|
||||
cToN[chunkId] = {
|
||||
map = map,
|
||||
v = 0
|
||||
}
|
||||
end
|
||||
cToN[chunkId].v = cToN[chunkId].v + 1
|
||||
end
|
||||
end
|
||||
|
||||
function chunkPropertyUtils.removeNestCount(map, chunk, unitNumber)
|
||||
if map.chunkToNestIds[chunk.id] and map.chunkToNestIds[chunk.id][unitNumber] then
|
||||
map.chunkToNestIds[chunk.id][unitNumber] = nil
|
||||
map.chunkToNests[chunk.id] = map.chunkToNests[chunk.id] - 1
|
||||
if map.chunkToNests[chunk.id] == 0 then
|
||||
map.chunkToNestIds[chunk.id] = nil
|
||||
map.chunkToNests[chunk.id] = nil
|
||||
if (map.processMigrationIterator == chunk.id) then
|
||||
local chunkId = chunk.id
|
||||
if map.chunkToNestIds[chunkId] and map.chunkToNestIds[chunkId][unitNumber] then
|
||||
map.chunkToNestIds[chunkId][unitNumber] = nil
|
||||
local cToN = map.universe.chunkToNests
|
||||
cToN[chunkId].v = cToN[chunkId].v - 1
|
||||
if cToN[chunkId].v == 0 then
|
||||
map.chunkToNestIds[chunkId] = nil
|
||||
cToN[chunkId] = nil
|
||||
if (map.processMigrationIterator == chunkId) then
|
||||
map.processMigrationIterator = nil
|
||||
end
|
||||
if (map.processNestIterator == chunk.id) then
|
||||
map.processNestIterator = nil
|
||||
if (map.universe.processNestIterator == chunkId) then
|
||||
map.universe.processNestIterator = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function chunkPropertyUtils.getNestCount(map, chunk)
|
||||
return map.chunkToNests[chunk.id] or 0
|
||||
local nestPack = map.universe.chunkToNests[chunk.id]
|
||||
if not nestPack then
|
||||
return 0
|
||||
end
|
||||
return nestPack.v
|
||||
end
|
||||
|
||||
function chunkPropertyUtils.getChunkBase(map, chunk)
|
||||
@ -175,7 +186,12 @@ function chunkPropertyUtils.setChunkBase(map, chunk, base)
|
||||
end
|
||||
|
||||
function chunkPropertyUtils.getEnemyStructureCount(map, chunk)
|
||||
return (map.chunkToNests[chunk.id] or 0) + (map.chunkToTurrets[chunk.id] or 0) + (map.chunkToTraps[chunk.id] or 0) +
|
||||
local nests = 0
|
||||
local nestPack = map.universe.chunkToNests[chunk.id]
|
||||
if nestPack then
|
||||
nests = nestPack.v
|
||||
end
|
||||
return nests + (map.chunkToTurrets[chunk.id] or 0) + (map.chunkToTraps[chunk.id] or 0) +
|
||||
(map.chunkToUtilities[chunk.id] or 0) + (map.chunkToHives[chunk.id] or 0)
|
||||
end
|
||||
|
||||
|
@ -459,15 +459,16 @@ function mapProcessor.processVengence(universe)
|
||||
end
|
||||
end
|
||||
|
||||
function mapProcessor.processNests(map, tick)
|
||||
local chunkId = next(map.chunkToNests, map.processNestIterator)
|
||||
map.processNestIterator = chunkId
|
||||
function mapProcessor.processNests(universe, tick)
|
||||
local chunkId, chunkPack = next(universe.chunkToNests, universe.processNestIterator)
|
||||
universe.processNestIterator = chunkId
|
||||
if chunkId then
|
||||
local map = chunkPack.map
|
||||
local chunk = getChunkById(map, chunkId)
|
||||
processNestActiveness(map, chunk)
|
||||
queueNestSpawners(map, chunk, tick)
|
||||
|
||||
if map.universe.NEW_ENEMIES then
|
||||
if universe.NEW_ENEMIES then
|
||||
local base = getChunkBase(map, chunk)
|
||||
if base and ((tick - base.tick) > BASE_PROCESS_INTERVAL) then
|
||||
processBase(chunk, map, tick, base)
|
||||
|
Loading…
x
Reference in New Issue
Block a user