Skip to content

Commit

Permalink
Frontbusters Spawning Tweak (beyond-all-reason#3351)
Browse files Browse the repository at this point in the history
scav-frontbusters-spawning-tweak
  • Loading branch information
Damgam authored Jul 8, 2024
1 parent a227273 commit 449ba66
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions luarules/gadgets/scav_spawner_defense.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1198,17 +1198,19 @@ if gadgetHandler:IsSyncedCode() then
end
end
if mRandom() <= config.spawnChance and waveParameters.frontbusters.cooldown <= 0 then
local squad = squadSpawnOptions.frontbusters[math.random(1, #squadSpawnOptions.frontbusters)]
if squad and squad.surface and ((surface == "land" and squad.surface ~= "sea") or (surface == "sea" and squad.surface ~= "land")) then
if mRandom() <= config.spawnChance and (not waveParameters.frontbusters.units[squad.name]) and squad.minAnger <= techAnger and squad.maxAnger >= techAnger and Spring.GetTeamUnitDefCount(scavTeamID, UnitDefNames[squad.name].id) < squad.maxAlive and waveParameters.frontbusters.unitCount == 0 then
for i = 1, math.ceil(squad.squadSize*config.spawnChance*((SetCount(humanTeams)*config.scavPerPlayerMultiplier)+(1-config.scavPerPlayerMultiplier))) do
waveParameters.frontbusters.units[squad.name] = true
waveParameters.frontbusters.unitCount = waveParameters.frontbusters.unitCount + 1
table.insert(spawnQueue, { burrow = burrowID, unitName = squad.name, team = scavTeamID, squadID = 1, alwaysVisible = true })
cCount = cCount + 1
for attempt = 1,10 do
local squad = squadSpawnOptions.frontbusters[math.random(1, #squadSpawnOptions.frontbusters)]
if squad and squad.surface and ((surface == "land" and squad.surface ~= "sea") or (surface == "sea" and squad.surface ~= "land")) then
if mRandom() <= config.spawnChance and (not waveParameters.frontbusters.units[squad.name]) and squad.minAnger <= techAnger and squad.maxAnger >= techAnger and Spring.GetTeamUnitDefCount(scavTeamID, UnitDefNames[squad.name].id) < squad.maxAlive and waveParameters.frontbusters.unitCount == 0 then
for i = 1, math.ceil(squad.squadSize*config.spawnChance*((SetCount(humanTeams)*config.scavPerPlayerMultiplier)+(1-config.scavPerPlayerMultiplier))) do
waveParameters.frontbusters.units[squad.name] = true
waveParameters.frontbusters.unitCount = waveParameters.frontbusters.unitCount + 1
table.insert(spawnQueue, { burrow = burrowID, unitName = squad.name, team = scavTeamID, squadID = 1, alwaysVisible = true })
cCount = cCount + 1
end
waveParameters.frontbusters.cooldown = math.random(3,5)
break
end
waveParameters.frontbusters.cooldown = math.random(3,5)
break
end
end
end
Expand Down

0 comments on commit 449ba66

Please sign in to comment.