Add command stubs

This commit is contained in:
2025-03-19 02:48:07 -04:00
parent 185016ed49
commit a599775eee
3 changed files with 42 additions and 52 deletions

View File

@@ -125,6 +125,8 @@ namespace CaveGame::ClientApp {
bool HelpCommand(const CommandArgs& args);
/// Shows a list of every command label.
bool ListCommand(const CommandArgs& args);
bool TileListCmd(const CommandArgs& args);
bool ItemListCmd(const CommandArgs& args);
/// Toggles tile simulation if we are
bool ToggleTileSim(const CommandArgs& args);
@@ -179,15 +181,15 @@ namespace CaveGame::ClientApp {
{"freecam", {"q"}, [this](const CommandArgs& args) {}},
{"noclip", {"q"}, [this](const CommandArgs& args) {}},
{"god", {"q"}, [this](const CommandArgs& args) {}},
{"fullbright", {"q"}, [this](const auto& args) {}},
{"connect", {"q"}, [this](const auto& args) {}},
{"disconnect", {"q"}, [this](const auto& args) {}},
{"server", {"q"}, [this](const auto& args) {}},
{"sandbox", {"q"}, [this](const auto& args) {}},
{"crash", {"q"}, [this](const auto& args) {}},
{"time", {"q"}, [this](const auto& args) {}},
{"juidebug", {"q"}, [this](const auto& args) {}},
{"fpslimit", {"fps"}, [this](const auto& args) {
{"fullbright", {"q"}, [this](const CommandArgs& args) {}},
{"connect", {"q"}, [this](const CommandArgs& args) {}},
{"disconnect", {"q"}, [this](const CommandArgs& args) {}},
{"server", {"q"}, [this](const CommandArgs& args) {}},
{"sandbox", {"q"}, [this](const CommandArgs& args) {}},
{"crash", {"q"}, [this](const CommandArgs& args) {}},
{"time", {"q"}, [this](const CommandArgs& args) {}},
{"juidebug", {"q"}, [this](const CommandArgs& args) {}},
{"fpslimit", {"fps"}, [this](const CommandArgs& args) {
if (args.size() < 2)
return Log(std::format("Current FPS Limit: {}fps", max_fps));
@@ -195,29 +197,34 @@ namespace CaveGame::ClientApp {
std::cout << val << std::endl;
max_fps = val;
}},
{"grid", {}, [this](const auto& args) {
{"grid", {}, [this](const CommandArgs& args) {
if (current_scene == game_ctx)
{
game_ctx->World()->chunk_debug.Enable(!game_ctx->World()->chunk_debug.IsEnabled());
} else
Log("Must be in-game to use this command!");
}},
{"tileactivity", {}, [this](const auto& args) {
{"tileactivity", {}, [this](const CommandArgs& args) {
if (current_scene == game_ctx)
{
game_ctx->World()->SetShowTileActivity(!game_ctx->World()->IsShowTileActivityEnabled());
} else
Log("Must be in-game to use this command!");
}},
{"save-world", {}, [this](const auto& args) {
{"save-world", {}, [this](const CommandArgs& args) {
if (InGame())
GameSession()->World()->Save();
}},
{"tile-list", {}, [this](const CommandArgs& args) { return TileListCmd(args); }},
{"item-list", {}, [this](const CommandArgs& args) { return ItemListCmd(args); }},
{"container", {}, [this](const CommandArgs& args) {
}}
};
Command InvalidCommand {
"n/a", {}, [this](const auto& args) {
"n/a", {}, [this](const CommandArgs& args) {
Log("Nope");
}
};

View File

@@ -567,6 +567,28 @@ namespace CaveGame::ClientApp
void CaveGameWindow::MarkReadyToClose(bool close) { wanna_die = close;}
bool CaveGameWindow::TileListCmd(const CommandArgs &args) {
auto tile_list = Core::GetAllTiles();
for (Core::Tile* tile : tile_list) {
if (tile != nullptr)
Log(std::format("ID: {}, Mnemonic: {}, DisplayName: {}", (int)tile->NumericID(), tile->MnemonicID(), tile->Name()));
}
return true;
}
bool CaveGameWindow::ItemListCmd(const CommandArgs &args) {
auto item_list = Core::GetAllItems();
for (auto [name, item] : item_list) {
if (item != nullptr)
Log(std::format("Mnemonic: {}", name));
}
return true;
}
}