From 9e9d08ff8ba0c85b90590f17cb9be38cba4f6450 Mon Sep 17 00:00:00 2001 From: Zanieon Date: Fri, 30 Aug 2024 15:16:35 +0200 Subject: Move CTF spawn point related functions as part of the refactoring effort in #830 --- .../scripts/vscripts/gamemodes/_gamemode_ctf.nut | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'Northstar.CustomServers') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut index 752aa907..3c5eb12c 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut @@ -67,30 +67,6 @@ void function CaptureTheFlag_Init() ScoreEvent_SetEarnMeterValues( "FlagReturn", 0.0, 0.20 ) } -void function RateSpawnpoints_CTF( int checkClass, array spawnpoints, int team, entity player ) -{ - RateSpawnpoints_SpawnZones( checkClass, spawnpoints, team, player ) -} - -bool function VerifyCTFSpawnpoint( entity spawnpoint, int team ) -{ - // ensure spawnpoints aren't too close to enemy base - vector allyFlagSpot - vector enemyFlagSpot - foreach ( entity spawn in GetEntArrayByClass_Expensive( "info_spawnpoint_flag" ) ) - { - if( spawn.GetTeam() == team ) - allyFlagSpot = spawn.GetOrigin() - else - enemyFlagSpot = spawn.GetOrigin() - } - - if( Distance2D( spawnpoint.GetOrigin(), allyFlagSpot ) > Distance2D( spawnpoint.GetOrigin(), enemyFlagSpot ) ) - return false - - return true -} - void function CreateFlags() { if ( IsValid( file.imcFlagSpawn ) ) @@ -211,6 +187,30 @@ void function RemoveFlags() SetFlagStateForTeam( TEAM_IMC, eFlagState.None ) } +void function RateSpawnpoints_CTF( int checkClass, array spawnpoints, int team, entity player ) +{ + RateSpawnpoints_SpawnZones( checkClass, spawnpoints, team, player ) +} + +bool function VerifyCTFSpawnpoint( entity spawnpoint, int team ) +{ + // ensure spawnpoints aren't too close to enemy base + vector allyFlagSpot + vector enemyFlagSpot + foreach ( entity spawn in GetEntArrayByClass_Expensive( "info_spawnpoint_flag" ) ) + { + if( spawn.GetTeam() == team ) + allyFlagSpot = spawn.GetOrigin() + else + enemyFlagSpot = spawn.GetOrigin() + } + + if( Distance2D( spawnpoint.GetOrigin(), allyFlagSpot ) > Distance2D( spawnpoint.GetOrigin(), enemyFlagSpot ) ) + return false + + return true +} + void function CTFInitPlayer( entity player ) { if ( !IsValid( file.imcFlagSpawn ) ) -- cgit v1.2.3