forked from rosebudai/OpenRCT2-Web
Add ‘popularity’ to plugin, fix values for ‘satisfaction’
This commit is contained in:
1 parent
be37d9c7ed
commit
0a5f145ae5
4 files changed
+21
-3
No files matched your search
@@ -132,6 +132,7 @@ Appreciation for contributors who have provided substantial work, but are no lon
|
||||
* 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.
|
||||
* Mark Alliban (MarkAlliban) - Added plugin API fields.
|
||||
|
||||
## Bug fixes & Refactors
|
||||
* Claudio Tiecher (janclod)
|
||||
|
||||
Vendored
+7
-2
@@ -2530,9 +2530,14 @@ declare global {
|
||||
readonly minLiftHillSpeed: number;
|
||||
|
||||
/**
|
||||
* The satisfaction rating of the ride from 0 to 100.
|
||||
* The satisfaction rating of the ride from 0 to 100, or NULL if not yet calculated.
|
||||
*/
|
||||
readonly satisfaction: number;
|
||||
readonly satisfaction: number | null;
|
||||
|
||||
/**
|
||||
* The popularity rating of the ride from 0 to 100, or NULL if not calculated.
|
||||
*/
|
||||
readonly popularity: number | null;
|
||||
|
||||
/**
|
||||
* The max speed in miles per hour.
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace OpenRCT2::Scripting
|
||||
JS_CGETSET_DEF("maxLiftHillSpeed", ScRide::maxLiftHillSpeed_get, nullptr),
|
||||
JS_CGETSET_DEF("minLiftHillSpeed", ScRide::minLiftHillSpeed_get, nullptr),
|
||||
JS_CGETSET_DEF("satisfaction", ScRide::satisfaction_get, nullptr),
|
||||
JS_CGETSET_DEF("popularity", ScRide::popularity_get, nullptr),
|
||||
JS_CGETSET_DEF("maxSpeed", ScRide::maxSpeed_get, nullptr),
|
||||
JS_CGETSET_DEF("averageSpeed", ScRide::averageSpeed_get, nullptr),
|
||||
JS_CGETSET_DEF("rideTime", ScRide::rideTime_get, nullptr),
|
||||
@@ -732,7 +733,17 @@ namespace OpenRCT2::Scripting
|
||||
JSValue ScRide::satisfaction_get(JSContext* ctx, JSValue thisVal)
|
||||
{
|
||||
auto ride = GetRide(thisVal);
|
||||
return JS_NewUint32(ctx, ride != nullptr ? ride->satisfaction * 5 : 0);
|
||||
if (ride == nullptr || ride->satisfaction == 255)
|
||||
return JS_NULL;
|
||||
return JS_NewUint32(ctx, ride->satisfaction * 5);
|
||||
}
|
||||
|
||||
JSValue ScRide::popularity_get(JSContext* ctx, JSValue thisVal)
|
||||
{
|
||||
auto ride = GetRide(thisVal);
|
||||
if (ride == nullptr || ride->popularity == 255)
|
||||
return JS_NULL;
|
||||
return JS_NewUint32(ctx, ride->popularity * 4);
|
||||
}
|
||||
|
||||
JSValue ScRide::maxSpeed_get(JSContext* ctx, JSValue thisVal)
|
||||
|
||||
@@ -133,6 +133,7 @@ namespace OpenRCT2::Scripting
|
||||
static JSValue maxLiftHillSpeed_get(JSContext* ctx, JSValue thisVal);
|
||||
static JSValue minLiftHillSpeed_get(JSContext* ctx, JSValue thisVal);
|
||||
static JSValue satisfaction_get(JSContext* ctx, JSValue thisVal);
|
||||
static JSValue popularity_get(JSContext* ctx, JSValue thisVal);
|
||||
static JSValue maxSpeed_get(JSContext* ctx, JSValue thisVal);
|
||||
static JSValue averageSpeed_get(JSContext* ctx, JSValue thisVal);
|
||||
static JSValue rideTime_get(JSContext* ctx, JSValue thisVal);
|
||||
|
||||
Reference in new issue
Block a user