aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/gamemodes
diff options
context:
space:
mode:
authorWilliam Miller <william-millennium@hotmail.com>2024-07-05 19:02:11 -0300
committerGitHub <noreply@github.com>2024-07-06 00:02:11 +0200
commit0198d3f99c40ab641c85fff62b62276407e0dfc3 (patch)
tree99b555698aeb4ec2bef26817cb7fe4b632cad967 /Northstar.CustomServers/mod/scripts/vscripts/gamemodes
parent8181dd7e0726883e335d09df637487f61dcbbb11 (diff)
downloadNorthstarMods-0198d3f99c40ab641c85fff62b62276407e0dfc3.tar.gz
NorthstarMods-0198d3f99c40ab641c85fff62b62276407e0dfc3.zip
Unfuck the Spawns (#808)v1.26.1-rc4v1.26.1-rc3v1.26.1-rc2
1. Get rid of the odd logic of limiting the algorithm to 3 spawn points 2. Changes the specific CTF algorithm to calculate the spawn points from the flag bases themselves rather than the initial spawn points which was causing severe inconsistencies. 3. Remove some checks in regards to map side swapping when matches reaches half-times due to odd behaviour in native code 4. Mitigate usage of `GetOtherTeam` for certain checks since that function might return Unreachable when it's a gamemode with more than 2 Teams and intentionally script crash the server.
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/gamemodes')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut31
1 files changed, 12 insertions, 19 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut
index fefdbcdd..97addc24 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut
@@ -75,27 +75,20 @@ 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
+ 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 ( HasSwitchedSides() )
- 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()
+ if( Distance2D( spawnpoint.GetOrigin(), allyFlagSpot ) > Distance2D( spawnpoint.GetOrigin(), enemyFlagSpot ) )
+ return false
- return Distance2D( spawnpoint.GetOrigin(), averageEnemySpawns ) / Distance2D( averageFriendlySpawns, averageEnemySpawns ) > 0.35
+ return true
}
void function CTFInitPlayer( entity player )