quantum-space-buddies/QSB/DeathSync/Messages/EndLoopMessage.cs

30 lines
757 B
C#
Raw Normal View History

2021-12-23 06:26:53 +00:00
using QSB.ClientServerStateSync;
using QSB.ClientServerStateSync.Messages;
2021-12-23 06:26:53 +00:00
using QSB.Messaging;
using QSB.Patches;
using QSB.Utility;
2022-03-03 03:46:33 +00:00
namespace QSB.DeathSync.Messages;
// when all players die
2023-07-28 18:30:57 +00:00
public class EndLoopMessage : QSBMessage
2021-12-23 06:26:53 +00:00
{
2022-03-03 03:46:33 +00:00
public override void OnReceiveLocal() => OnReceiveRemote();
2022-03-03 03:46:33 +00:00
public override void OnReceiveRemote()
{
DebugLog.DebugWrite($" ~~~~ END LOOP - all players are dead ~~~~ ");
if (ServerStateManager.Instance.GetServerState() == ServerState.WaitingForAllPlayersToDie)
2021-12-23 06:26:53 +00:00
{
2022-03-03 03:46:33 +00:00
return;
}
2021-12-23 06:26:53 +00:00
2022-03-03 03:46:33 +00:00
QSBPatchManager.DoUnpatchType(QSBPatchTypes.RespawnTime);
2021-12-23 06:26:53 +00:00
2022-03-03 03:46:33 +00:00
Locator.GetDeathManager().KillPlayer(DeathType.TimeLoop);
if (QSBCore.IsHost)
{
new ServerStateMessage(ServerState.WaitingForAllPlayersToDie).Send();
2021-12-23 06:26:53 +00:00
}
}
}