mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-23 10:51:58 -05:00
Add Ride.totalProfit to the plugin API (#12795)
Add Ride.totalProfit to the plugin API
This commit is contained in:
parent
b53c4b3625
commit
8d366ebaea
3 changed files with 22 additions and 1 deletions
5
distribution/openrct2.d.ts
vendored
5
distribution/openrct2.d.ts
vendored
|
@ -804,6 +804,11 @@ declare global {
|
|||
*/
|
||||
runningCost: number;
|
||||
|
||||
/**
|
||||
* The total profit of the ride over the course of its lifetime.
|
||||
*/
|
||||
totalProfit: number;
|
||||
|
||||
/**
|
||||
* How often the ride should be inspected by a mechanic.
|
||||
*/
|
||||
|
|
|
@ -582,6 +582,21 @@ namespace OpenRCT2::Scripting
|
|||
}
|
||||
}
|
||||
|
||||
int32_t totalProfit_get() const
|
||||
{
|
||||
auto ride = GetRide();
|
||||
return ride != nullptr ? ride->total_profit : 0;
|
||||
}
|
||||
void totalProfit_set(int32_t value)
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
auto ride = GetRide();
|
||||
if (ride != nullptr)
|
||||
{
|
||||
ride->total_profit = value;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t inspectionInterval_get() const
|
||||
{
|
||||
auto ride = GetRide();
|
||||
|
@ -660,6 +675,7 @@ namespace OpenRCT2::Scripting
|
|||
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::totalProfit_get, &ScRide::totalProfit_set, "totalProfit");
|
||||
dukglue_register_property(
|
||||
ctx, &ScRide::inspectionInterval_get, &ScRide::inspectionInterval_set, "inspectionInterval");
|
||||
dukglue_register_property(ctx, &ScRide::value_get, &ScRide::value_set, "value");
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::Scripting;
|
||||
|
||||
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 1;
|
||||
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 2;
|
||||
|
||||
struct ExpressionStringifier final
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue