Command to adjust global timescale

This commit is contained in:
Kae 2023-08-20 23:51:43 +10:00
parent 33b7f17bb2
commit edbee201ee
2 changed files with 13 additions and 1 deletions

View File

@ -51,7 +51,8 @@ ClientCommandProcessor::ClientCommandProcessor(UniverseClientPtr universeClient,
{"maketechavailable", bind(&ClientCommandProcessor::makeTechAvailable, this, _1)}, {"maketechavailable", bind(&ClientCommandProcessor::makeTechAvailable, this, _1)},
{"enabletech", bind(&ClientCommandProcessor::enableTech, this, _1)}, {"enabletech", bind(&ClientCommandProcessor::enableTech, this, _1)},
{"upgradeship", bind(&ClientCommandProcessor::upgradeShip, 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"; 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);
}
} }

View File

@ -59,6 +59,7 @@ private:
String enableTech(String const& argumentsString); String enableTech(String const& argumentsString);
String upgradeShip(String const& argumentsString); String upgradeShip(String const& argumentsString);
String swap(String const& argumentsString); String swap(String const& argumentsString);
String timeScale(String const& argumentsString);
UniverseClientPtr m_universeClient; UniverseClientPtr m_universeClient;
CinematicPtr m_cinematicOverlay; CinematicPtr m_cinematicOverlay;