From 117e04ab6a93cecd809fb19a8b095295fa422a03 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Fri, 4 Mar 2022 18:55:23 +0000 Subject: rotate spawnzones if players die within their spawnzone --- Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut index 3cc4556b..84317c6e 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut @@ -582,7 +582,18 @@ entity function DecideSpawnZone_Generic( array spawnzones, int team ) break } - needNewZone = false + int numDeadInZone = 0 + array teamPlayers = GetPlayerArrayOfTeam( team ) + foreach ( entity player in teamPlayers ) + { + // check if they died in the zone recently, get a new zone if too many died + if ( Time() - player.p.postDeathThreadStartTime < 15.0 && spawnStateSpawnzones.activeTeamSpawnzones[ team ].ContainsPoint( player.p.deathOrigin ) ) + numDeadInZone++ + } + + // cast to float so result is float + if ( float( numDeadInZone ) / teamPlayers.len() <= 0.1 ) + needNewZone = false } if ( needNewZone ) @@ -618,6 +629,7 @@ entity function DecideSpawnZone_Generic( array spawnzones, int team ) } // don't choose spawnzones that are closer to enemy base than friendly base + // note: vanilla spawns might not necessarily require this, worth checking if ( !spawnzoneEvil && Distance2D( spawnzone.GetOrigin(), averageFriendlySpawns ) > Distance2D( spawnzone.GetOrigin(), averageEnemySpawns ) ) spawnzoneEvil = true -- cgit v1.2.3