mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-25 07:44:38 +01:00
Expose ride satisfaction to plugin api (#22172)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
0.4.13 (in development)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: [#22172] [Plugin] Expose ride satisfaction ratings to the plugin API.
|
||||
|
||||
0.4.12 (2024-07-07)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
5
distribution/openrct2.d.ts
vendored
5
distribution/openrct2.d.ts
vendored
@@ -2115,6 +2115,11 @@ declare global {
|
||||
* The min chain lift speed for this ride in miles per hour.
|
||||
*/
|
||||
readonly minLiftHillSpeed: number;
|
||||
|
||||
/**
|
||||
* The satisfaction rating of the ride from 0 to 100.
|
||||
*/
|
||||
readonly satisfaction: number;
|
||||
}
|
||||
|
||||
type RideClassification = "ride" | "stall" | "facility";
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRCT2
|
||||
|
||||
namespace OpenRCT2::Scripting
|
||||
{
|
||||
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 94;
|
||||
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 95;
|
||||
|
||||
// Versions marking breaking changes.
|
||||
static constexpr int32_t API_VERSION_33_PEEP_DEPRECATION = 33;
|
||||
|
||||
@@ -524,6 +524,12 @@ namespace OpenRCT2::Scripting
|
||||
return ride != nullptr ? ride->GetRideTypeDescriptor().LiftData.minimum_speed : 0;
|
||||
}
|
||||
|
||||
uint8_t ScRide::satisfaction_get() const
|
||||
{
|
||||
auto ride = GetRide();
|
||||
return ride != nullptr ? ride->satisfaction * 5 : 0;
|
||||
}
|
||||
|
||||
void ScRide::Register(duk_context* ctx)
|
||||
{
|
||||
dukglue_register_property(ctx, &ScRide::id_get, nullptr, "id");
|
||||
@@ -558,6 +564,7 @@ namespace OpenRCT2::Scripting
|
||||
dukglue_register_property(ctx, &ScRide::liftHillSpeed_get, &ScRide::lifthillSpeed_set, "liftHillSpeed");
|
||||
dukglue_register_property(ctx, &ScRide::maxLiftHillSpeed_get, nullptr, "maxLiftHillSpeed");
|
||||
dukglue_register_property(ctx, &ScRide::minLiftHillSpeed_get, nullptr, "minLiftHillSpeed");
|
||||
dukglue_register_property(ctx, &ScRide::satisfaction_get, nullptr, "satisfaction");
|
||||
}
|
||||
|
||||
} // namespace OpenRCT2::Scripting
|
||||
|
||||
@@ -163,6 +163,8 @@ namespace OpenRCT2::Scripting
|
||||
uint8_t maxLiftHillSpeed_get() const;
|
||||
uint8_t minLiftHillSpeed_get() const;
|
||||
|
||||
uint8_t satisfaction_get() const;
|
||||
|
||||
Ride* GetRide() const;
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user