From 4582f57a5b82d8c75666010081573df0d86ee03a Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Thu, 3 Mar 2022 22:03:41 +0000 Subject: cleanup respawn and script prediction management code --- .../mod/scripts/vscripts/mp/_base_gametype_mp.gnut | 22 +++++++++++++--------- .../mod/scripts/vscripts/mp/_gamestate_mp.nut | 4 ++-- 2 files changed, 15 insertions(+), 11 deletions(-) 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 d22f2627..4168de30 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -206,21 +206,25 @@ void function CodeCallback_OnClientDisconnected( entity player, string reason ) void function CodeCallback_OnPlayerRespawned( entity player ) { - player.Signal( "OnRespawned" ) // kill any postdeaththreads that could be running - - Remote_CallFunction_NonReplay( player, "ServerCallback_YouRespawned" ) + SetHumanRagdollImpactTable( player ) + + player.s.respawnCount++ player.s.respawnTime = Time() + ClearRecentDamageHistory( player ) + + player.Signal( "OnRespawned" ) // kill any postdeaththreads that could be running - player.SetPredictionEnabled( true ) Loadouts_TryGivePilotLoadout( player ) - SetHumanRagdollImpactTable( player ) - ClearLastAttacker( player ) // so dying to anything doesn't credit the same attacker after respawning + //player.SetPredictionEnabled( true ) doesn't seem needed, as native code seems to set this foreach ( entity weapon in player.GetMainWeapons() ) weapon.SetProScreenOwner( player ) foreach ( void functionref( entity ) callback in svGlobal.onPlayerRespawnedCallbacks ) callback( player ) + + Remote_CallFunction_NonReplay( player, "ServerCallback_YouRespawned" ) + ClearLastAttacker( player ) // so dying to anything doesn't credit the same attacker after respawning } void function CodeCallback_OnPlayerKilled( entity player, var damageInfo ) @@ -254,7 +258,8 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga player.SetNoTargetSmartAmmo( false ) player.ClearExtraWeaponMods() - + // disable prediction to prevent it messing with ragdoll in some places, as well as killreplay and such + player.SetPredictionEnabled( false ) if ( player.IsTitan() ) SoulDies( player.GetTitanSoul(), damageInfo ) // cleanup some titan stuff, no idea where else to put this @@ -269,7 +274,6 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga player.s.inPostDeath = false }) - entity attacker = DamageInfo_GetAttacker( damageInfo ) int methodOfDeath = DamageInfo_GetDamageSourceIdentifier( damageInfo ) @@ -401,7 +405,7 @@ void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, fl player.Signal( "KillCamOver" ) player.ClearReplayDelay() player.ClearViewEntity() - player.SetPredictionEnabled( true ) + //player.SetPredictionEnabled( true ) doesn't seem needed, as native code seems to set this on respawn } }) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index 7e9943c3..e8b636ff 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -395,7 +395,7 @@ void function PlayerWatchesRoundWinningKillReplay( entity player, float replayLe else wait replayLength - player.SetPredictionEnabled( true ) + //player.SetPredictionEnabled( true ) doesn't seem needed, as native code seems to set this on respawn player.ClearReplayDelay() player.ClearViewEntity() player.UnfreezeControlsOnServer() @@ -486,7 +486,7 @@ void function PlayerWatchesSwitchingSidesKillReplay( entity player, bool doRepla else wait SWITCHING_SIDES_DELAY_REPLAY // extra delay if no replay - player.SetPredictionEnabled( true ) + //player.SetPredictionEnabled( true ) doesn't seem needed, as native code seems to set this on respawn player.ClearReplayDelay() player.ClearViewEntity() } -- cgit v1.2.3