Add game.time_scale cvar

Primary use case (other than silly) is to be a better way to speed up/slow down replays.
This commit is contained in:
PJB3005
2025-12-20 16:32:06 +01:00
parent 2e5856b54d
commit 9b02a4e718
8 changed files with 74 additions and 5 deletions
+13
View File
@@ -594,6 +594,19 @@ namespace Robust.Server
_logger.Info($"Tickrate changed to: {b} on tick {_time.CurTick}");
});
_config.OnValueChanged(CVars.GameTimeScale, f =>
{
if (!GameTiming.IsTimescaleValid(f))
{
_logger.Error($"Invalid time scale set: {f}, ignoring");
return;
}
_time.TimeScale = f;
_logger.Info($"Timescale changed to: {f} on tick {_time.CurTick}");
}, true);
var startOffset = TimeSpan.FromSeconds(_config.GetCVar(CVars.NetTimeStartOffset));
_time.TimeBase = (startOffset, GameTick.First);
_time.TickRate = (ushort) _config.GetCVar(CVars.NetTickrate);