mirror of https://github.com/OpenRCT2/OpenRCT2.git
Make tile element direction accessible for scripts (#12057)
* Make tile element direction accessible for scripts Add the direction field from the tile element class to the ScTileElement class passed to the script engine. Co-authored-by: Taylor Stieff <taylor.stieff@heavenhr.de>
This commit is contained in:
parent
cd1d573c39
commit
f7f5124c07
|
@ -415,6 +415,8 @@ declare global {
|
|||
/** This only exist to retrieve the types for existing corrupt elements. For hiding elements, use the isHidden field instead. */
|
||||
| "openrct2_corrupt_deprecated";
|
||||
|
||||
type Direction = 0 | 1 | 2 | 3;
|
||||
|
||||
interface BaseTileElement {
|
||||
type: TileElementType;
|
||||
baseHeight: number;
|
||||
|
@ -449,6 +451,8 @@ declare global {
|
|||
|
||||
addition: number | null;
|
||||
isAdditionBroken: boolean;
|
||||
|
||||
direction: Direction;
|
||||
}
|
||||
|
||||
interface TrackElement extends BaseTileElement {
|
||||
|
@ -457,12 +461,14 @@ declare global {
|
|||
ride: number;
|
||||
station: number;
|
||||
hasChainLift: boolean;
|
||||
direction: Direction;
|
||||
}
|
||||
|
||||
interface SmallSceneryElement extends BaseTileElement {
|
||||
object: number;
|
||||
primaryColour: number;
|
||||
secondaryColour: number;
|
||||
direction: Direction;
|
||||
}
|
||||
|
||||
interface EntranceElement extends BaseTileElement {
|
||||
|
@ -474,6 +480,7 @@ declare global {
|
|||
|
||||
interface WallElement extends BaseTileElement {
|
||||
object: number;
|
||||
direction: Direction;
|
||||
}
|
||||
|
||||
interface LargeSceneryElement extends BaseTileElement {
|
||||
|
|
|
@ -942,6 +942,25 @@ namespace OpenRCT2::Scripting
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t direction_get() const
|
||||
{
|
||||
if (_element != nullptr)
|
||||
{
|
||||
return _element->GetDirection();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
void direction_set(uint8_t value)
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
if (_element != nullptr)
|
||||
{
|
||||
_element->SetDirection(value);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void Invalidate()
|
||||
{
|
||||
map_invalidate_tile_full(_coords);
|
||||
|
@ -955,6 +974,7 @@ namespace OpenRCT2::Scripting
|
|||
dukglue_register_property(ctx, &ScTileElement::baseHeight_get, &ScTileElement::baseHeight_set, "baseHeight");
|
||||
dukglue_register_property(
|
||||
ctx, &ScTileElement::clearanceHeight_get, &ScTileElement::clearanceHeight_set, "clearanceHeight");
|
||||
dukglue_register_property(ctx, &ScTileElement::direction_get, &ScTileElement::direction_set, "direction");
|
||||
|
||||
// Some
|
||||
dukglue_register_property(ctx, &ScTileElement::object_get, &ScTileElement::object_set, "object");
|
||||
|
|
Loading…
Reference in New Issue