add check for not ready player

This commit is contained in:
Mister_Nebula 2021-11-20 22:28:08 +00:00
parent 13069d6088
commit 125a0527dc

View File

@ -1,6 +1,8 @@
using OWML.Common;
using QSB.ClientServerStateSync;
using QSB.Messaging;
using QSB.Player;
using QSB.Player.Events;
using QSB.Player.TransformSync;
using QSB.Utility;
using QuantumUNET.Components;
@ -79,6 +81,20 @@ namespace QSB.Events
return;
}
if (QSBPlayerManager.PlayerExists(message.FromId))
{
var player = QSBPlayerManager.GetPlayer(message.FromId);
if (!player.IsReady
&& player.PlayerId != LocalPlayerId
&& (player.State is ClientState.AliveInSolarSystem or ClientState.AliveInEye or ClientState.DeadInSolarSystem)
&& (message is not PlayerInformationEvent or PlayerReadyEvent))
{
DebugLog.ToConsole($"Warning - Got message from player {message.FromId}, but they were not ready. Asking for state resync, just in case.", MessageType.Warning);
QSBEventManager.FireEvent(EventNames.QSBRequestStateResync);
}
}
try
{
if (message.FromId == QSBPlayerManager.LocalPlayerId ||