2022-01-27 05:00:12 +00:00
|
|
|
|
using QSB.ClientServerStateSync;
|
2021-12-23 06:09:00 +00:00
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using QSB.Player;
|
|
|
|
|
|
2022-02-27 12:40:44 +00:00
|
|
|
|
namespace QSB.RespawnSync.Messages
|
2021-12-23 06:09:00 +00:00
|
|
|
|
{
|
2022-02-27 12:40:44 +00:00
|
|
|
|
internal class PlayerRespawnMessage : QSBMessage<uint>
|
|
|
|
|
{
|
2022-03-03 03:34:18 +00:00
|
|
|
|
public PlayerRespawnMessage(uint playerId) => Data = playerId;
|
2021-12-23 06:09:00 +00:00
|
|
|
|
|
2022-02-27 12:40:44 +00:00
|
|
|
|
public override void OnReceiveLocal() => OnReceiveRemote();
|
2021-12-23 06:09:00 +00:00
|
|
|
|
|
2022-02-27 12:40:44 +00:00
|
|
|
|
public override void OnReceiveRemote()
|
2021-12-23 06:09:00 +00:00
|
|
|
|
{
|
2022-03-03 03:34:18 +00:00
|
|
|
|
if (Data == QSBPlayerManager.LocalPlayerId)
|
2022-02-27 12:40:44 +00:00
|
|
|
|
{
|
|
|
|
|
RespawnManager.Instance.Respawn();
|
|
|
|
|
ClientStateManager.Instance.OnRespawn();
|
|
|
|
|
}
|
2022-02-25 06:04:54 +00:00
|
|
|
|
|
2022-03-03 03:34:18 +00:00
|
|
|
|
RespawnManager.Instance.OnPlayerRespawn(QSBPlayerManager.GetPlayer(Data));
|
2022-02-27 12:40:44 +00:00
|
|
|
|
}
|
2021-12-23 06:09:00 +00:00
|
|
|
|
}
|
|
|
|
|
}
|