PlayerTransformSync.LocalInstance should not be null when we SendEvent. if it is, i would like it to give an error, rather than simply wait

This commit is contained in:
JohnCorby 2021-12-11 18:49:18 -08:00
parent 1ccd277c5c
commit b538eb3200

View File

@ -35,26 +35,24 @@ namespace QSB.Events
public abstract bool RequireWorldObjectsReady { get; }
public void SendEvent(T message) => QSBCore.UnityEvents.RunWhen(
() => PlayerTransformSync.LocalInstance != null,
() =>
public void SendEvent(T message)
{
message.FromId = LocalPlayerId;
if (QSBEventManager.ForIdOverride != uint.MaxValue)
{
message.FromId = LocalPlayerId;
if (QSBEventManager.ForIdOverride != uint.MaxValue)
{
message.ForId = QSBEventManager.ForIdOverride;
}
if (message.OnlySendToHost)
{
message.ForId = 0;
}
new QSBEventRelay
{
To = message.ForId,
Event = this,
Message = message
}.Send();
});
message.ForId = QSBEventManager.ForIdOverride;
}
if (message.OnlySendToHost)
{
message.ForId = 0;
}
new QSBEventRelay
{
To = message.ForId,
Event = this,
Message = message
}.Send();
}
/// <summary>
/// Checks whether the message should be processed by the executing client.