1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Add quadrant and occupiedQuadrants to plugin API

This commit is contained in:
Ted John
2020-09-13 14:55:54 +01:00
parent 146a754001
commit e79d4be5a5
3 changed files with 36 additions and 0 deletions

View File

@@ -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.

View File

@@ -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 {

View File

@@ -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");