From b8924a04cfede55c5a2761ddcca2cc40aaf01899 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 13 Jul 2024 07:30:20 +0200 Subject: [PATCH] Fix RaisePredictiveEvent prediction checks (#5294) RaisePredictiveEvent was made to not check whether prediction is enabled in #3534. This doesn't make much sense to me and is causing various SS14 game logic to erroneously run when prediction is disabled. Here's the fix PR. Also fixes the assert to actually work (checking Connected is wrong, it should've been InGame) and makes the new check also account for SinglePlayerGame. --- Robust.Client/GameObjects/ClientEntityManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Robust.Client/GameObjects/ClientEntityManager.cs b/Robust.Client/GameObjects/ClientEntityManager.cs index 0b517a421a0..37268ee2f9f 100644 --- a/Robust.Client/GameObjects/ClientEntityManager.cs +++ b/Robust.Client/GameObjects/ClientEntityManager.cs @@ -118,7 +118,10 @@ public override void RaisePredictiveEvent(T msg) var sequence = _stateMan.SystemMessageDispatched(msg); EntityNetManager?.SendSystemNetworkMessage(msg, sequence); - DebugTools.Assert(!_stateMan.IsPredictionEnabled || _gameTiming.InPrediction && _gameTiming.IsFirstTimePredicted || _client.RunLevel != ClientRunLevel.Connected); + if (!_stateMan.IsPredictionEnabled && _client.RunLevel != ClientRunLevel.SinglePlayerGame) + return; + + DebugTools.Assert(_gameTiming.InPrediction && _gameTiming.IsFirstTimePredicted || _client.RunLevel == ClientRunLevel.SinglePlayerGame); var eventArgs = new EntitySessionEventArgs(session!); EventBus.RaiseEvent(EventSource.Local, msg);