aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2023-09-02 17:49:26 +0100
committerGitHub <noreply@github.com>2023-09-02 18:49:26 +0200
commitf16af287534fceeb466bbd474d1ab3d94c19d1a3 (patch)
treecb53f55621edebaf19e3dfc3b1d833fe7d68e206
parent2b263286512ebb1b59980f8c1f442576992323bd (diff)
downloadNorthstarMods-f16af287534fceeb466bbd474d1ab3d94c19d1a3.tar.gz
NorthstarMods-f16af287534fceeb466bbd474d1ab3d94c19d1a3.zip
Force player respawn to match vanilla (#554)
Automatically respawns dead players after 5 seconds unless set otherwise
-rw-r--r--Northstar.Client/mod/resource/northstar_client_localisation_english.txt1
-rw-r--r--Northstar.CustomServers/keyvalues/playlists_v2.txt13
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_private_lobby_modes_init.gnut1
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut25
4 files changed, 40 insertions, 0 deletions
diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt
index 5dabd539..b2608331 100644
--- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt
+++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt
@@ -227,6 +227,7 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a
"classic_rodeo" "Classic Rodeo"
"oob_timer_enabled" "Out of Bounds Timer"
"riff_instagib" "Instagib Mode"
+ "player_force_respawn" "Forced Respawn"
"riff_player_bleedout" "Pilot Bleedout"
"player_bleedout_forceHolster" "Holster weapons when downed"
diff --git a/Northstar.CustomServers/keyvalues/playlists_v2.txt b/Northstar.CustomServers/keyvalues/playlists_v2.txt
new file mode 100644
index 00000000..c49fb0e9
--- /dev/null
+++ b/Northstar.CustomServers/keyvalues/playlists_v2.txt
@@ -0,0 +1,13 @@
+playlists
+{
+ Gamemodes
+ {
+ defaults
+ {
+ vars
+ {
+ player_force_respawn 5
+ }
+ }
+ }
+}
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_private_lobby_modes_init.gnut b/Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_private_lobby_modes_init.gnut
index ccccefaf..d2be2ab4 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_private_lobby_modes_init.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_private_lobby_modes_init.gnut
@@ -17,6 +17,7 @@ void function PrivateMatchModesInit()
AddPrivateMatchModeSettingEnum( "#MODE_SETTING_CATEGORY_PILOT", "boosts_enabled", [ "#SETTING_DEFAULT", "#SETTING_DISABLED" ], "1" )
AddPrivateMatchModeSettingEnum( "#MODE_SETTING_CATEGORY_PILOT", "earn_meter_pilot_overdrive", [ "#SETTING_DISABLED", "#SETTING_ENABLED", "Only" ], "1" )
AddPrivateMatchModeSettingArbitrary( "#MODE_SETTING_CATEGORY_PILOT", "earn_meter_pilot_multiplier", "1.0" )
+ AddPrivateMatchModeSettingArbitrary( "#MODE_SETTING_CATEGORY_PILOT", "player_force_respawn", "5" )
AddPrivateMatchModeSettingArbitrary( "#MODE_SETTING_CATEGORY_TITAN", "earn_meter_titan_multiplier", "1.0" )
AddPrivateMatchModeSettingEnum( "#MODE_SETTING_CATEGORY_TITAN", "aegis_upgrades", [ "#SETTING_DISABLED", "#SETTING_ENABLED" ], "0" )
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut
index ec426754..3bd0cd69 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut
@@ -274,6 +274,9 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga
ClearRespawnAvailable( player )
+ // reset this so that we default to pilot spawn
+ player.SetPersistentVar( "spawnAsTitan", false )
+
OnThreadEnd( function() : ( player )
{
if ( !IsValid( player ) )
@@ -379,6 +382,13 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga
SetRespawnAvailable( player )
wait respawnDelay
+
+ int forceRespawn = GetCurrentPlaylistVarInt( "player_force_respawn", -1 )
+
+ // -1 is disabled, anything over is the time we wait in seconds
+ // before respawning the player
+ if( forceRespawn >= 0 )
+ thread ForceRespawnMeSignalAfterDelay( player, forceRespawn )
player.WaitSignal( "RespawnMe" ) // set in base_gametype: ClientCommand_RespawnPlayer
@@ -398,6 +408,21 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga
}
}
+// idk if this is a good delay or if it matches vanilla
+void function ForceRespawnMeSignalAfterDelay( entity player, int delay = 5 )
+{
+ player.EndSignal( "RespawnMe" )
+ player.EndSignal( "OnDestroy" )
+
+ if( player.IsWatchingKillReplay() )
+ player.WaitSignal( "KillCamOver" )
+
+ wait delay
+
+ printt( format( "Forcing player respawn for player %s (took >%d seconds to respawn)", player.GetPlayerName(), delay ) )
+ player.Signal( "RespawnMe" )
+}
+
void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, float timeSinceAttackerSpawned, float timeOfDeath, float beforeTime, table replayTracker )
{
player.EndSignal( "RespawnMe" )