diff --git a/distribution/openrct2.d.ts b/distribution/openrct2.d.ts index e1bcce131a..a1a9cfb76e 100644 --- a/distribution/openrct2.d.ts +++ b/distribution/openrct2.d.ts @@ -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. */ diff --git a/src/openrct2/scripting/bindings/entity/ScPeep.hpp b/src/openrct2/scripting/bindings/entity/ScPeep.hpp index 54b92a8e4d..8cc4d4287a 100644 --- a/src/openrct2/scripting/bindings/entity/ScPeep.hpp +++ b/src/openrct2/scripting/bindings/entity/ScPeep.hpp @@ -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();