Fix RegisteredCommand() & replay bugs (#3774)

This commit is contained in:
Leon Friedrich
2023-02-13 15:45:37 +13:00
committed by GitHub
parent b587052396
commit 9aea0ed78c
3 changed files with 12 additions and 4 deletions

View File

@@ -92,7 +92,7 @@ namespace Robust.Client.Console
UpdateAvailableCommands();
}
private void UpdateAvailableCommands()
protected override void UpdateAvailableCommands()
{
_availableCommands.Clear();

View File

@@ -125,8 +125,8 @@ internal sealed class ReplayRecordingManager : IInternalReplayRecordingManager
_curStream = new(_tickBatchSize * 2);
_index = 0;
_firstTick = true;
WriteInitialMetadata();
_recordingStart = (_timing.CurTick, _timing.CurTime);
WriteInitialMetadata();
if (duration != null)
_recordingEnd = _timing.CurTime + duration.Value;
@@ -250,10 +250,10 @@ internal sealed class ReplayRecordingManager : IInternalReplayRecordingManager
// Time data
var timeBase = _timing.TimeBase;
_yamlMetadata["startTick"] = new ValueDataNode(_timing.CurTick.Value.ToString());
_yamlMetadata["startTick"] = new ValueDataNode(_recordingStart.Tick.Value.ToString());
_yamlMetadata["timeBaseTick"] = new ValueDataNode(timeBase.Item2.Value.ToString());
_yamlMetadata["timeBaseTimespan"] = new ValueDataNode(timeBase.Item1.Ticks.ToString());
_yamlMetadata["recordingStartTime"] = new ValueDataNode(_recordingStart.ToString());
_yamlMetadata["recordingStartTime"] = new ValueDataNode(_recordingStart.Time.ToString());
OnRecordingStarted?.Invoke((_yamlMetadata, extraData));

View File

@@ -68,6 +68,10 @@ namespace Robust.Shared.Console
}
}
protected virtual void UpdateAvailableCommands()
{
}
#region RegisterCommand
public void RegisterCommand(
string command,
@@ -81,6 +85,7 @@ namespace Robust.Shared.Console
var newCmd = new RegisteredCommand(command, description, help, callback, requireServerOrSingleplayer);
RegisteredCommands.Add(command, newCmd);
UpdateAvailableCommands();
}
public void RegisterCommand(
@@ -96,6 +101,7 @@ namespace Robust.Shared.Console
var newCmd = new RegisteredCommand(command, description, help, callback, completionCallback, requireServerOrSingleplayer);
RegisteredCommands.Add(command, newCmd);
UpdateAvailableCommands();
}
public void RegisterCommand(
@@ -111,6 +117,7 @@ namespace Robust.Shared.Console
var newCmd = new RegisteredCommand(command, description, help, callback, completionCallback, requireServerOrSingleplayer);
RegisteredCommands.Add(command, newCmd);
UpdateAvailableCommands();
}
public void RegisterCommand(string command, ConCommandCallback callback,
@@ -155,6 +162,7 @@ namespace Robust.Shared.Console
"You cannot unregister commands that have been registered automatically.");
RegisteredCommands.Remove(command);
UpdateAvailableCommands();
}
//TODO: Pull up