aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-06 21:52:34 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-06 21:52:34 +0000
commit1f534d940670d6df826be68b39fcaa846f139a81 (patch)
treeb5c08b6f8a12a2047455e9b1066d855bf803e632 /Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut
parentf1a07e1b01923b45f7a82c063d25b8dea5b13d53 (diff)
downloadNorthstarMods-1f534d940670d6df826be68b39fcaa846f139a81.tar.gz
NorthstarMods-1f534d940670d6df826be68b39fcaa846f139a81.zip
some bugfixes from playtest
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut15
1 files changed, 9 insertions, 6 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut
index dad94f67..09caa48d 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut
@@ -71,21 +71,24 @@ void function RateSpawnpoints_CTF( int checkClass, array<entity> spawnpoints, in
// get average startspawn position and max dist between spawns
// could probably cache this, tbh, not like it should change outside of halftimes
vector averageFriendlySpawns
- float maxFriendlySpawnDist
+ float averageFriendlySpawnDist
+
+ int averageDistCount
foreach ( entity spawn in startSpawns )
{
foreach ( entity otherSpawn in startSpawns )
{
float dist = Distance2D( spawn.GetOrigin(), otherSpawn.GetOrigin() )
- if ( dist > maxFriendlySpawnDist )
- maxFriendlySpawnDist = dist
+ averageFriendlySpawnDist += dist
+ averageDistCount++
}
averageFriendlySpawns += spawn.GetOrigin()
}
averageFriendlySpawns /= startSpawns.len()
+ averageFriendlySpawnDist /= averageDistCount
// get average enemy startspawn position
vector averageEnemySpawns
@@ -97,7 +100,7 @@ void function RateSpawnpoints_CTF( int checkClass, array<entity> spawnpoints, in
// from here, rate spawns
float baseDistance = Distance2D( averageFriendlySpawns, averageEnemySpawns )
- float spawnIterations = ( baseDistance / maxFriendlySpawnDist ) / 2
+ float spawnIterations = ( baseDistance / averageFriendlySpawnDist ) / 2
foreach ( entity spawn in spawnpoints )
{
@@ -108,11 +111,11 @@ void function RateSpawnpoints_CTF( int checkClass, array<entity> spawnpoints, in
for ( int i = 0; i < spawnIterations; i++ )
{
- vector zonePos = averageFriendlySpawns + Normalize( averageEnemySpawns - averageFriendlySpawns ) * ( i * maxFriendlySpawnDist )
+ vector zonePos = averageFriendlySpawns + Normalize( averageEnemySpawns - averageFriendlySpawns ) * ( i * averageFriendlySpawnDist )
float zonePower
foreach ( entity player in enemyPlayers )
- if ( Distance2D( player.GetOrigin(), zonePos ) < maxFriendlySpawnDist )
+ if ( Distance2D( player.GetOrigin(), zonePos ) < averageFriendlySpawnDist )
zonePower += 1.0 / enemyPlayers.len()
zonePower = min( zonePower, remainingZonePower )