Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
l_object.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include "lua_api/l_base.h"
8#include "irrlichttypes.h"
9
11class LuaEntitySAO;
12class PlayerSAO;
13class RemotePlayer;
14
15/*
16 ObjectRef
17*/
18
19class ObjectRef : public ModApiBase {
20public:
22
23 ~ObjectRef() = default;
24
25 // Creates an ObjectRef and leaves it on top of stack
26 // NOTE: do not call this, use `ScriptApiBase::objectrefGetOrCreate()`!
27 static void create(lua_State *L, ServerActiveObject *object);
28
29 // Clear the pointer in the ObjectRef (at -1).
30 // Throws an fatal error if the object pointer wasn't `expect`.
31 static void set_null(lua_State *L, void *expect);
32
33 static void Register(lua_State *L);
34
36
37 static const char className[];
38private:
40 static luaL_Reg methods[];
41
42
44
45 static PlayerSAO* getplayersao(ObjectRef *ref);
46
47 static RemotePlayer *getplayer(ObjectRef *ref);
48
49 // Exported functions
50
51 // garbage collector
52 static int gc_object(lua_State *L);
53
54 // remove(self)
55 static int l_remove(lua_State *L);
56
57 // is_valid(self)
58 static int l_is_valid(lua_State *L);
59
60 // get_pos(self)
61 static int l_get_pos(lua_State *L);
62
63 // set_pos(self, pos)
64 static int l_set_pos(lua_State *L);
65
66 // add_pos(self, pos)
67 static int l_add_pos(lua_State *L);
68
69 // move_to(self, pos, continuous)
70 static int l_move_to(lua_State *L);
71
72 // punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
73 static int l_punch(lua_State *L);
74
75 // right_click(self, clicker)
76 static int l_right_click(lua_State *L);
77
78 // set_hp(self, hp, reason)
79 static int l_set_hp(lua_State *L);
80
81 // get_hp(self)
82 static int l_get_hp(lua_State *L);
83
84 // get_inventory(self)
85 static int l_get_inventory(lua_State *L);
86
87 // get_wield_list(self)
88 static int l_get_wield_list(lua_State *L);
89
90 // get_wield_index(self)
91 static int l_get_wield_index(lua_State *L);
92
93 // get_wielded_item(self)
94 static int l_get_wielded_item(lua_State *L);
95
96 // set_wielded_item(self, item)
97 static int l_set_wielded_item(lua_State *L);
98
99 // set_armor_groups(self, groups)
100 static int l_set_armor_groups(lua_State *L);
101
102 // get_armor_groups(self)
103 static int l_get_armor_groups(lua_State *L);
104
105 // set_physics_override(self, override_table)
106 static int l_set_physics_override(lua_State *L);
107
108 // get_physics_override(self)
109 static int l_get_physics_override(lua_State *L);
110
111 // set_animation(self, frame_range, frame_speed, frame_blend, frame_loop)
112 static int l_set_animation(lua_State *L);
113
114 // set_animation_frame_speed(self, frame_speed)
115 static int l_set_animation_frame_speed(lua_State *L);
116
117 // get_animation(self)
118 static int l_get_animation(lua_State *L);
119
120 // set_bone_position(self, bone, position, rotation)
121 static int l_set_bone_position(lua_State *L);
122
123 // get_bone_position(self, bone)
124 static int l_get_bone_position(lua_State *L);
125
126 // set_bone_override(self, bone)
127 static int l_set_bone_override(lua_State *L);
128
129 // get_bone_override(self, bone)
130 static int l_get_bone_override(lua_State *L);
131
132 // get_bone_override(self)
133 static int l_get_bone_overrides(lua_State *L);
134
135 // set_attach(self, parent, bone, position, rotation)
136 static int l_set_attach(lua_State *L);
137
138 // get_attach(self)
139 static int l_get_attach(lua_State *L);
140
141 // get_children(self)
142 static int l_get_children(lua_State *L);
143
144 // set_detach(self)
145 static int l_set_detach(lua_State *L);
146
147 // set_properties(self, properties)
148 static int l_set_properties(lua_State *L);
149
150 // get_properties(self)
151 static int l_get_properties(lua_State *L);
152
153 // set_observers(self, observers)
154 static int l_set_observers(lua_State *L);
155
156 // get_observers(self)
157 static int l_get_observers(lua_State *L);
158
159 // get_effective_observers(self)
160 static int l_get_effective_observers(lua_State *L);
161
162 // is_player(self)
163 static int l_is_player(lua_State *L);
164
165 /* LuaEntitySAO-only */
166
167 // set_velocity(self, velocity)
168 static int l_set_velocity(lua_State *L);
169
170 // add_velocity(self, velocity)
171 static int l_add_velocity(lua_State *L);
172
173 // get_velocity(self)
174 static int l_get_velocity(lua_State *L);
175
176 // set_acceleration(self, acceleration)
177 static int l_set_acceleration(lua_State *L);
178
179 // get_acceleration(self)
180 static int l_get_acceleration(lua_State *L);
181
182 // set_rotation(self, rotation)
183 static int l_set_rotation(lua_State *L);
184
185 // get_rotation(self)
186 static int l_get_rotation(lua_State *L);
187
188 // set_yaw(self, yaw)
189 static int l_set_yaw(lua_State *L);
190
191 // get_yaw(self)
192 static int l_get_yaw(lua_State *L);
193
194 // set_texture_mod(self, mod)
195 static int l_set_texture_mod(lua_State *L);
196
197 // l_get_texture_mod(self)
198 static int l_get_texture_mod(lua_State *L);
199
200 // set_sprite(self, start_frame, num_frames, framelength, select_x_by_camera)
201 static int l_set_sprite(lua_State *L);
202
203 // DEPRECATED
204 // get_entity_name(self)
205 static int l_get_entity_name(lua_State *L);
206
207 // get_luaentity(self)
208 static int l_get_luaentity(lua_State *L);
209
210 /* Player-only */
211
212 // get_player_name(self)
213 static int l_get_player_name(lua_State *L);
214
215 // get_fov(self)
216 static int l_get_fov(lua_State *L);
217
218 // get_look_dir(self)
219 static int l_get_look_dir(lua_State *L);
220
221 // DEPRECATED
222 // get_look_pitch(self)
223 static int l_get_look_pitch(lua_State *L);
224
225 // DEPRECATED
226 // get_look_yaw(self)
227 static int l_get_look_yaw(lua_State *L);
228
229 // get_look_pitch2(self)
230 static int l_get_look_vertical(lua_State *L);
231
232 // get_look_yaw2(self)
233 static int l_get_look_horizontal(lua_State *L);
234
235 // set_fov(self, degrees, is_multiplier, transition_time)
236 static int l_set_fov(lua_State *L);
237
238 // set_look_vertical(self, radians)
239 static int l_set_look_vertical(lua_State *L);
240
241 // set_look_horizontal(self, radians)
242 static int l_set_look_horizontal(lua_State *L);
243
244 // DEPRECATED
245 // set_look_pitch(self, radians)
246 static int l_set_look_pitch(lua_State *L);
247
248 // DEPRECATED
249 // set_look_yaw(self, radians)
250 static int l_set_look_yaw(lua_State *L);
251
252 // set_breath(self, breath)
253 static int l_set_breath(lua_State *L);
254
255 // get_breath(self, breath)
256 static int l_get_breath(lua_State *L);
257
258 // DEPRECATED
259 // set_attribute(self, attribute, value)
260 static int l_set_attribute(lua_State *L);
261
262 // DEPRECATED
263 // get_attribute(self, attribute)
264 static int l_get_attribute(lua_State *L);
265
266 // get_meta(self)
267 static int l_get_meta(lua_State *L);
268
269 // set_inventory_formspec(self, formspec)
270 static int l_set_inventory_formspec(lua_State *L);
271
272 // get_inventory_formspec(self)
273 static int l_get_inventory_formspec(lua_State *L);
274
275 // set_formspec_prepend(self, formspec)
276 static int l_set_formspec_prepend(lua_State *L);
277
278 // get_formspec_prepend(self)
279 static int l_get_formspec_prepend(lua_State *L);
280
281 // get_player_control(self)
282 static int l_get_player_control(lua_State *L);
283
284 // get_player_control_bits(self)
285 static int l_get_player_control_bits(lua_State *L);
286
287 // hud_add(self, id, form)
288 static int l_hud_add(lua_State *L);
289
290 // hud_rm(self, id)
291 static int l_hud_remove(lua_State *L);
292
293 // hud_change(self, id, stat, data)
294 static int l_hud_change(lua_State *L);
295
296 // hud_get_next_id(self)
297 static u32 hud_get_next_id(lua_State *L);
298
299 // hud_get(self, id)
300 static int l_hud_get(lua_State *L);
301
302 // hud_get_all(self)
303 static int l_hud_get_all(lua_State *L);
304
305 // hud_set_flags(self, flags)
306 static int l_hud_set_flags(lua_State *L);
307
308 // hud_get_flags()
309 static int l_hud_get_flags(lua_State *L);
310
311 // hud_set_hotbar_itemcount(self, hotbar_itemcount)
312 static int l_hud_set_hotbar_itemcount(lua_State *L);
313
314 // hud_get_hotbar_itemcount(self)
315 static int l_hud_get_hotbar_itemcount(lua_State *L);
316
317 // hud_set_hotbar_image(self, name)
318 static int l_hud_set_hotbar_image(lua_State *L);
319
320 // hud_get_hotbar_image(self)
321 static int l_hud_get_hotbar_image(lua_State *L);
322
323 // hud_set_hotbar_selected_image(self, name)
324 static int l_hud_set_hotbar_selected_image(lua_State *L);
325
326 // hud_get_hotbar_selected_image(self)
327 static int l_hud_get_hotbar_selected_image(lua_State *L);
328
329 // set_sky(self, sky_parameters)
330 static int l_set_sky(lua_State *L);
331
332 // get_sky(self, as_table)
333 static int l_get_sky(lua_State *L);
334
335 // DEPRECATED
336 // get_sky_color(self)
337 static int l_get_sky_color(lua_State* L);
338
339 // set_sun(self, sun_parameters)
340 static int l_set_sun(lua_State *L);
341
342 // get_sun(self)
343 static int l_get_sun(lua_State *L);
344
345 // set_moon(self, moon_parameters)
346 static int l_set_moon(lua_State *L);
347
348 // get_moon(self)
349 static int l_get_moon(lua_State *L);
350
351 // set_stars(self, star_parameters)
352 static int l_set_stars(lua_State *L);
353
354 // get_stars(self)
355 static int l_get_stars(lua_State *L);
356
357 // set_clouds(self, cloud_parameters)
358 static int l_set_clouds(lua_State *L);
359
360 // get_clouds(self)
361 static int l_get_clouds(lua_State *L);
362
363 // override_day_night_ratio(self, type)
364 static int l_override_day_night_ratio(lua_State *L);
365
366 // get_day_night_ratio(self)
367 static int l_get_day_night_ratio(lua_State *L);
368
369 // set_local_animation(self, idle, walk, dig, walk_while_dig, frame_speed)
370 static int l_set_local_animation(lua_State *L);
371
372 // get_local_animation(self)
373 static int l_get_local_animation(lua_State *L);
374
375 // set_eye_offset(self, firstperson, thirdperson, thirdperson_front)
376 static int l_set_eye_offset(lua_State *L);
377
378 // get_eye_offset(self)
379 static int l_get_eye_offset(lua_State *L);
380
381 // set_nametag_attributes(self, attributes)
382 static int l_set_nametag_attributes(lua_State *L);
383
384 // get_nametag_attributes(self)
385 static int l_get_nametag_attributes(lua_State *L);
386
387 // send_mapblock(pos)
388 static int l_send_mapblock(lua_State *L);
389
390 // set_minimap_modes(self, modes, wanted_mode)
391 static int l_set_minimap_modes(lua_State *L);
392
393 // set_lighting(self, lighting)
394 static int l_set_lighting(lua_State *L);
395
396 // get_lighting(self)
397 static int l_get_lighting(lua_State *L);
398
399 // respawn(self)
400 static int l_respawn(lua_State *L);
401
402 // set_flags(self, flags)
403 static int l_set_flags(lua_State *L);
404
405 // get_flags(self)
406 static int l_get_flags(lua_State *L);
407};
Definition luaentity_sao.h:11
Definition l_base.h:28
Definition l_object.h:19
static int l_get_bone_position(lua_State *L)
Definition l_object.cpp:561
static int l_get_acceleration(lua_State *L)
Definition l_object.cpp:1071
static int l_get_wield_list(lua_State *L)
Definition l_object.cpp:272
static int l_respawn(lua_State *L)
Definition l_object.cpp:2701
static int l_get_lighting(lua_State *L)
Definition l_object.cpp:2652
static int l_hud_get_all(lua_State *L)
Definition l_object.cpp:1827
static int l_get_formspec_prepend(lua_State *L)
Definition l_object.cpp:1566
static int l_set_sprite(lua_State *L)
Definition l_object.cpp:1176
static int l_get_day_night_ratio(lua_State *L)
Definition l_object.cpp:2522
static int l_add_pos(lua_State *L)
Definition l_object.cpp:132
static int l_get_observers(lua_State *L)
Definition l_object.cpp:891
static int l_set_observers(lua_State *L)
Definition l_object.cpp:833
static int l_set_clouds(lua_State *L)
Definition l_object.cpp:2418
static int l_override_day_night_ratio(lua_State *L)
Definition l_object.cpp:2499
static int l_hud_get(lua_State *L)
Definition l_object.cpp:1808
static int l_is_player(lua_State *L)
Definition l_object.cpp:908
static int l_get_sky_color(lua_State *L)
Definition l_object.cpp:2238
static int l_hud_add(lua_State *L)
Definition l_object.cpp:1741
static int l_get_wielded_item(lua_State *L)
Definition l_object.cpp:298
static PlayerSAO * getplayersao(ObjectRef *ref)
Definition l_object.cpp:52
static int l_add_velocity(lua_State *L)
Definition l_object.cpp:1009
static int l_hud_remove(lua_State *L)
Definition l_object.cpp:1763
static int l_set_look_pitch(lua_State *L)
Definition l_object.cpp:1352
static int l_get_flags(lua_State *L)
Definition l_object.cpp:2732
static int l_set_moon(lua_State *L)
Definition l_object.cpp:2310
static int l_get_stars(lua_State *L)
Definition l_object.cpp:2393
static int l_get_texture_mod(lua_State *L)
Definition l_object.cpp:1161
static int l_get_player_control(lua_State *L)
Definition l_object.cpp:1581
static int l_set_look_horizontal(lua_State *L)
Definition l_object.cpp:1336
static int l_get_yaw(lua_State *L)
Definition l_object.cpp:1131
static int l_get_bone_overrides(lua_State *L)
Definition l_object.cpp:689
static int l_get_local_animation(lua_State *L)
Definition l_object.cpp:433
static int l_set_inventory_formspec(lua_State *L)
Definition l_object.cpp:1515
static int l_set_rotation(lua_State *L)
Definition l_object.cpp:1085
static int l_get_look_horizontal(lua_State *L)
Definition l_object.cpp:1308
static void create(lua_State *L, ServerActiveObject *object)
Definition l_object.cpp:2756
static int l_hud_get_hotbar_itemcount(lua_State *L)
Definition l_object.cpp:1911
static RemotePlayer * getplayer(ObjectRef *ref)
Definition l_object.cpp:62
static int l_get_look_yaw(lua_State *L)
Definition l_object.cpp:1278
static int l_send_mapblock(lua_State *L)
Definition l_object.cpp:496
ObjectRef(ServerActiveObject *object)
Definition l_object.cpp:2750
static int l_get_attribute(lua_State *L)
Definition l_object.cpp:1479
static int l_set_breath(lua_State *L)
Definition l_object.cpp:1428
static int gc_object(lua_State *L)
Definition l_object.cpp:73
static int l_get_look_vertical(lua_State *L)
Definition l_object.cpp:1295
static void set_null(lua_State *L, void *expect)
Definition l_object.cpp:2764
static int l_set_physics_override(lua_State *L)
Definition l_object.cpp:1657
static int l_set_look_vertical(lua_State *L)
Definition l_object.cpp:1321
static int l_set_formspec_prepend(lua_State *L)
Definition l_object.cpp:1548
static int l_hud_set_hotbar_selected_image(lua_State *L)
Definition l_object.cpp:1954
static int l_set_attach(lua_State *L)
Definition l_object.cpp:705
static int l_hud_get_flags(lua_State *L)
Definition l_object.cpp:1875
static int l_get_properties(lua_State *L)
Definition l_object.cpp:816
static int l_is_valid(lua_State *L)
Definition l_object.cpp:97
ServerActiveObject * m_object
Definition l_object.h:39
static int l_get_effective_observers(lua_State *L)
Definition l_object.cpp:898
static int l_punch(lua_State *L)
Definition l_object.cpp:163
static int l_set_velocity(lua_State *L)
Definition l_object.cpp:994
static int l_set_attribute(lua_State *L)
Definition l_object.cpp:1458
static int l_set_look_yaw(lua_State *L)
Definition l_object.cpp:1372
static int l_set_animation(lua_State *L)
Definition l_object.cpp:373
static int l_get_bone_override(lua_State *L)
Definition l_object.cpp:674
static int l_get_player_control_bits(lua_State *L)
Definition l_object.cpp:1628
static int l_get_meta(lua_State *L)
Definition l_object.cpp:1502
static int l_get_moon(lua_State *L)
Definition l_object.cpp:2336
static int l_move_to(lua_State *L)
Definition l_object.cpp:147
static int l_set_wielded_item(lua_State *L)
Definition l_object.cpp:316
static ServerActiveObject * getobject(ObjectRef *ref)
Definition l_object.cpp:34
static int l_set_flags(lua_State *L)
Definition l_object.cpp:2715
static int l_get_inventory_formspec(lua_State *L)
Definition l_object.cpp:1533
static int l_get_clouds(lua_State *L)
Definition l_object.cpp:2465
static int l_hud_get_hotbar_selected_image(lua_State *L)
Definition l_object.cpp:1969
~ObjectRef()=default
static int l_set_local_animation(lua_State *L)
Definition l_object.cpp:413
static int l_get_look_dir(lua_State *L)
Definition l_object.cpp:1241
static int l_remove(lua_State *L)
Definition l_object.cpp:80
static int l_right_click(lua_State *L)
Definition l_object.cpp:190
static int l_get_breath(lua_State *L)
Definition l_object.cpp:1443
static int l_get_look_pitch(lua_State *L)
Definition l_object.cpp:1260
static int l_set_eye_offset(lua_State *L)
Definition l_object.cpp:454
static int l_get_wield_index(lua_State *L)
Definition l_object.cpp:285
static int l_get_armor_groups(lua_State *L)
Definition l_object.cpp:360
static int l_set_pos(lua_State *L)
Definition l_object.cpp:117
static int l_get_player_name(lua_State *L)
Definition l_object.cpp:1226
static int l_set_sky(lua_State *L)
Definition l_object.cpp:1984
static int l_set_sun(lua_State *L)
Definition l_object.cpp:2255
static int l_get_hp(lua_State *L)
Definition l_object.cpp:237
static int l_get_velocity(lua_State *L)
Definition l_object.cpp:1032
static int l_hud_set_flags(lua_State *L)
Definition l_object.cpp:1849
static LuaEntitySAO * getluaobject(ObjectRef *ref)
Definition l_object.cpp:42
static int l_get_entity_name(lua_State *L)
Definition l_object.cpp:1195
static int l_set_yaw(lua_State *L)
Definition l_object.cpp:1116
static int l_get_rotation(lua_State *L)
Definition l_object.cpp:1100
static int l_get_nametag_attributes(lua_State *L)
Definition l_object.cpp:958
static int l_get_animation(lua_State *L)
Definition l_object.cpp:391
static int l_set_fov(lua_State *L)
Definition l_object.cpp:1391
static int l_get_fov(lua_State *L)
Definition l_object.cpp:1411
static int l_set_properties(lua_State *L)
Definition l_object.cpp:794
static int l_set_lighting(lua_State *L)
Definition l_object.cpp:2596
static int l_get_luaentity(lua_State *L)
Definition l_object.cpp:1211
static int l_get_children(lua_State *L)
Definition l_object.cpp:760
static int l_set_bone_position(lua_State *L)
Definition l_object.cpp:533
static int l_set_detach(lua_State *L)
Definition l_object.cpp:781
static u32 hud_get_next_id(lua_State *L)
static int l_get_eye_offset(lua_State *L)
Definition l_object.cpp:481
static int l_hud_change(lua_State *L)
Definition l_object.cpp:1781
static int l_set_hp(lua_State *L)
Definition l_object.cpp:205
static int l_get_sun(lua_State *L)
Definition l_object.cpp:2283
static int l_set_armor_groups(lua_State *L)
Definition l_object.cpp:335
static int l_set_bone_override(lua_State *L)
Definition l_object.cpp:582
static int l_get_physics_override(lua_State *L)
Definition l_object.cpp:1695
static int l_get_pos(lua_State *L)
Definition l_object.cpp:104
static int l_set_nametag_attributes(lua_State *L)
Definition l_object.cpp:918
static int l_set_minimap_modes(lua_State *L)
Definition l_object.cpp:2543
static int l_get_inventory(lua_State *L)
Definition l_object.cpp:255
static int l_get_attach(lua_State *L)
Definition l_object.cpp:732
static int l_hud_set_hotbar_itemcount(lua_State *L)
Definition l_object.cpp:1893
static int l_get_sky(lua_State *L)
Definition l_object.cpp:2176
static int l_set_texture_mod(lua_State *L)
Definition l_object.cpp:1146
static int l_hud_get_hotbar_image(lua_State *L)
Definition l_object.cpp:1939
static int l_set_animation_frame_speed(lua_State *L)
Definition l_object.cpp:514
static const char className[]
Definition l_object.h:37
static int l_hud_set_hotbar_image(lua_State *L)
Definition l_object.cpp:1924
static int l_set_acceleration(lua_State *L)
Definition l_object.cpp:1056
static luaL_Reg methods[]
Definition l_object.h:2782
static int l_set_stars(lua_State *L)
Definition l_object.cpp:2359
Definition player_sao.h:56
Definition remoteplayer.h:26
Definition serveractiveobject.h:41