mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-15 06:42:25 +02:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user