aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-03-03 22:03:41 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-03-03 22:03:41 +0000
commit4582f57a5b82d8c75666010081573df0d86ee03a (patch)
treebdd899ec8498501a74ff19bc9606254bb9fddc50
parenta614d9c52ee1015a340609daa4196613ab37825d (diff)
downloadNorthstarMods-4582f57a5b82d8c75666010081573df0d86ee03a.tar.gz
NorthstarMods-4582f57a5b82d8c75666010081573df0d86ee03a.zip
cleanup respawn and script prediction management code
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut22
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut4
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 d22f26277..4168de30d 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 7e9943c3b..e8b636ffe 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()
}