Fix #11494: Old console commands don't work at headless console since plugin system (#11508)

This commit is contained in:
Ted John authored and GitHub committed 2020-04-27 23:02:38 +02:00
1 parent 06bbf5ddda
commit 2c731273c1
2 files changed
+16

No files matched your search

+10
View File
@@ -91,6 +91,16 @@ declare global {
interface Console {
clear(): void;
log(message?: any, ...optionalParams: any[]): void;
/**
* Executes a command using the legacy console REPL. This should not be used
* by plugins, and exists only for servers to continue using old commands until
* all functionality can be accomplished with this scripting API.
*
* @deprecated
* @param command The command and arguments to execute.
*/
executeLegacy(command: string): void;
}
/**
+6
View File
@@ -51,10 +51,16 @@ namespace OpenRCT2::Scripting
return 0;
}
void executeLegacy(const std::string& command)
{
_console.Execute(command);
}
static void Register(duk_context* ctx)
{
dukglue_register_method(ctx, &ScConsole::clear, "clear");
dukglue_register_method_varargs(ctx, &ScConsole::log, "log");
dukglue_register_method(ctx, &ScConsole::executeLegacy, "executeLegacy");
}
};
} // namespace OpenRCT2::Scripting