Skip to content

Commit

Permalink
Fix RaisePredictiveEvent prediction checks (#5294)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
PJB3005 authored Jul 13, 2024
1 parent be11cb4 commit b8924a0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Robust.Client/GameObjects/ClientEntityManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ public override void RaisePredictiveEvent<T>(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);
Expand Down

0 comments on commit b8924a0

Please sign in to comment.