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

summaryrefslogtreecommitdiff
path: root/source/frontend/StarClientCommandProcessor.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-09-12 19:13:57 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-09-12 19:13:57 +1000
commit4da398e42dbc9b18ec27ba27d0fa570adfc58922 (patch)
tree26b758398ed032eb951152b47ddcfc44206a7e9c /source/frontend/StarClientCommandProcessor.cpp
parent3c4a2eb71eea73c7e505ab631a1abc484f9e7b92 (diff)
parent7852ad9cf2efdf359132c986f46b0e34acbd28ba (diff)
Merge branch 'main' into wip/net-n-btree
Diffstat (limited to 'source/frontend/StarClientCommandProcessor.cpp')
-rw-r--r--source/frontend/StarClientCommandProcessor.cpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/source/frontend/StarClientCommandProcessor.cpp b/source/frontend/StarClientCommandProcessor.cpp
index 2d98289..ac87397 100644
--- a/source/frontend/StarClientCommandProcessor.cpp
+++ b/source/frontend/StarClientCommandProcessor.cpp
@@ -15,9 +15,9 @@
namespace Star {
ClientCommandProcessor::ClientCommandProcessor(UniverseClientPtr universeClient, CinematicPtr cinematicOverlay,
- MainInterfacePaneManager* paneManager, StringMap<StringList> macroCommands)
+ MainInterfacePaneManager* paneManager, StringMap<StringList> macroCommands)
: m_universeClient(std::move(universeClient)), m_cinematicOverlay(std::move(cinematicOverlay)),
- m_paneManager(paneManager), m_macroCommands(std::move(macroCommands)) {
+ m_paneManager(paneManager), m_macroCommands(std::move(macroCommands)) {
m_builtinCommands = {
{"reload", bind(&ClientCommandProcessor::reload, this)},
{"whoami", bind(&ClientCommandProcessor::whoami, this)},
@@ -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)},
+ {"respawnInWorld", bind(&ClientCommandProcessor::respawnInWorld, this, _1)}
};
}
@@ -128,7 +129,7 @@ String ClientCommandProcessor::reload() {
String ClientCommandProcessor::whoami() {
return strf("Client: You are {}. You are {}an Admin.",
- m_universeClient->mainPlayer()->name(), m_universeClient->mainPlayer()->isAdmin() ? "" : "not ");
+ m_universeClient->mainPlayer()->name(), m_universeClient->mainPlayer()->isAdmin() ? "" : "not ");
}
String ClientCommandProcessor::gravity() {
@@ -186,7 +187,7 @@ String ClientCommandProcessor::setGravity(String const& argumentsString) {
return "You must be an admin to use this command.";
m_universeClient->worldClient()->overrideGravity(lexicalCast<float>(arguments.at(0)));
- return strf("Gravity set to {}, the change is LOCAL ONLY", arguments.at(0));
+ return strf("Gravity set to {} (This is client-side!)", arguments.at(0));
}
String ClientCommandProcessor::resetGravity() {
@@ -273,8 +274,8 @@ String ClientCommandProcessor::previewNewQuest(String const& argumentsString) {
return "You must be an admin to use this command.";
return previewQuestPane(arguments, [this](QuestPtr const& quest) {
- return make_shared<NewQuestInterface>(m_universeClient->questManager(), quest, m_universeClient->mainPlayer());
- });
+ return make_shared<NewQuestInterface>(m_universeClient->questManager(), quest, m_universeClient->mainPlayer());
+ });
}
String ClientCommandProcessor::previewQuestComplete(String const& argumentsString) {
@@ -283,8 +284,8 @@ String ClientCommandProcessor::previewQuestComplete(String const& argumentsStrin
return "You must be an admin to use this command.";
return previewQuestPane(arguments, [this](QuestPtr const& quest) {
- return make_shared<QuestCompleteInterface>(quest, m_universeClient->mainPlayer(), CinematicPtr{});
- });
+ return make_shared<QuestCompleteInterface>(quest, m_universeClient->mainPlayer(), CinematicPtr{});
+ });
}
String ClientCommandProcessor::previewQuestFailed(String const& argumentsString) {
@@ -293,8 +294,8 @@ String ClientCommandProcessor::previewQuestFailed(String const& argumentsString)
return "You must be an admin to use this command.";
return previewQuestPane(arguments, [this](QuestPtr const& quest) {
- return make_shared<QuestFailedInterface>(quest, m_universeClient->mainPlayer());
- });
+ return make_shared<QuestFailedInterface>(quest, m_universeClient->mainPlayer());
+ });
}
String ClientCommandProcessor::clearScannedObjects() {
@@ -427,4 +428,16 @@ String ClientCommandProcessor::swap(String const& argumentsString) {
return "Failed to swap player";
}
+String ClientCommandProcessor::respawnInWorld(String const& argumentsString) {
+ auto arguments = m_parser.tokenizeToStringList(argumentsString);
+ auto worldClient = m_universeClient->worldClient();
+
+ if (arguments.size() == 0)
+ return strf("Respawn in this world is currently {}", worldClient->respawnInWorld() ? "true" : "false");
+
+ bool respawnInWorld = Json::parse(arguments.at(0)).toBool();
+ worldClient->setRespawnInWorld(respawnInWorld);
+ return strf("Respawn in this world set to {} (This is client-side!)", respawnInWorld ? "true" : "false");
}
+
+} \ No newline at end of file