aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut20
1 files changed, 14 insertions, 6 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut
index 70d1e527..94138561 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/spawn.nut
@@ -7,6 +7,7 @@ global function SetRespawnsEnabled
global function RespawnsEnabled
global function SetSpawnpointGamemodeOverride
global function GetSpawnpointGamemodeOverride
+global function AddSpawnpointValidationRule
global function CreateNoSpawnArea
global function DeleteNoSpawnArea
@@ -27,6 +28,7 @@ struct NoSpawnArea
struct {
bool respawnsEnabled = true
string spawnpointGamemodeOverride
+ array< bool functionref( entity, int ) > customSpawnpointValidationRules
table<string, NoSpawnArea> noSpawnAreas
@@ -75,6 +77,11 @@ bool function RespawnsEnabled()
return file.respawnsEnabled
}
+void function AddSpawnpointValidationRule( bool functionref( entity spawn, int team ) rule )
+{
+ file.customSpawnpointValidationRules.append( rule )
+}
+
string function CreateNoSpawnArea( int blockSpecificTeam, int blockEnemiesOfTeam, vector position, float lifetime, float radius )
{
NoSpawnArea noSpawnArea
@@ -166,7 +173,7 @@ entity function FindSpawnPoint( entity player, bool isTitan, bool useStartSpawnp
}
entity spawnpoint = GetBestSpawnpoint( player, spawnpoints )
-
+
spawnpoint.s.lastUsedTime = Time()
player.SetLastSpawnPoint( spawnpoint )
@@ -230,21 +237,22 @@ bool function IsSpawnpointValid( entity spawnpoint, int team )
else if ( GameModeRemove( spawnpoint ) )
return false
}
-
- if ( Riff_FloorIsLava() && spawnpoint.GetOrigin().z < GetLethalFogTop() )
- return false
int compareTeam = spawnpoint.GetTeam()
if ( HasSwitchedSides() && ( compareTeam == TEAM_MILITIA || compareTeam == TEAM_IMC ) )
compareTeam = GetOtherTeam( compareTeam )
-
+
+ foreach ( bool functionref( entity, int ) customValidationRule in file.customSpawnpointValidationRules )
+ if ( !customValidationRule( spawnpoint, team ) )
+ return false
+
if ( spawnpoint.GetTeam() > 0 && compareTeam != team && !IsFFAGame() )
return false
if ( spawnpoint.IsOccupied() )
return false
- if ( Time() - spawnpoint.s.lastUsedTime <= 1.0 )
+ if ( Time() - spawnpoint.s.lastUsedTime <= 10.0 )
return false
foreach ( k, NoSpawnArea noSpawnArea in file.noSpawnAreas )