diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-03-04 18:55:23 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-03-04 18:55:23 +0000 |
commit | 117e04ab6a93cecd809fb19a8b095295fa422a03 (patch) | |
tree | a370a6b1e78ea67f232a84f1bd7348fa8609869b /Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut | |
parent | ff38894d1a78a889013af5ed38e3a6d3919c7fdd (diff) | |
download | NorthstarMods-117e04ab6a93cecd809fb19a8b095295fa422a03.tar.gz NorthstarMods-117e04ab6a93cecd809fb19a8b095295fa422a03.zip |
rotate spawnzones if players die within their spawnzone
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut | 14 |
1 files changed, 13 insertions, 1 deletions
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<entity> spawnzones, int team ) break } - needNewZone = false + int numDeadInZone = 0 + array<entity> 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<entity> 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 |