add some logs, set players to dead outside of event

This commit is contained in:
Mister_Nebula 2021-07-31 09:45:38 +01:00
parent b35effbe87
commit 2b5aa0e8cc
2 changed files with 11 additions and 1 deletions

View File

@ -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);

View File

@ -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;