mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 04:23:20 +01:00
Allow scripts to manipulate peep directions
This commit is contained in:
5
distribution/openrct2.d.ts
vendored
5
distribution/openrct2.d.ts
vendored
@@ -2694,6 +2694,11 @@ declare global {
|
||||
*/
|
||||
destination: CoordsXY;
|
||||
|
||||
/**
|
||||
* The peep's orthogonal direction, from 0 to 3.
|
||||
*/
|
||||
direction: Direction;
|
||||
|
||||
/**
|
||||
* How tired the guest is between 32 and 128 where lower is more tired.
|
||||
*/
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace OpenRCT2::Scripting
|
||||
dukglue_register_property(ctx, &ScPeep::peepType_get, nullptr, "peepType");
|
||||
dukglue_register_property(ctx, &ScPeep::name_get, &ScPeep::name_set, "name");
|
||||
dukglue_register_property(ctx, &ScPeep::destination_get, &ScPeep::destination_set, "destination");
|
||||
dukglue_register_property(ctx, &ScPeep::direction_get, &ScPeep::direction_set, "direction");
|
||||
dukglue_register_property(ctx, &ScPeep::energy_get, &ScPeep::energy_set, "energy");
|
||||
dukglue_register_property(ctx, &ScPeep::energyTarget_get, &ScPeep::energyTarget_set, "energyTarget");
|
||||
dukglue_register_method(ctx, &ScPeep::getFlag, "getFlag");
|
||||
@@ -140,6 +141,23 @@ namespace OpenRCT2::Scripting
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t direction_get() const
|
||||
{
|
||||
auto peep = GetPeep();
|
||||
return peep != nullptr ? peep->PeepDirection : 0;
|
||||
}
|
||||
|
||||
void direction_set(const uint8_t value)
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
auto peep = GetPeep();
|
||||
if (peep != nullptr && value < kNumOrthogonalDirections)
|
||||
{
|
||||
peep->PeepDirection = value;
|
||||
peep->Orientation = value << 3;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t energy_get() const
|
||||
{
|
||||
auto peep = GetPeep();
|
||||
|
||||
Reference in New Issue
Block a user