Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend/StarClientCommandProcessor.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-08-20 23:51:43 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-08-20 23:51:43 +1000
commitedbee201ee2debbe56e27636760a9d650b8ff685 (patch)
treed8514dd5e047db71f3cd0b36e9e3f6a3d0a2471a /source/frontend/StarClientCommandProcessor.cpp
parent33b7f17bb23b22f755aa9918939302b900aa4cd5 (diff)
Command to adjust global timescale
Diffstat (limited to 'source/frontend/StarClientCommandProcessor.cpp')
-rw-r--r--source/frontend/StarClientCommandProcessor.cpp13
1 files changed, 12 insertions, 1 deletions
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<float>(arguments[0]), 0.001f, 256.0f);
+ return strf("Set application timescale to {:6.6f}x", GlobalTimescale);
+}
+
}