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

This commit is contained in:
Ted John 2020-04-27 22:02:38 +01:00 committed by GitHub
parent 06bbf5ddda
commit 2c731273c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

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;
}
/**

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