1
0
mirror of https://github.com/veden/Rampant.git synced 2025-03-17 20:58:35 +02:00

victory scent is processed regardless of current map

This commit is contained in:
Aaron Veden 2021-12-06 21:56:09 -08:00
parent e7a988aae1
commit 09a9c51cec
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
5 changed files with 22 additions and 12 deletions

View File

@ -441,11 +441,13 @@ function upgrade.attempt(universe)
universe.chunkIdToChunk = {}
universe.groupNumberToSquad = {}
universe.pendingUpgrades = {}
universe.chunkToVictory = {}
universe.pendingChunks = {}
universe.processActiveNest = {}
universe.processActiveNestIterator = nil
universe.deployVengenceIterator = nil
universe.pendingUpgradeIterator = nil
universe.victoryScentIterator = nil
universe.squadIterator = nil
universe.vengenceQueue = {}
universe.activeMap = nil
@ -526,7 +528,6 @@ function upgrade.prepMap(universe, surface)
map.chunkToPathRating = {}
map.chunkToDeathGenerator = {}
map.chunkToDrained = {}
map.chunkToVictory = {}
map.chunkToActiveNest = {}
map.chunkToActiveRaidNest = {}
@ -536,7 +537,6 @@ function upgrade.prepMap(universe, surface)
map.processActiveRaidSpawnerIterator = nil
map.processMigrationIterator = nil
map.processNestIterator = nil
map.victoryScentIterator = nil
map.chunkScanCounts = {}

View File

@ -23,6 +23,7 @@ Date: 23. 11. 2021
- Newly generated chunks are now processed regardless of current active surface
- Neutral death events that aren't cliffs are no longer processed
- Added support for AbandonedRuins mod
- Victory scent is 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

View File

@ -1015,7 +1015,7 @@ script.on_event(defines.events.on_tick,
processMap(map, tick)
elseif (pick == 3) then
processStaticMap(map)
disperseVictoryScent(map)
disperseVictoryScent(universe)
processVengence(universe)
elseif (pick == 4) then
scanResourceMap(map, tick)

View File

@ -287,7 +287,15 @@ function chunkPropertyUtils.addDeathGenerator(map, chunk, value)
end
function chunkPropertyUtils.addVictoryGenerator(map, chunk, value)
map.chunkToVictory[chunk.id] = (map.chunkToVictory[chunk.id] or 0) + value
local cToV = map.universe.chunkToVictory
local chunkId = chunk.id
if not cToV[chunkId] then
cToV[chunkId] = {
map = map,
v = 0
}
end
cToV[chunkId].v = cToV[chunkId].v + value
end
function chunkPropertyUtils.decayDeathGenerator(map, chunk)

View File

@ -63,18 +63,19 @@ function pheromoneUtils.victoryScent(map, chunk, entityType)
end
end
function pheromoneUtils.disperseVictoryScent(map)
local chunkId = map.victoryScentIterator
local chunkToVictory = map.chunkToVictory
local pheromone
function pheromoneUtils.disperseVictoryScent(universe)
local chunkId = universe.victoryScentIterator
local chunkToVictory = universe.chunkToVictory
local pheromonePack
if not chunkId then
chunkId, pheromone = next(chunkToVictory, nil)
chunkId, pheromonePack = next(chunkToVictory, nil)
else
pheromone = chunkToVictory[chunkId]
pheromonePack = chunkToVictory[chunkId]
end
if not chunkId then
map.victoryScentIterator = nil
universe.victoryScentIterator = nil
else
local map = pheromonePack.map
map.victoryScentIterator = next(chunkToVictory, chunkId)
chunkToVictory[chunkId] = nil
local chunk = getChunkById(map, chunkId)
@ -85,7 +86,7 @@ function pheromoneUtils.disperseVictoryScent(map)
for y = chunkY - VICTORY_SCENT_BOUND, chunkY + VICTORY_SCENT_BOUND,32 do
local c = getChunkByXY(map, x, y)
if (c ~= -1) then
addDeathGenerator(map, c, -pheromone * VICTORY_SCENT_MULTIPLER[i] * getPathRating(map, c))
addDeathGenerator(map, c, -pheromonePack.v * VICTORY_SCENT_MULTIPLER[i] * getPathRating(map, c))
end
i = i + 1
end