1 /*****************************************************************************
2  * Copyright (c) 2014-2021 OpenRCT2 developers
3  *
4  * For a complete list of all authors, please refer to contributors.md
5  * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
6  *
7  * OpenRCT2 is licensed under the GNU General Public License version 3.
8  *****************************************************************************/
9 
10 #pragma once
11 
12 #ifdef ENABLE_SCRIPTING
13 
14 #    include "../../../Context.h"
15 #    include "../../../common.h"
16 #    include "../../../core/Guard.hpp"
17 #    include "../../../ride/Track.h"
18 #    include "../../../world/Footpath.h"
19 #    include "../../../world/Scenery.h"
20 #    include "../../../world/Sprite.h"
21 #    include "../../../world/Surface.h"
22 #    include "../../Duktape.hpp"
23 #    include "../../ScriptEngine.h"
24 
25 #    include <cstdio>
26 #    include <cstring>
27 #    include <utility>
28 
29 namespace OpenRCT2::Scripting
30 {
31     class ScTileElement
32     {
33     protected:
34         CoordsXY _coords;
35         TileElement* _element;
36 
37     public:
38         ScTileElement(const CoordsXY& coords, TileElement* element);
39 
40     private:
41         std::string type_get() const;
42         void type_set(std::string value);
43 
44         uint8_t baseHeight_get() const;
45         void baseHeight_set(uint8_t newBaseHeight);
46 
47         uint16_t baseZ_get() const;
48         void baseZ_set(uint16_t value);
49 
50         uint8_t clearanceHeight_get() const;
51         void clearanceHeight_set(uint8_t newClearanceHeight);
52 
53         uint16_t clearanceZ_get() const;
54         void clearanceZ_set(uint16_t value);
55 
56         DukValue slope_get() const;
57         void slope_set(uint8_t value);
58 
59         DukValue waterHeight_get() const;
60         void waterHeight_set(int32_t value);
61 
62         DukValue surfaceStyle_get() const;
63         void surfaceStyle_set(uint32_t value);
64 
65         DukValue edgeStyle_get() const;
66         void edgeStyle_set(uint32_t value);
67 
68         DukValue grassLength_get() const;
69         void grassLength_set(uint8_t value);
70 
71         DukValue hasOwnership_get() const;
72 
73         DukValue hasConstructionRights_get();
74 
75         DukValue ownership_get() const;
76         void ownership_set(uint8_t value);
77 
78         DukValue parkFences_get() const;
79         void parkFences_set(uint8_t value);
80 
81         DukValue trackType_get() const;
82         void trackType_set(uint8_t value);
83 
84         DukValue sequence_get() const;
85         void sequence_set(uint8_t value);
86 
87         DukValue ride_get() const;
88         void ride_set(int32_t value);
89 
90         DukValue station_get() const;
91         void station_set(uint8_t value);
92 
93         DukValue hasChainLift_get() const;
94         void hasChainLift_set(bool value);
95 
96         DukValue mazeEntry_get() const;
97         void mazeEntry_set(uint16_t value);
98 
99         DukValue colourScheme_get() const;
100         void colourScheme_set(uint8_t value);
101 
102         DukValue seatRotation_get() const;
103         void seatRotation_set(uint8_t value);
104 
105         DukValue brakeBoosterSpeed_get() const;
106         void brakeBoosterSpeed_set(uint8_t value);
107 
108         DukValue isInverted_get() const;
109         void isInverted_set(bool value);
110 
111         DukValue hasCableLift_get() const;
112         void hasCableLift_set(bool value);
113 
114         DukValue object_get() const;
115         void object_set(uint32_t value);
116 
117         bool isHidden_get() const;
118         void isHidden_set(bool hide);
119 
120         DukValue age_get() const;
121         void age_set(uint8_t value);
122 
123         DukValue quadrant_get() const;
124         void quadrant_set(uint8_t value);
125 
126         uint8_t occupiedQuadrants_get() const;
127         void occupiedQuadrants_set(uint8_t value);
128 
129         bool isGhost_get() const;
130         void isGhost_set(bool value);
131 
132         DukValue primaryColour_get() const;
133         void primaryColour_set(uint8_t value);
134 
135         DukValue secondaryColour_get() const;
136         void secondaryColour_set(uint8_t value);
137 
138         DukValue tertiaryColour_get() const;
139         void tertiaryColour_set(uint8_t value);
140 
141         DukValue bannerIndex_get() const;
142         void bannerIndex_set(uint16_t value);
143 
144         // Deprecated in favor of seperate 'edges' and 'corners' properties,
145         // left here to maintain compatibility with older plugins.
146         /** @deprecated */
147         uint8_t edgesAndCorners_get() const;
148         /** @deprecated */
149         void edgesAndCorners_set(uint8_t value);
150 
151         DukValue edges_get() const;
152         void edges_set(uint8_t value);
153 
154         DukValue corners_get() const;
155         void corners_set(uint8_t value);
156 
157         DukValue slopeDirection_get() const;
158         void slopeDirection_set(const DukValue& value);
159 
160         DukValue isQueue_get() const;
161         void isQueue_set(bool value);
162 
163         DukValue queueBannerDirection_get() const;
164         void queueBannerDirection_set(const DukValue& value);
165 
166         DukValue isBlockedByVehicle_get() const;
167         void isBlockedByVehicle_set(bool value);
168 
169         DukValue isWide_get() const;
170         void isWide_set(bool value);
171 
172         DukValue addition_get() const;
173         void addition_set(const DukValue& value);
174 
175         DukValue additionStatus_get() const;
176         void additionStatus_set(uint8_t value);
177 
178         DukValue isAdditionBroken_get() const;
179         void isAdditionBroken_set(bool value);
180 
181         DukValue isAdditionGhost_get() const;
182         void isAdditionGhost_set(bool value);
183 
184         DukValue footpathObject_get() const;
185         void footpathObject_set(uint8_t value);
186 
187         DukValue direction_get() const;
188         void direction_set(uint8_t value);
189 
190         void Invalidate();
191 
192     public:
193         static void Register(duk_context* ctx);
194     };
195 
196 } // namespace OpenRCT2::Scripting
197 
198 #endif
199