From 2b5aa0e8cc0a292fd0b2895169416218aa5ebe4d Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sat, 31 Jul 2021 09:45:38 +0100 Subject: [PATCH] add some logs, set players to dead outside of event --- QSB/DeathSync/Events/PlayerDeathEvent.cs | 2 ++ QSB/DeathSync/Patches/DeathPatches.cs | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/QSB/DeathSync/Events/PlayerDeathEvent.cs b/QSB/DeathSync/Events/PlayerDeathEvent.cs index 452f4c91..bb73ae87 100644 --- a/QSB/DeathSync/Events/PlayerDeathEvent.cs +++ b/QSB/DeathSync/Events/PlayerDeathEvent.cs @@ -22,12 +22,14 @@ namespace QSB.DeathSync.Events public override void OnReceiveLocal(bool server, PlayerDeathMessage message) { + DebugLog.DebugWrite($"RECEIVE LOCAL PLAYER DEATH"); var player = QSBPlayerManager.GetPlayer(message.AboutId); RespawnManager.Instance.OnPlayerDeath(player); } public override void OnReceiveRemote(bool server, PlayerDeathMessage message) { + DebugLog.DebugWrite($"RECEIVE REMOTE PLAYER DEATH"); var player = QSBPlayerManager.GetPlayer(message.AboutId); var playerName = player.Name; var deathMessage = Necronomicon.GetPhrase(message.EnumValue, message.NecronomiconIndex); diff --git a/QSB/DeathSync/Patches/DeathPatches.cs b/QSB/DeathSync/Patches/DeathPatches.cs index e9e870a9..2415c50c 100644 --- a/QSB/DeathSync/Patches/DeathPatches.cs +++ b/QSB/DeathSync/Patches/DeathPatches.cs @@ -1,8 +1,10 @@ using Harmony; using QSB.Events; using QSB.Patches; +using QSB.Player; using QSB.ShipSync; using QSB.Utility; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection.Emit; @@ -186,6 +188,7 @@ namespace QSB.DeathSync.Patches public static bool DeathManager_KillPlayer_Prefix(DeathType deathType) { + DebugLog.DebugWrite($"KILL PLAYER PREFIX stacetrace : \r\n {Environment.StackTrace}"); if (RespawnOnDeath.Instance == null) { return true; @@ -196,12 +199,17 @@ namespace QSB.DeathSync.Patches return true; } + QSBPlayerManager.LocalPlayer.IsDead = true; + RespawnOnDeath.Instance.ResetPlayer(); return false; } public static void DeathManager_KillPlayer_Postfix(DeathType deathType) - => QSBEventManager.FireEvent(EventNames.QSBPlayerDeath, deathType); + { + DebugLog.DebugWrite($"KILL PLAYER POSTFIX"); + QSBEventManager.FireEvent(EventNames.QSBPlayerDeath, deathType); + } public static void ShipDamageController_Awake(ref bool ____exploded) => ____exploded = true;