30 lines
759 B
C#
Raw Normal View History

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