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-11 17:12:25 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-11 17:12:25 +0000
commit8cd6924c1112213442b755866a5b6811efae236c (patch)
tree6c04cf94d86e5f7977105f4e8e5a1d64282a44b0 /Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut
parentb3f0e4598c5c573b0e79a8a9307966d2c07f5e4a (diff)
downloadNorthstarMods-8cd6924c1112213442b755866a5b6811efae236c.tar.gz
NorthstarMods-8cd6924c1112213442b755866a5b6811efae236c.zip
fixes from playtests
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut28
1 files changed, 28 insertions, 0 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut
index 09caa48d1..4a756c02f 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut
@@ -40,6 +40,8 @@ void function CaptureTheFlag_Init()
AddCallback_OnPlayerKilled( OnPlayerKilled )
AddCallback_OnPilotBecomesTitan( DropFlagForBecomingTitan )
+ AddSpawnpointValidationRule( VerifyCTFSpawnpoint )
+
RegisterSignal( "FlagReturnEnded" )
RegisterSignal( "ResetDropTimeout" )
@@ -128,6 +130,32 @@ void function RateSpawnpoints_CTF( int checkClass, array<entity> spawnpoints, in
}
}
+bool function VerifyCTFSpawnpoint( entity spawnpoint, int team )
+{
+ // ensure spawnpoints aren't too close to enemy base
+
+ if ( HasSwitchedSides() && spawnpoint.GetTeam() >= 2 )
+ team = GetOtherTeam( team )
+
+ array<entity> startSpawns = SpawnPoints_GetPilotStart( team )
+ array<entity> enemyStartSpawns = SpawnPoints_GetPilotStart( GetOtherTeam( team ) )
+
+ vector averageFriendlySpawns
+ vector averageEnemySpawns
+
+ foreach ( entity spawn in startSpawns )
+ averageFriendlySpawns += spawn.GetOrigin()
+
+ averageFriendlySpawns /= startSpawns.len()
+
+ foreach ( entity spawn in enemyStartSpawns )
+ averageEnemySpawns += spawn.GetOrigin()
+
+ averageEnemySpawns /= startSpawns.len()
+
+ return Distance2D( spawnpoint.GetOrigin(), averageEnemySpawns ) / Distance2D( averageFriendlySpawns, averageEnemySpawns ) > 0.35
+}
+
void function CTFInitPlayer( entity player )
{
if ( !IsValid( file.imcFlagSpawn ) )