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

adding max consecutive wanders to squads

This commit is contained in:
Aaron Veden 2021-12-05 17:17:41 -08:00
parent 47e20864e1
commit 15c140b728
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
3 changed files with 12 additions and 4 deletions

View File

@ -11,6 +11,7 @@ Date: 23. 11. 2021
- Optimized regional base upgrades so that the work is spread over many ticks reducing lag spikes
- Optimized adding new chunks to the Rampant in-memory state map
- Added minimum building cost upgrade check before base upgrade performs scanning
- Added max number of wander commands in a row for squads that aren't going anywhere before disbanding squad
- Optimized energy thief faction
- 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

View File

@ -364,12 +364,18 @@ function squadAttack.cleanSquads(map, tick)
end
squads[groupId] = nil
elseif (group.state == 4) then
squad.wanders = 0
squadAttack.squadDispatch(map, squad, tick)
elseif (squad.commandTick and (squad.commandTick < tick)) then
local cmd = map.universe.wander2Command
squad.commandTick = tick + COMMAND_TIMEOUT
group.set_command(cmd)
group.start_moving()
if squad.wanders > 5 then
squad.group.destroy()
else
squad.wanders = squad.wanders + 1
local cmd = map.universe.wander2Command
squad.commandTick = tick + COMMAND_TIMEOUT
group.set_command(cmd)
group.start_moving()
end
end
end
end

View File

@ -83,6 +83,7 @@ function unitGroupUtils.createSquad(position, surface, group, settlers)
penalties = {},
base = nil,
frenzy = false,
wanders = 0,
settlers = settlers or false,
kamikaze = false,
frenzyPosition = {x = 0,