Add more fields to ride station

This commit is contained in:
Ted John 2023-04-21 21:45:35 +01:00
parent 8ae6d13fa4
commit e3b82314a3
3 changed files with 129 additions and 4 deletions

View File

@ -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 {

View File

@ -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);

View File

@ -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;
};