quantum-space-buddies/QSB/Player/Messages/PlayerHeartbeatMessage.cs

21 lines
388 B
C#
Raw Normal View History

2022-08-24 21:07:22 +00:00
using QSB.Messaging;
2022-08-24 08:32:31 +00:00
namespace QSB.Player.Messages;
internal class PlayerHeartbeatMessage : QSBMessage
{
2022-08-24 21:07:22 +00:00
public override void OnReceiveRemote()
2022-08-24 08:32:31 +00:00
{
2022-08-24 21:07:22 +00:00
if (!QSBCore.IsHost)
2022-08-24 08:32:31 +00:00
{
2022-08-24 21:07:22 +00:00
// send a response back to the host
new PlayerHeartbeatMessage { To = 0 }.Send();
2022-08-24 08:32:31 +00:00
}
2022-08-24 21:07:22 +00:00
else
2022-08-24 08:32:31 +00:00
{
2022-08-24 21:07:22 +00:00
// note that we got a response
2022-08-25 01:28:42 +00:00
QSBPlayerManager.GetPlayer(From).HeartbeatReceived = true;
2022-08-24 08:32:31 +00:00
}
}
}