1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Add ride age and improve documentation

This commit is contained in:
Ted John
2020-05-16 17:18:27 +01:00
parent f4fb456c50
commit da8f21fb70
2 changed files with 13 additions and 0 deletions

View File

@@ -771,9 +771,15 @@ declare global {
/**
* The date in months when the ride was built.
* Subtract this from `date.monthsElapsed` to get the age.
*/
buildDate: number;
/**
* How old the ride is in months.
*/
readonly age: number;
/**
* The running cost of the ride billed every fortnight. Multiply this by 16 to get the cost per hour (~ 1 year).
*/

View File

@@ -561,6 +561,12 @@ namespace OpenRCT2::Scripting
}
}
int32_t age_get() const
{
auto ride = GetRide();
return ride != nullptr ? ride->GetAge() : 0;
}
int16_t runningCost_get() const
{
auto ride = GetRide();
@@ -651,6 +657,7 @@ namespace OpenRCT2::Scripting
dukglue_register_property(ctx, &ScRide::nausea_get, &ScRide::nausea_set, "nausea");
dukglue_register_property(ctx, &ScRide::totalCustomers_get, &ScRide::totalCustomers_set, "totalCustomers");
dukglue_register_property(ctx, &ScRide::buildDate_get, &ScRide::buildDate_set, "buildDate");
dukglue_register_property(ctx, &ScRide::age_get, nullptr, "age");
dukglue_register_property(ctx, &ScRide::runningCost_get, &ScRide::runningCost_set, "runningCost");
dukglue_register_property(
ctx, &ScRide::inspectionInterval_get, &ScRide::inspectionInterval_set, "inspectionInterval");