2022-01-26 21:00:12 -08:00
|
|
|
|
using QSB.ClientServerStateSync;
|
2021-12-22 22:09:00 -08:00
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using QSB.Player;
|
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
namespace QSB.RespawnSync.Messages;
|
|
|
|
|
|
|
|
|
|
internal class PlayerRespawnMessage : QSBMessage<uint>
|
2021-12-22 22:09:00 -08:00
|
|
|
|
{
|
2022-03-10 17:57:50 -08:00
|
|
|
|
public PlayerRespawnMessage(uint playerId) : base(playerId) { }
|
2021-12-22 22:09:00 -08:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
public override void OnReceiveLocal() => OnReceiveRemote();
|
2021-12-22 22:09:00 -08:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
public override void OnReceiveRemote()
|
|
|
|
|
{
|
|
|
|
|
if (Data == QSBPlayerManager.LocalPlayerId)
|
2021-12-22 22:09:00 -08:00
|
|
|
|
{
|
2022-03-02 19:46:33 -08:00
|
|
|
|
RespawnManager.Instance.Respawn();
|
|
|
|
|
ClientStateManager.Instance.OnRespawn();
|
2022-02-27 04:40:44 -08:00
|
|
|
|
}
|
2022-03-02 19:46:33 -08:00
|
|
|
|
|
|
|
|
|
RespawnManager.Instance.OnPlayerRespawn(QSBPlayerManager.GetPlayer(Data));
|
2021-12-22 22:09:00 -08:00
|
|
|
|
}
|
|
|
|
|
}
|