mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-06 06:32:56 +01:00
Plugins - return result from StaffHireAction (#13459)
* Added some scripting glue to StaffHireNewAction * Update src/openrct2/scripting/ScriptEngine.cpp Co-authored-by: Ted John <ted@brambles.org> * Update plugin api version Co-authored-by: Ted John <ted@brambles.org> Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
This commit is contained in:
@@ -68,6 +68,14 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void AcceptParameters(GameActionParameterVisitor & visitor) override
|
||||
{
|
||||
visitor.Visit("autoPosition", _autoPosition);
|
||||
visitor.Visit("staffType", _staffType);
|
||||
visitor.Visit("entertainerType", _entertainerType);
|
||||
visitor.Visit("staffOrders", _staffOrders);
|
||||
}
|
||||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
# include "../actions/CustomAction.hpp"
|
||||
# include "../actions/GameAction.h"
|
||||
# include "../actions/RideCreateAction.hpp"
|
||||
# include "../actions/StaffHireNewAction.hpp"
|
||||
# include "../config/Config.h"
|
||||
# include "../core/File.h"
|
||||
# include "../core/FileScanner.h"
|
||||
@@ -43,7 +44,7 @@
|
||||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::Scripting;
|
||||
|
||||
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 13;
|
||||
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 14;
|
||||
|
||||
struct ExpressionStringifier final
|
||||
{
|
||||
@@ -857,6 +858,14 @@ DukValue ScriptEngine::GameActionResultToDuk(const GameAction& action, const std
|
||||
obj.Set("ride", rideCreateResult.rideIndex);
|
||||
}
|
||||
}
|
||||
else if (action.GetType() == GAME_COMMAND_HIRE_NEW_STAFF_MEMBER)
|
||||
{
|
||||
auto& staffHireResult = static_cast<StaffHireNewActionResult&>(*result.get());
|
||||
if (staffHireResult.peepSriteIndex != SPRITE_INDEX_NULL)
|
||||
{
|
||||
obj.Set("peep", staffHireResult.peepSriteIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return obj.Take();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user