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:
authored and GitHub committed 2020-11-26 16:37:07 -03:00
1 parent b5101d085d
commit 67f5ce62b3
2 files changed
+18 -1

No files matched your search

+10 -1
View File
@@ -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();
}