diff --git a/Engine/Core/Console/command_registry.h b/Engine/Core/Console/command_registry.h index eb75aa01..8d13f131 100644 --- a/Engine/Core/Console/command_registry.h +++ b/Engine/Core/Console/command_registry.h @@ -188,6 +188,8 @@ template class Registry { const auto [entry, consumed] = resolve(words); return !entry || entry->echo_input || consumed != words.size(); } + // Whether the words start with one of its commands. + bool knows(std::span words) const { return resolve(words).first != nullptr; } bool local(std::span words, const Context &context) const { const auto [entry, consumed] = resolve(words); return !entry || entry->execution == Execution::local || diff --git a/Extension/UI/Overlay/overlay_console.cpp b/Extension/UI/Overlay/overlay_console.cpp index 7e29f579..52a2e7a0 100644 --- a/Extension/UI/Overlay/overlay_console.cpp +++ b/Extension/UI/Overlay/overlay_console.cpp @@ -220,7 +220,9 @@ void submit_console_command() { try { const auto& registry = dingosdk::console::game_commands(); if (registry.echoes(parsed.arguments)) output("> " + command); - if (!parsed || registry.local(parsed.arguments, s.model)) { + // A command ReSkate does not know may be a plugin's, which run on the game thread + // (Extension/Plugins); one no plugin has either is answered there as unknown. + if (!parsed || (registry.knows(parsed.arguments) && registry.local(parsed.arguments, s.model))) { registry.execute(command, s.model, output); return; } diff --git a/contrib/plugins/reskate-test/plugin/checks/console.lua b/contrib/plugins/reskate-test/plugin/checks/console.lua index 5384de08..0faae7a2 100644 --- a/contrib/plugins/reskate-test/plugin/checks/console.lua +++ b/contrib/plugins/reskate-test/plugin/checks/console.lua @@ -2,7 +2,7 @@ local h = require("harness") local t = h.module("console") -- Try it by hand: ptest echo a b c -reskate.console.command("ptest echo", "Prints its words back (reskate-test)", function(args) +reskate.console.command("ptest echo", "Prints its words back", function(args) reskate.console.print("ptest echo: " .. table.concat(args, " ")) end)