forked from rosebudai/OpenRCT2-Web
For plugin API, add segmentLength to the ride.stations array (#27298)
This is required for several reasons: calculating soft guest cap for harder guest generation, stat requirements for multi-station rides, etc.
This commit is contained in:
1 parent
815ac9352a
commit
105131d5f4
3 files changed
+10
No files matched your search
Vendored
+1
@@ -2637,6 +2637,7 @@ declare global {
|
||||
exit: CoordsXYZD;
|
||||
/** Queue wait time in minutes for this station. */
|
||||
readonly queueTime: number;
|
||||
readonly segmentLength: number;
|
||||
}
|
||||
|
||||
interface TrackSegment {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "ScRideStation.hpp"
|
||||
|
||||
#include "../../../core/UnitConversion.h"
|
||||
#include "../../../ride/Ride.h"
|
||||
|
||||
namespace OpenRCT2::Scripting
|
||||
@@ -23,6 +24,7 @@ namespace OpenRCT2::Scripting
|
||||
JS_CGETSET_DEF("entrance", ScRideStation::entrance_get, ScRideStation::entrance_set),
|
||||
JS_CGETSET_DEF("exit", ScRideStation::exit_get, ScRideStation::exit_set),
|
||||
JS_CGETSET_DEF("queueTime", ScRideStation::queueTime_get, nullptr),
|
||||
JS_CGETSET_DEF("segmentLength", ScRideStation::segmentLength_get, nullptr),
|
||||
};
|
||||
RegisterBase(ctx, "RideStation", Finalize, funcs);
|
||||
}
|
||||
@@ -102,6 +104,12 @@ namespace OpenRCT2::Scripting
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
JSValue ScRideStation::segmentLength_get(JSContext* ctx, JSValue thisVal)
|
||||
{
|
||||
auto station = GetRideStation(thisVal);
|
||||
return JS_NewInt32(ctx, station != nullptr ? ToHumanReadableRideLength(station->segmentLength) : 0);
|
||||
}
|
||||
|
||||
JSValue ScRideStation::entrance_get(JSContext* ctx, JSValue thisVal)
|
||||
{
|
||||
auto station = GetRideStation(thisVal);
|
||||
|
||||
@@ -51,6 +51,7 @@ namespace OpenRCT2::Scripting
|
||||
static JSValue exit_get(JSContext* ctx, JSValue thisVal);
|
||||
static JSValue exit_set(JSContext* ctx, JSValue thisVal, JSValue value);
|
||||
static JSValue queueTime_get(JSContext* ctx, JSValue thisVal);
|
||||
static JSValue segmentLength_get(JSContext* ctx, JSValue thisVal);
|
||||
};
|
||||
|
||||
} // namespace OpenRCT2::Scripting
|
||||
|
||||
Reference in new issue
Block a user