mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 21:43:06 +01:00
Add new plugin API properties to entity, ride and park
This commit is contained in:
@@ -848,6 +848,9 @@ namespace OpenRCT2::Scripting
|
||||
dukglue_register_property(ctx, &ScGuest::maxIntensity_get, &ScGuest::maxIntensity_set, "maxIntensity");
|
||||
dukglue_register_property(ctx, &ScGuest::nauseaTolerance_get, &ScGuest::nauseaTolerance_set, "nauseaTolerance");
|
||||
dukglue_register_property(ctx, &ScGuest::cash_get, &ScGuest::cash_set, "cash");
|
||||
dukglue_register_property(ctx, &ScGuest::isInPark_get, nullptr, "isInPark");
|
||||
dukglue_register_property(ctx, &ScGuest::isLost_get, nullptr, "isLost");
|
||||
dukglue_register_property(ctx, &ScGuest::lostCountdown_get, &ScGuest::lostCountdown_set, "lostCountdown");
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -1115,6 +1118,33 @@ namespace OpenRCT2::Scripting
|
||||
peep->CashInPocket = std::max(0, value);
|
||||
}
|
||||
}
|
||||
|
||||
bool isInPark_get() const
|
||||
{
|
||||
auto peep = GetGuest();
|
||||
return (peep != nullptr && !peep->OutsideOfPark);
|
||||
}
|
||||
|
||||
bool isLost_get() const
|
||||
{
|
||||
auto peep = GetGuest();
|
||||
return (peep != nullptr && peep->GuestIsLostCountdown < 90);
|
||||
}
|
||||
|
||||
uint8_t lostCountdown_get() const
|
||||
{
|
||||
auto peep = GetGuest();
|
||||
return peep != nullptr ? peep->GuestIsLostCountdown : 0;
|
||||
}
|
||||
void lostCountdown_set(uint8_t value)
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
auto peep = GetGuest();
|
||||
if (peep != nullptr)
|
||||
{
|
||||
peep->GuestIsLostCountdown = value;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ScStaff : public ScPeep
|
||||
|
||||
@@ -449,6 +449,16 @@ namespace OpenRCT2::Scripting
|
||||
gConstructionRightsPrice = value;
|
||||
}
|
||||
|
||||
int16_t casualtyPenalty_get() const
|
||||
{
|
||||
return gParkRatingCasualtyPenalty;
|
||||
}
|
||||
void casualtyPenalty_set(int16_t value)
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
gParkRatingCasualtyPenalty = value;
|
||||
}
|
||||
|
||||
uint16_t parkSize_get() const
|
||||
{
|
||||
return gParkSize;
|
||||
@@ -600,6 +610,7 @@ namespace OpenRCT2::Scripting
|
||||
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_property(ctx, &ScPark::casualtyPenalty_get, &ScPark::casualtyPenalty_set, "casualtyPenalty");
|
||||
dukglue_register_method(ctx, &ScPark::getFlag, "getFlag");
|
||||
dukglue_register_method(ctx, &ScPark::setFlag, "setFlag");
|
||||
dukglue_register_method(ctx, &ScPark::postMessage, "postMessage");
|
||||
|
||||
@@ -642,6 +642,12 @@ namespace OpenRCT2::Scripting
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t downtime_get() const
|
||||
{
|
||||
auto ride = GetRide();
|
||||
return ride != nullptr ? ride->downtime : 0;
|
||||
}
|
||||
|
||||
Ride* GetRide() const
|
||||
{
|
||||
return get_ride(_rideId);
|
||||
@@ -681,6 +687,7 @@ namespace OpenRCT2::Scripting
|
||||
dukglue_register_property(
|
||||
ctx, &ScRide::inspectionInterval_get, &ScRide::inspectionInterval_set, "inspectionInterval");
|
||||
dukglue_register_property(ctx, &ScRide::value_get, &ScRide::value_set, "value");
|
||||
dukglue_register_property(ctx, &ScRide::downtime_get, nullptr, "downtime");
|
||||
}
|
||||
};
|
||||
} // namespace OpenRCT2::Scripting
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRCT2
|
||||
|
||||
namespace OpenRCT2::Scripting
|
||||
{
|
||||
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 35;
|
||||
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 36;
|
||||
|
||||
// Versions marking breaking changes.
|
||||
static constexpr int32_t API_VERSION_33_PEEP_DEPRECATION = 33;
|
||||
|
||||
Reference in New Issue
Block a user