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

285a553: Delayed purple settler cloud

This commit is contained in:
Aaron Veden 2023-01-07 22:53:47 -08:00
parent b7c30a37f0
commit bf854dcf72
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
6 changed files with 36 additions and 5 deletions

View File

@ -632,6 +632,8 @@ function upgrade.attempt(universe)
universe.expansionDistanceDeviation = universe.expansionMediumTargetDistance * 0.33
universe.pendingUpgrades = {}
universe.settlePurpleCloud = {}
universe.settlePurpleCloud.len = 0
for _,base in pairs(universe.bases) do
base.maxExpansionGroups = 0

View File

@ -22,6 +22,7 @@ Version: 3.2.0
- Kamikaze squads no longer use a separate movement function
- Reduced the raiding base threshold from 550 to 50 to account for the new pheromone distribution
- Added death pheromone scent multipler for destroyed enemy structures
- Settler purple cloud now doesn't trigger until two seconds after a settler group stops and the group and surface must still be valid
Bugfixes:
- Removed layer-13 from projectiles
- script_raised_built now looks for enemy faction and registers as needed

View File

@ -63,6 +63,8 @@ local MAX_HIVE_TTL = constants.MAX_HIVE_TTL
local MIN_HIVE_TTL = constants.MIN_HIVE_TTL
local DEV_HIVE_TTL = constants.DEV_HIVE_TTL
local SETTLE_CLOUD_WARMUP = constants.SETTLE_CLOUD_WARMUP
-- imported functions
local isMember = stringUtils.isMember
@ -73,10 +75,11 @@ local planning = aiPlanning.planning
local addBasesToAllEnemyStructures = chunkUtils.addBasesToAllEnemyStructures
local setPointAreaInQuery = queryUtils.setPointAreaInQuery
local setPositionInQuery = queryUtils.setPositionInQuery
local nextMap = mapUtils.nextMap
local processClouds = mapProcessor.processClouds
local distortPosition = mathUtils.distortPosition
local linearInterpolation = mathUtils.linearInterpolation
local gaussianRandomRangeRG = mathUtils.gaussianRandomRangeRG
@ -975,10 +978,16 @@ local function onBuilderArrived(event)
squad.commandTick = event.tick + COMMAND_TIMEOUT * 10
end
if universe.PRINT_BASE_SETTLING then
game.print("Settled: [gps=" .. builder.position.x .. "," .. builder.position.y .."]")
game.print(map.surface.name.." Settled: [gps=" .. builder.position.x .. "," .. builder.position.y .."]")
end
setPositionInQuery(universe.obaCreateBuildCloudQuery, builder.position)
map.surface.create_entity(universe.obaCreateBuildCloudQuery)
local len = universe.settlePurpleCloud.len + 1
universe.settlePurpleCloud.len = len
universe.settlePurpleCloud[len] = {
map = map,
position = builder.position,
squad = builder,
tick = event.tick + SETTLE_CLOUD_WARMUP
}
end
-- hooks
@ -1013,6 +1022,7 @@ script.on_event(defines.events.on_tick,
disperseVictoryScent(universe)
processAttackWaves(universe)
processNests(universe, tick)
processClouds(universe, tick)
elseif (pick == 4) then
if map then
scanResourceMap(map, tick)

View File

@ -92,6 +92,8 @@ constants.ENEMY_PHEROMONE_MULTIPLER = 500
constants.DURATION_ACTIVE_NEST = 120 * constants.TICKS_A_SECOND
constants.SETTLE_CLOUD_WARMUP = constants.TICKS_A_SECOND * 3
-- chunk properties
constants.CHUNK_SIZE = 32

View File

@ -21,6 +21,7 @@ local mapProcessor = {}
-- imports
local queryUtils = require("QueryUtils")
local pheromoneUtils = require("PheromoneUtils")
local aiAttackWave = require("AIAttackWave")
local aiPredicates = require("AIPredicates")
@ -60,6 +61,8 @@ local COOLDOWN_RETREAT = constants.COOLDOWN_RETREAT
-- imported functions
local setPositionInQuery = queryUtils.setPositionInQuery
local findNearbyBase = chunkPropertyUtils.findNearbyBase
local removeChunkToNest = mapUtils.removeChunkToNest
@ -554,5 +557,19 @@ function mapProcessor.processAttackWaves(universe)
universe.chunkToNests)
end
function mapProcessor.processClouds(universe, tick)
local len = universe.settlePurpleCloud.len
local builderPack = universe.settlePurpleCloud[len]
if builderPack and (builderPack.tick <= tick) then
universe.settlePurpleCloud[len] = nil
universe.settlePurpleCloud.len = len - 1
local map = builderPack.map
if builderPack.squad.group.valid and map.surface.valid then
setPositionInQuery(universe.obaCreateBuildCloudQuery, builderPack.position)
map.surface.create_entity(universe.obaCreateBuildCloudQuery)
end
end
end
mapProcessorG = mapProcessor
return mapProcessor

View File

@ -268,7 +268,6 @@ local function settleMove(map, squad)
end
local function attackMove(map, squad)
local universe = map.universe
local targetPosition = {0,0}