diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 97a4303cdf..2502fe62c2 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -5,6 +5,8 @@ - Feature: [#12708] Add plugin-accessible names to all game actions. - Feature: [#12712] Add TCP / socket plugin APIs. - Feature: [#12840] Add Park.entranceFee to the plugin API. +- Feature: [#12884] Add BaseTileElement.occupiedQuadrants to the plugin API. +- Feature: [#12885] Add SmallSceneryElement.quadrant to the plugin API. - Feature: [#12886] Make all scenery placement and remove actions available to the plugin API. - Fix: [#400] Unable to place some saved tracks flush to the ground (original bug). - Fix: [#5753] Entertainers make themselves happy instead of the guests. diff --git a/distribution/openrct2.d.ts b/distribution/openrct2.d.ts index 88274c024e..9f20c293e8 100644 --- a/distribution/openrct2.d.ts +++ b/distribution/openrct2.d.ts @@ -506,6 +506,7 @@ declare global { type: TileElementType; baseHeight: number; clearanceHeight: number; + occupiedQuadrants: number; isHidden: boolean; /** Take caution when changing this field, it may invalidate TileElements you have stored in your script. */ } @@ -554,6 +555,7 @@ declare global { primaryColour: number; secondaryColour: number; direction: Direction; + quadrant: number; } interface EntranceElement extends BaseTileElement { diff --git a/src/openrct2/scripting/ScTile.hpp b/src/openrct2/scripting/ScTile.hpp index e29f05ea3d..2ee2bed8e1 100644 --- a/src/openrct2/scripting/ScTile.hpp +++ b/src/openrct2/scripting/ScTile.hpp @@ -615,6 +615,35 @@ namespace OpenRCT2::Scripting } } + uint8_t quadrant_get() const + { + auto el = _element->AsSmallScenery(); + if (el != nullptr) + return el->GetSceneryQuadrant(); + return 0; + } + void quadrant_set(uint8_t value) + { + ThrowIfGameStateNotMutable(); + auto el = _element->AsSmallScenery(); + if (el != nullptr) + { + el->SetSceneryQuadrant(value); + Invalidate(); + } + } + + uint8_t occupiedQuadrants_get() const + { + return _element->GetOccupiedQuadrants(); + } + void occupiedQuadrants_set(uint8_t value) + { + ThrowIfGameStateNotMutable(); + _element->SetOccupiedQuadrants(value); + Invalidate(); + } + uint8_t primaryColour_get() const { switch (_element->GetType()) @@ -975,6 +1004,8 @@ namespace OpenRCT2::Scripting dukglue_register_property( ctx, &ScTileElement::clearanceHeight_get, &ScTileElement::clearanceHeight_set, "clearanceHeight"); dukglue_register_property(ctx, &ScTileElement::direction_get, &ScTileElement::direction_set, "direction"); + dukglue_register_property( + ctx, &ScTileElement::occupiedQuadrants_get, &ScTileElement::occupiedQuadrants_set, "occupiedQuadrants"); // Some dukglue_register_property(ctx, &ScTileElement::object_get, &ScTileElement::object_set, "object"); @@ -1010,6 +1041,7 @@ namespace OpenRCT2::Scripting // Small Scenery only dukglue_register_property(ctx, &ScTileElement::age_get, &ScTileElement::age_set, "age"); + dukglue_register_property(ctx, &ScTileElement::quadrant_get, &ScTileElement::quadrant_set, "quadrant"); // Footpath only dukglue_register_property(ctx, &ScTileElement::railings_get, &ScTileElement::railings_set, "railings");