1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-25 07:44:38 +01:00

[Plugin] Wrap callback arguments for custom game actions in event arguments object, fix issue with unloading multiplayer plugins (#19091)

* Wrap custom game action arguments in event args object

* Update Typescript declaration, documentation and changelog

* Pass custom game action by value and remove log messages
This commit is contained in:
Basssiiie
2023-01-15 21:52:23 +01:00
committed by GitHub
parent f2b4d9dcf6
commit b15a6e843a
7 changed files with 54 additions and 21 deletions

View File

@@ -11,6 +11,7 @@
#ifdef ENABLE_SCRIPTING
# include "../actions/CustomAction.h"
# include "../common.h"
# include "../core/FileWatcher.h"
# include "../management/Finance.h"
@@ -46,11 +47,12 @@ namespace OpenRCT2
namespace OpenRCT2::Scripting
{
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 68;
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 69;
// Versions marking breaking changes.
static constexpr int32_t API_VERSION_33_PEEP_DEPRECATION = 33;
static constexpr int32_t API_VERSION_63_G2_REORDER = 63;
static constexpr int32_t API_VERSION_68_CUSTOM_ACTION_ARGS = 68;
# ifndef DISABLE_NETWORK
class ScSocketBase;
@@ -236,8 +238,7 @@ namespace OpenRCT2::Scripting
void AddNetworkPlugin(std::string_view code);
void RemoveNetworkPlugins();
[[nodiscard]] GameActions::Result QueryOrExecuteCustomGameAction(
std::string_view id, std::string_view args, bool isExecute);
[[nodiscard]] GameActions::Result QueryOrExecuteCustomGameAction(const CustomAction& action, bool isExecute);
bool RegisterCustomAction(
const std::shared_ptr<Plugin>& plugin, std::string_view action, const DukValue& query, const DukValue& execute);
void RunGameActionHooks(const GameAction& action, GameActions::Result& result, bool isExecute);