From edbee201ee2debbe56e27636760a9d650b8ff685 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Sun, 20 Aug 2023 23:51:43 +1000 Subject: Command to adjust global timescale --- source/frontend/StarClientCommandProcessor.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'source/frontend/StarClientCommandProcessor.cpp') diff --git a/source/frontend/StarClientCommandProcessor.cpp b/source/frontend/StarClientCommandProcessor.cpp index c7a510f..00ec2e5 100644 --- a/source/frontend/StarClientCommandProcessor.cpp +++ b/source/frontend/StarClientCommandProcessor.cpp @@ -51,7 +51,8 @@ ClientCommandProcessor::ClientCommandProcessor(UniverseClientPtr universeClient, {"maketechavailable", bind(&ClientCommandProcessor::makeTechAvailable, this, _1)}, {"enabletech", bind(&ClientCommandProcessor::enableTech, this, _1)}, {"upgradeship", bind(&ClientCommandProcessor::upgradeShip, this, _1)}, - {"swap", bind(&ClientCommandProcessor::swap, this, _1)} + {"swap", bind(&ClientCommandProcessor::swap, this, _1)}, + {"timescale", bind(&ClientCommandProcessor::timeScale, this, _1)} }; } @@ -421,4 +422,14 @@ String ClientCommandProcessor::swap(String const& argumentsString) { return "Failed to swap player"; } +String ClientCommandProcessor::timeScale(String const& argumentsString) { + auto arguments = m_parser.tokenizeToStringList(argumentsString); + + if (arguments.size() == 0) + return "Not enouch arguments to /timescale"; + + GlobalTimescale = clamp(lexicalCast(arguments[0]), 0.001f, 256.0f); + return strf("Set application timescale to {:6.6f}x", GlobalTimescale); +} + } -- cgit v1.2.3