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

Add more park attributes to plugin API

This commit is contained in:
Ted John
2020-12-01 23:14:43 +00:00
parent b1403db509
commit acaa72cce8
2 changed files with 89 additions and 0 deletions

View File

@@ -1471,6 +1471,32 @@ declare global {
*/
companyValue: number;
/**
* The total number of guests that have entered the park.
*/
totalAdmissions: number;
/**
* The total amount of income gained from admissions into the park.
*/
totalIncomeFromAdmissions: number;
/**
* The purchase price of one tile for park ownership.
*/
landPrice: number;
/**
* The purchase price of one tile for construction rights.
*/
constructionRightsPrice: number;
/**
* The number of tiles on the map with park ownership or construction rights.
* Updated every 4096 ticks.
*/
readonly parkSize: number;
name: string;
messages: ParkMessage[];

View File

@@ -366,6 +366,61 @@ namespace OpenRCT2::Scripting
}
}
uint32_t totalAdmissions_get() const
{
return gTotalAdmissions;
}
void totalAdmissions_set(uint32_t value)
{
ThrowIfGameStateNotMutable();
if (gTotalAdmissions != value)
{
gTotalAdmissions = value;
window_invalidate_by_class(WC_PARK_INFORMATION);
}
}
money32 totalIncomeFromAdmissions_get() const
{
return gTotalIncomeFromAdmissions;
}
void totalIncomeFromAdmissions_set(money32 value)
{
ThrowIfGameStateNotMutable();
if (gTotalIncomeFromAdmissions != value)
{
gTotalIncomeFromAdmissions = value;
window_invalidate_by_class(WC_PARK_INFORMATION);
}
}
money32 landPrice_get() const
{
return gLandPrice;
}
void landPrice_set(money32 value)
{
ThrowIfGameStateNotMutable();
gLandPrice = value;
}
money32 constructionRightsPrice_get() const
{
return gConstructionRightsPrice;
}
void constructionRightsPrice_set(money32 value)
{
ThrowIfGameStateNotMutable();
gConstructionRightsPrice = value;
}
uint16_t parkSize_get() const
{
return gParkSize;
}
std::string name_get() const
{
return GetContext()->GetGameState()->GetPark().Name;
@@ -495,6 +550,14 @@ namespace OpenRCT2::Scripting
dukglue_register_property(ctx, &ScPark::guests_get, nullptr, "guests");
dukglue_register_property(ctx, &ScPark::value_get, &ScPark::value_set, "value");
dukglue_register_property(ctx, &ScPark::companyValue_get, &ScPark::companyValue_set, "companyValue");
dukglue_register_property(ctx, &ScPark::totalAdmissions_get, &ScPark::totalAdmissions_set, "totalAdmissions");
dukglue_register_property(
ctx, &ScPark::totalIncomeFromAdmissions_get, &ScPark::totalIncomeFromAdmissions_set,
"totalIncomeFromAdmissions");
dukglue_register_property(ctx, &ScPark::landPrice_get, &ScPark::landPrice_set, "landPrice");
dukglue_register_property(
ctx, &ScPark::constructionRightsPrice_get, &ScPark::constructionRightsPrice_set, "constructionRightsPrice");
dukglue_register_property(ctx, &ScPark::parkSize_get, nullptr, "parkSize");
dukglue_register_property(ctx, &ScPark::name_get, &ScPark::name_set, "name");
dukglue_register_property(ctx, &ScPark::messages_get, &ScPark::messages_set, "messages");
dukglue_register_method(ctx, &ScPark::getFlag, "getFlag");