diff --git a/distribution/openrct2.d.ts b/distribution/openrct2.d.ts index 8af4dd3386..6ca4f6f3e0 100644 --- a/distribution/openrct2.d.ts +++ b/distribution/openrct2.d.ts @@ -1955,10 +1955,47 @@ declare global { } interface RideStation { + /** + * The back of the station. + */ start: CoordsXYZ; + + /** + * The length of the station in tiles. + */ length: number; + + /** + * The location of the entrance. This may not be the actual location, + * for hacked rides. + */ entrance: CoordsXYZD; + + /** + * The location of the exit. This may not be the actual location, + * for hacked rides. + */ exit: CoordsXYZD; + + /** + * The length of track before the next or same station is reached. + */ + segmentLength: number; + + /** + * The time it takes for a train to reach the next or same station. + */ + segmentTime: number; + + /** + * The number of guests queuing for the ride at this station. + */ + queueLength: number; + + /** + * The approximated queuing time of the ride at this station. + */ + queueTime: number; } interface TrackSegment { diff --git a/src/openrct2/scripting/bindings/ride/ScRideStation.cpp b/src/openrct2/scripting/bindings/ride/ScRideStation.cpp index 529a5ff447..7d97640145 100644 --- a/src/openrct2/scripting/bindings/ride/ScRideStation.cpp +++ b/src/openrct2/scripting/bindings/ride/ScRideStation.cpp @@ -32,6 +32,10 @@ namespace OpenRCT2::Scripting dukglue_register_property(ctx, &ScRideStation::length_get, &ScRideStation::length_set, "length"); dukglue_register_property(ctx, &ScRideStation::entrance_get, &ScRideStation::entrance_set, "entrance"); dukglue_register_property(ctx, &ScRideStation::exit_get, &ScRideStation::exit_set, "exit"); + dukglue_register_property(ctx, &ScRideStation::segmentLength_get, &ScRideStation::segmentLength_set, "segmentLength"); + dukglue_register_property(ctx, &ScRideStation::segmentTime_get, &ScRideStation::segmentTime_set, "segmentTime"); + dukglue_register_property(ctx, &ScRideStation::queueLength_get, &ScRideStation::queueLength_set, "queueLength"); + dukglue_register_property(ctx, &ScRideStation::queueTime_get, &ScRideStation::queueTime_set, "queueTime"); } DukValue ScRideStation::start_get() const @@ -116,6 +120,82 @@ namespace OpenRCT2::Scripting } } + int32_t ScRideStation::segmentLength_get() const + { + auto station = GetRideStation(); + if (station != nullptr) + { + return station->SegmentLength; + } + return 0; + } + + void ScRideStation::segmentLength_set(int32_t value) + { + auto station = GetRideStation(); + if (station != nullptr) + { + station->SegmentLength = value; + } + } + + int32_t ScRideStation::segmentTime_get() const + { + auto station = GetRideStation(); + if (station != nullptr) + { + return station->SegmentTime; + } + return 0; + } + + void ScRideStation::segmentTime_set(int32_t value) + { + auto station = GetRideStation(); + if (station != nullptr) + { + station->SegmentTime = value; + } + } + + int32_t ScRideStation::queueLength_get() const + { + auto station = GetRideStation(); + if (station != nullptr) + { + return station->QueueLength; + } + return 0; + } + + void ScRideStation::queueLength_set(int32_t value) + { + auto station = GetRideStation(); + if (station != nullptr) + { + station->QueueLength = value; + } + } + + int32_t ScRideStation::queueTime_get() const + { + auto station = GetRideStation(); + if (station != nullptr) + { + return station->QueueTime; + } + return 0; + } + + void ScRideStation::queueTime_set(int32_t value) + { + auto station = GetRideStation(); + if (station != nullptr) + { + station->QueueTime = value; + } + } + RideStation* ScRideStation::GetRideStation() const { auto ride = GetRide(_rideId); diff --git a/src/openrct2/scripting/bindings/ride/ScRideStation.hpp b/src/openrct2/scripting/bindings/ride/ScRideStation.hpp index 70b44217bf..614cb1d1cc 100644 --- a/src/openrct2/scripting/bindings/ride/ScRideStation.hpp +++ b/src/openrct2/scripting/bindings/ride/ScRideStation.hpp @@ -31,21 +31,29 @@ namespace OpenRCT2::Scripting private: DukValue start_get() const; - void start_set(const DukValue& value); int32_t length_get() const; - void length_set(int32_t value); DukValue entrance_get() const; - void entrance_set(const DukValue& value); DukValue exit_get() const; - void exit_set(const DukValue& value); + int32_t segmentLength_get() const; + void segmentLength_set(int32_t value); + + int32_t segmentTime_get() const; + void segmentTime_set(int32_t value); + + int32_t queueLength_get() const; + void queueLength_set(int32_t value); + + int32_t queueTime_get() const; + void queueTime_set(int32_t value); + RideStation* GetRideStation() const; };