mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-26 19:46:42 +01:00
Console: the menu command is back, so a key or combo bound to the ReSkate menu opens it again
"bind reskatemenu" runs the menu command, which went with the drone's commands when the drone became a plugin, so every press said "Unknown command" and a player without an Insert key had no way into the menu. At startup the log now warns about a bind whose command is not registered.
This commit is contained in:
1 parent
8ae812a10c
commit
2ae6c59d3f
2 files changed
+25
No files matched your search
@@ -1,6 +1,8 @@
|
||||
#include "commands.h"
|
||||
#include "Engine/Core/Log/logging.h"
|
||||
#include "Engine/Core/Platform/path_text.h"
|
||||
#include "Engine/Game/Input/controller_bindings.h"
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
namespace dingosdk::console {
|
||||
@@ -231,6 +233,21 @@ const Commands &game_commands() {
|
||||
register_trainer_commands(*result);
|
||||
register_replay_keyframes_commands(*result);
|
||||
register_plugin_commands(*result);
|
||||
// Each switch a player binds runs a command (controller_bindings.h action_binds): one whose
|
||||
// command is gone reads "Unknown command" at every press, as "menu" once did.
|
||||
for (const auto &bind : action_binds) {
|
||||
bool found{};
|
||||
std::string name;
|
||||
for (std::size_t at = 0; !found && at <= bind.command.size();) {
|
||||
const auto end = std::min(bind.command.find(' ', at), bind.command.size());
|
||||
name = std::string(bind.command.substr(0, end));
|
||||
found = result->find(name) != nullptr;
|
||||
at = end + 1;
|
||||
}
|
||||
if (!found)
|
||||
logging::log(logging::Level::warning, logging::Channel::command, "The {} bind runs \"{}\", which is not a command.",
|
||||
bind.name, bind.command);
|
||||
}
|
||||
return result;
|
||||
}();
|
||||
return *registry;
|
||||
|
||||
@@ -295,6 +295,14 @@ void register_movement_commands(Commands ®istry) {
|
||||
};
|
||||
registry.add(std::move(entry));
|
||||
}
|
||||
// What "bind reskatemenu" runs, for a player who cannot press the menu's key (no Insert key).
|
||||
auto open_menu = action("menu", "Open the ReSkate menu (bind it to a controller combo or key: bind reskatemenu)", Group::console);
|
||||
open_menu.inspect = [](const Model &) { return State{true, {}, {}, {}, false}; };
|
||||
open_menu.run = [](const Model &, const Values &, const Output &out) {
|
||||
overlay::menu_open_flag().store(true);
|
||||
out("Opening the ReSkate menu.");
|
||||
};
|
||||
registry.add(std::move(open_menu));
|
||||
}
|
||||
void register_ai_commands(Commands ®istry) {
|
||||
const auto ready = [](const Model &m) {
|
||||
|
||||
Reference in new issue
Block a user