forked from rosebudai/OpenRCT2-Web
Add missing "guestsEntertained" to Entertainer interface in plugin API (#27153)
This commit is contained in:
1 parent
cc89ca136a
commit
5fe7c12c6f
8 files changed
+59
-1
No files matched your search
@@ -131,6 +131,7 @@ Appreciation for contributors who have provided substantial work, but are no lon
|
||||
* Marino Rottier (rinode) - Plugin API & UI
|
||||
* Ben Spurlock (BenDaSpur) - Plugin API automation helpers
|
||||
* (frozensnowy) - Draggable path slopes, self-intersecting track designs, refactors, bug fixes, misc.
|
||||
* Arjan van Dijk (Manticore-007) - Added guests entertained to API.
|
||||
|
||||
## Bug fixes & Refactors
|
||||
* Claudio Tiecher (janclod)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
0.5.6 (in development)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: [#27153] [Plugin] Add `guestsEntertained` to `Entertainer` interface.
|
||||
- Improved: [#21400] The selector for setting staff patrol areas is now drawn on the water as well as on the surface under water.
|
||||
- Improved: [#26947] Rain is now drawn next to the bottom info panels (in RCT2 style).
|
||||
- Change: [#27100] Negative G-forces no longer turn red in the stats window and graph when below -2.50.
|
||||
|
||||
Vendored
+5
@@ -3990,6 +3990,11 @@ declare global {
|
||||
|
||||
interface Entertainer extends BaseStaff {
|
||||
staffType: "entertainer";
|
||||
|
||||
/**
|
||||
* The number of guests entertained by the entertainer.
|
||||
*/
|
||||
readonly guestsEntertained: number;
|
||||
}
|
||||
|
||||
interface PatrolArea {
|
||||
|
||||
@@ -599,6 +599,7 @@ void ScriptEngine::RegisterClasses(JSContext* ctx)
|
||||
gScHandyman.Register(ctx);
|
||||
gScMechanic.Register(ctx);
|
||||
gScSecurity.Register(ctx);
|
||||
gScEntertainer.Register(ctx);
|
||||
gScBalloon.Register(ctx);
|
||||
gScLitter.Register(ctx);
|
||||
gScMoneyEffect.Register(ctx);
|
||||
@@ -660,6 +661,7 @@ void ScriptEngine::UnregisterClasses()
|
||||
gScHandyman.Unregister();
|
||||
gScMechanic.Unregister();
|
||||
gScSecurity.Unregister();
|
||||
gScEntertainer.Unregister();
|
||||
gScBalloon.Unregister();
|
||||
gScLitter.Unregister();
|
||||
gScMoneyEffect.Unregister();
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRCT2
|
||||
namespace OpenRCT2::Scripting
|
||||
{
|
||||
// Grepped from CI (.github/workflows/publish-plugin-types.yml); keep the format `kPluginApiVersion = N`.
|
||||
static constexpr int32_t kPluginApiVersion = 122;
|
||||
static constexpr int32_t kPluginApiVersion = 123;
|
||||
|
||||
// Versions marking breaking changes.
|
||||
static constexpr int32_t kApiVersionPeepDeprecation = 33;
|
||||
|
||||
@@ -574,6 +574,34 @@ namespace OpenRCT2::Scripting
|
||||
}
|
||||
}
|
||||
|
||||
ScEntertainer gScEntertainer;
|
||||
|
||||
JSValue ScEntertainer::New(JSContext* ctx, EntityId entityId)
|
||||
{
|
||||
return gScEntity.NewDerivedInstance(ctx, entityId, gScEntertainer.GetProto());
|
||||
}
|
||||
|
||||
void ScEntertainer::Register(JSContext* ctx)
|
||||
{
|
||||
static constexpr JSCFunctionListEntry kFuncs[] = {
|
||||
JS_CGETSET_DEF("guestsEntertained", &ScEntertainer::guestsEntertained_get, nullptr),
|
||||
};
|
||||
gScEntertainer.RegisterDerived(ctx, gScStaff, kFuncs);
|
||||
}
|
||||
|
||||
JSValue ScEntertainer::guestsEntertained_get(JSContext* ctx, JSValue thisVal)
|
||||
{
|
||||
auto peep = GetStaff(thisVal);
|
||||
if (peep != nullptr && peep->isEntertainer())
|
||||
{
|
||||
return JS_NewUint32(ctx, peep->staffGuestsEntertained);
|
||||
}
|
||||
else
|
||||
{
|
||||
return JS_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
using OpaquePatrolAreaData = struct
|
||||
{
|
||||
EntityId staffId;
|
||||
|
||||
@@ -129,6 +129,19 @@ namespace OpenRCT2::Scripting
|
||||
class ScSecurity;
|
||||
extern ScSecurity gScSecurity;
|
||||
|
||||
class ScEntertainer final : public ScStaff
|
||||
{
|
||||
public:
|
||||
static JSValue New(JSContext* ctx, EntityId entityId);
|
||||
void Register(JSContext* ctx);
|
||||
|
||||
private:
|
||||
static JSValue guestsEntertained_get(JSContext* ctx, JSValue thisVal);
|
||||
};
|
||||
|
||||
class ScEntertainer;
|
||||
extern ScEntertainer gScEntertainer;
|
||||
|
||||
} // namespace OpenRCT2::Scripting
|
||||
|
||||
#endif
|
||||
@@ -200,6 +200,9 @@ namespace OpenRCT2::Scripting
|
||||
case StaffType::security:
|
||||
JS_SetPropertyInt64(ctx, result, idx++, ScSecurity::New(ctx, sprite->id));
|
||||
break;
|
||||
case StaffType::entertainer:
|
||||
JS_SetPropertyInt64(ctx, result, idx++, ScEntertainer::New(ctx, sprite->id));
|
||||
break;
|
||||
default:
|
||||
JS_SetPropertyInt64(ctx, result, idx++, ScStaff::New(ctx, sprite->id));
|
||||
break;
|
||||
@@ -300,6 +303,9 @@ namespace OpenRCT2::Scripting
|
||||
case StaffType::security:
|
||||
JS_SetPropertyInt64(ctx, result, idx++, ScSecurity::New(ctx, sprite->id));
|
||||
break;
|
||||
case StaffType::entertainer:
|
||||
JS_SetPropertyInt64(ctx, result, idx++, ScEntertainer::New(ctx, sprite->id));
|
||||
break;
|
||||
default:
|
||||
JS_SetPropertyInt64(ctx, result, idx++, ScStaff::New(ctx, sprite->id));
|
||||
break;
|
||||
@@ -542,6 +548,8 @@ namespace OpenRCT2::Scripting
|
||||
return ScMechanic::New(ctx, spriteId);
|
||||
case StaffType::security:
|
||||
return ScSecurity::New(ctx, spriteId);
|
||||
case StaffType::entertainer:
|
||||
return ScEntertainer::New(ctx, spriteId);
|
||||
default:
|
||||
return ScStaff::New(ctx, spriteId);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user