mirror of https://github.com/OpenRCT2/OpenRCT2.git
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:
parent
b5101d085d
commit
67f5ce62b3
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue