Add support for client-side replays (#4122)

This commit is contained in:
Leon Friedrich
2023-06-19 05:23:46 +12:00
committed by GitHub
parent 35902ad839
commit 9d4105abc7
55 changed files with 1552 additions and 783 deletions

View File

@@ -10,6 +10,7 @@ using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Network;
using Robust.Shared.Network.Messages;
using Robust.Shared.Replays;
using Robust.Shared.Utility;
namespace Robust.Client.GameObjects
@@ -24,6 +25,7 @@ namespace Robust.Client.GameObjects
[Dependency] private readonly IClientGameTiming _gameTiming = default!;
[Dependency] private readonly IClientGameStateManager _stateMan = default!;
[Dependency] private readonly IBaseClient _client = default!;
[Dependency] private readonly IReplayRecordingManager _replayRecording = default!;
protected override int NextEntityUid { get; set; } = EntityUid.ClientUid + 1;
@@ -184,6 +186,12 @@ namespace Robust.Client.GameObjects
switch (message.Type)
{
case EntityMessageType.SystemMessage:
// TODO REPLAYS handle late messages.
// If a message was received late, it will be recorded late here.
// Maybe process the replay to prevent late messages when playing back?
_replayRecording.RecordReplayMessage(message.SystemMessage);
DispatchReceivedNetworkMsg(message.SystemMessage);
return;
}