Add support for client-side replays (#17168)
This commit is contained in:
@@ -6,6 +6,8 @@ using Robust.Client.Player;
|
||||
using Robust.Client.Replays.Playback;
|
||||
using Robust.Client.State;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Serialization.Markdown.Mapping;
|
||||
|
||||
namespace Content.Client.Replay.Spectator;
|
||||
|
||||
@@ -29,7 +31,7 @@ public sealed partial class ReplaySpectatorSystem : EntitySystem
|
||||
[Dependency] private readonly SharedContentEyeSystem _eye = default!;
|
||||
[Dependency] private readonly IReplayPlaybackManager _replayPlayback = default!;
|
||||
|
||||
private SpectatorPosition? _oldPosition;
|
||||
private SpectatorData? _spectatorData;
|
||||
public const string SpectateCmd = "replay_spectate";
|
||||
|
||||
public override void Initialize()
|
||||
@@ -58,15 +60,19 @@ public sealed partial class ReplaySpectatorSystem : EntitySystem
|
||||
_replayPlayback.ReplayPlaybackStopped -= OnPlaybackStopped;
|
||||
}
|
||||
|
||||
private void OnPlaybackStarted()
|
||||
private void OnPlaybackStarted(MappingDataNode yamlMappingNode, List<object> objects)
|
||||
{
|
||||
InitializeMovement();
|
||||
SetSpectatorPosition(default);
|
||||
_conHost.RegisterCommand(SpectateCmd,
|
||||
Loc.GetString("cmd-replay-spectate-desc"),
|
||||
Loc.GetString("cmd-replay-spectate-help"),
|
||||
SpectateCommand,
|
||||
SpectateCompletions);
|
||||
|
||||
if (_replayPlayback.TryGetRecorderEntity(out var recorder))
|
||||
SpectateEntity(recorder.Value);
|
||||
else
|
||||
SetSpectatorPosition(default);
|
||||
}
|
||||
|
||||
private void OnPlaybackStopped()
|
||||
|
||||
Reference in New Issue
Block a user