diff options
author | Zanieon <william-millennium@hotmail.com> | 2024-08-30 15:16:35 +0200 |
---|---|---|
committer | Zanieon <william-millennium@hotmail.com> | 2024-08-30 15:16:35 +0200 |
commit | 9e9d08ff8ba0c85b90590f17cb9be38cba4f6450 (patch) | |
tree | 52ee264ef191846868e0733121013e14b38e2e76 /Northstar.CustomServers/mod/scripts | |
parent | 8b34689dca9f2392ad74c57a19e64ec58abda69e (diff) | |
download | NorthstarMods-9e9d08ff8ba0c85b90590f17cb9be38cba4f6450.tar.gz NorthstarMods-9e9d08ff8ba0c85b90590f17cb9be38cba4f6450.zip |
Move CTF spawn point related functions
as part of the refactoring effort in #830
Diffstat (limited to 'Northstar.CustomServers/mod/scripts')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut | 48 |
1 files changed, 24 insertions, 24 deletions
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<entity> 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<entity> 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 ) ) |