aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/scripts
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-07-17 23:46:52 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-07-17 23:46:52 +0100
commit27bd240871b7c0f2f49fef137718b2e3c208e3b4 (patch)
treea46f401fa389edbb42a32fe8674cbde3a28e7632 /Northstar.CustomServers/scripts
parent1c1d36fad84687a93a629525145c557f78cbf673 (diff)
downloadNorthstarMods-27bd240871b7c0f2f49fef137718b2e3c208e3b4.tar.gz
NorthstarMods-27bd240871b7c0f2f49fef137718b2e3c208e3b4.zip
ctf switchsides spawn fix (untested)
Diffstat (limited to 'Northstar.CustomServers/scripts')
-rw-r--r--Northstar.CustomServers/scripts/vscripts/_loadouts_mp.gnut2
-rw-r--r--Northstar.CustomServers/scripts/vscripts/_misc.gnut16
-rw-r--r--Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_ctf.nut8
-rw-r--r--Northstar.CustomServers/scripts/vscripts/lobby/_private_lobby.gnut14
-rw-r--r--Northstar.CustomServers/scripts/vscripts/mp/_base_gametype_mp.gnut17
-rw-r--r--Northstar.CustomServers/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut13
-rw-r--r--Northstar.CustomServers/scripts/vscripts/mp/_gamestate_mp.nut4
7 files changed, 48 insertions, 26 deletions
diff --git a/Northstar.CustomServers/scripts/vscripts/_loadouts_mp.gnut b/Northstar.CustomServers/scripts/vscripts/_loadouts_mp.gnut
index 2a6eb5a8..2b7b90b3 100644
--- a/Northstar.CustomServers/scripts/vscripts/_loadouts_mp.gnut
+++ b/Northstar.CustomServers/scripts/vscripts/_loadouts_mp.gnut
@@ -54,7 +54,7 @@ void function SetWeaponDropsEnabled( bool enabled )
void function DestroyDroppedWeapon( entity victim, entity attacker, var damageInfo )
{
- if ( !file.weaponDropsEnabled )
+ if ( !file.weaponDropsEnabled && IsValid( victim.GetActiveWeapon() ) )
victim.GetActiveWeapon().Destroy()
}
diff --git a/Northstar.CustomServers/scripts/vscripts/_misc.gnut b/Northstar.CustomServers/scripts/vscripts/_misc.gnut
index 4384f8df..ef7e629f 100644
--- a/Northstar.CustomServers/scripts/vscripts/_misc.gnut
+++ b/Northstar.CustomServers/scripts/vscripts/_misc.gnut
@@ -12,21 +12,7 @@ void function Spotting_Init()
void function FW_Border_GlobalInit()
{
- AddCallback_EntitiesDidLoad( FW_Border_EntitiesDidLoad )
-}
-
-void function FW_Border_EntitiesDidLoad()
-{
- if ( GetConVarString( "mp_gamemode" ) != "fw" )
- {
- // remove fw borders if we're not playing fw
- array<entity> brushes = GetEntArrayByClass_Expensive( "func_brush" )
- foreach ( entity brush in brushes )
- if ( GetEditorClass( brush ) == "func_brush_fw_territory_border" && GameModeRemove( brush ) )
- brush.Destroy()
-
- return
- }
+ AddSpawnCallbackEditorClass( "func_brush", "func_brush_fw_territory_border", void function( entity e ) { GameModeRemove( e ) } )
}
bool function IsVDUTitan(entity titan)
diff --git a/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_ctf.nut b/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_ctf.nut
index 728d742d..704f55d3 100644
--- a/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_ctf.nut
+++ b/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_ctf.nut
@@ -69,8 +69,12 @@ void function RateSpawnpoints_CTF( int checkClass, array<entity> spawnpoints, in
// if there are, spawn them outside of it ( but ideally still close )
// max distance away should be like, angel city markets
- array<entity> startSpawns = SpawnPoints_GetPilotStart( team )
- array<entity> enemyPlayers = GetPlayerArrayOfTeam_Alive( GetOtherTeam( team ) )
+ int spawnTeam = team
+ if ( HasSwitchedSides() )
+ spawnTeam = GetOtherTeam( team )
+
+ array<entity> startSpawns = SpawnPoints_GetPilotStart( spawnTeam )
+ array<entity> enemyPlayers = GetPlayerArrayOfTeam_Alive( GetOtherTeam( spawnTeam ) )
vector startSpawnAverage
bool enemyInBase = false
diff --git a/Northstar.CustomServers/scripts/vscripts/lobby/_private_lobby.gnut b/Northstar.CustomServers/scripts/vscripts/lobby/_private_lobby.gnut
index 1b4e5dbd..896ab207 100644
--- a/Northstar.CustomServers/scripts/vscripts/lobby/_private_lobby.gnut
+++ b/Northstar.CustomServers/scripts/vscripts/lobby/_private_lobby.gnut
@@ -17,6 +17,8 @@ void function PrivateLobby_Init()
AddClientCommandCallback( "PrivateMatchSetMode", ClientCommandCallback_PrivateMatchSetMode )
AddClientCommandCallback( "SetCustomMap", ClientCommandCallback_SetCustomMap )
AddClientCommandCallback( "PrivateMatchSwitchTeams", ClientCommandCallback_PrivateMatchSwitchTeams )
+
+ AddClientCommandCallback( "PrivateMatchSetPlaylistVarOverride", ClientCommandCallback_PrivateMatchSetPlaylistVarOverride )
AddClientCommandCallback( "ResetMatchSettingsToDefault", ClientCommandCallback_ResetMatchSettingsToDefault )
}
@@ -160,6 +162,18 @@ void function RefreshPlayerTeams()
}
}
+bool function ClientCommandCallback_PrivateMatchSetPlaylistVarOverride( entity player, array<string> args )
+{
+ // note: atm this doesn't actually check for the number of overrides, since there's no way to do this on server yet
+ // need to expose this to script soon
+
+ if ( args.len() < 2 )
+ return true
+
+ SetPlaylistVarOverride( args[0], args[1] )
+ return true
+}
+
bool function ClientCommandCallback_ResetMatchSettingsToDefault( entity player, array<string> args )
{
ClearPlaylistVarOverrides()
diff --git a/Northstar.CustomServers/scripts/vscripts/mp/_base_gametype_mp.gnut b/Northstar.CustomServers/scripts/vscripts/mp/_base_gametype_mp.gnut
index 9d2ccc91..9274854a 100644
--- a/Northstar.CustomServers/scripts/vscripts/mp/_base_gametype_mp.gnut
+++ b/Northstar.CustomServers/scripts/vscripts/mp/_base_gametype_mp.gnut
@@ -339,8 +339,7 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga
if ( "respawnTime" in attacker.s )
respawnTime = Time() - expect float ( attacker.s.respawnTime )
- thread PlayerWatchesKillReplay( player, attacker.GetEncodedEHandle(), attacker.GetIndexForEntity(), respawnTime, timeOfDeath, beforeTime, replayTracker )
- thread EndReplayOnTime( player, replayLength )
+ thread PlayerWatchesKillReplayWrapper( player, attacker, respawnTime, timeOfDeath, beforeTime, replayTracker )
}
player.SetPlayerSettings( "spectator" ) // prevent a crash with going from titan => pilot on respawn
@@ -356,10 +355,10 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga
SetRespawnAvailable( player )
wait respawnDelay
+
+ player.WaitSignal( "RespawnMe" ) // set in base_gametype: ClientCommand_RespawnPlayer
player.SetPredictionEnabled( true )
-
- player.WaitSignal( "RespawnMe" ) // set in base_gametype: ClientCommand_RespawnPlayer
ClearRespawnAvailable( player ) // need so the respawn icon doesn't show for like a frame on next death
if ( ( expect bool( player.GetPersistentVar( "spawnAsTitan" ) ) && IsTitanAvailable( player ) ) || ( Riff_SpawnAsTitan() > 0 && Riff_ShouldSpawnAsTitan( player ) ) ) // spawn as titan
@@ -373,6 +372,14 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga
}
}
+void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, float timeSinceAttackerSpawned, float timeOfDeath, float beforeTime, table replayTracker )
+{
+ PlayerWatchesKillReplay( player, attacker.GetEncodedEHandle(), attacker.GetIndexForEntity(), timeSinceAttackerSpawned, timeOfDeath, beforeTime, replayTracker )
+ player.ClearReplayDelay()
+ player.ClearViewEntity()
+ player.SetPredictionEnabled( true )
+}
+
void function EndReplayOnTime( entity player, float replayLength )
{
player.EndSignal( "RespawnMe" )
@@ -381,6 +388,8 @@ void function EndReplayOnTime( entity player, float replayLength )
wait replayLength
if ( IsValid( player ) && KillcamsEnabled() )
{
+ print( "fucking how" )
+
player.ClearReplayDelay()
player.ClearViewEntity()
player.SetPredictionEnabled( true )
diff --git a/Northstar.CustomServers/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut b/Northstar.CustomServers/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut
index 7d5fb9f0..02c312be 100644
--- a/Northstar.CustomServers/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut
+++ b/Northstar.CustomServers/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut
@@ -72,9 +72,6 @@ void function DropshipIntro_OnClientConnected( entity player )
return
}
-
- // if we're at this point, we have more players than we do dropships, oh dear
- RespawnAsPilot( player )
}
void function DropshipIntro_OnClientDisconnected( entity player )
@@ -159,6 +156,16 @@ void function SpawnPlayerIntoDropship( entity player )
break
}
+
+ if ( playerDropship.dropship == null )
+ {
+ // if we're at this point, we have more players than we do dropships, oh dear
+ ScreenFadeFromBlack( player, 0.0 )
+ RespawnAsPilot( player )
+
+ file.numPlayersInIntro--
+ return
+ }
// figure out what anims we're using for idle
string idleAnim = DROPSHIP_IDLE_ANIMS[ playerDropshipIndex ]
diff --git a/Northstar.CustomServers/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/scripts/vscripts/mp/_gamestate_mp.nut
index bbeb72fb..96a61b69 100644
--- a/Northstar.CustomServers/scripts/vscripts/mp/_gamestate_mp.nut
+++ b/Northstar.CustomServers/scripts/vscripts/mp/_gamestate_mp.nut
@@ -51,7 +51,7 @@ struct {
void function PIN_GameStart()
{
- // todo: using the pin telemetry function here is weird and was done veeery early on before i knew how this all worked, should use a different one
+ // todo: using the pin telemetry function here, weird and was done veeery early on before i knew how this all worked, should use a different one
// called from InitGameState
//FlagInit( "ReadyToStartMatch" )
@@ -596,6 +596,8 @@ void function CleanUpEntitiesForRoundEnd()
foreach ( entity player in GetPlayerArray() )
{
+ ClearTitanAvailable( player )
+
if ( IsAlive( player ) )
player.Die()