quantum-space-buddies/QSB/DeathSync/Messages/EndLoopMessage.cs
2021-12-23 02:17:56 -08:00

30 lines
765 B
C#

using QSB.ClientServerStateSync;
using QSB.Messaging;
using QSB.Patches;
using QSB.Utility;
namespace QSB.DeathSync.Messages
{
// when all players die
internal class EndLoopMessage : QSBMessage
{
public override void OnReceiveLocal() => OnReceiveRemote();
public override void OnReceiveRemote()
{
DebugLog.DebugWrite($" ~~~~ END LOOP - all players are dead ~~~~ ");
if (ServerStateManager.Instance.GetServerState() == ServerState.WaitingForAllPlayersToDie)
{
return;
}
QSBPatchManager.DoUnpatchType(QSBPatchTypes.RespawnTime);
Locator.GetDeathManager().KillPlayer(DeathType.TimeLoop);
if (QSBCore.IsHost)
{
ServerStateManager.Instance.SendChangeServerStateMessage(ServerState.WaitingForAllPlayersToDie);
}
}
}
}