]> git.lizzy.rs Git - dragonfireclient.git/blob - src/script/lua_api/l_clientobject.h
Added the API additions from waspsaliva
[dragonfireclient.git] / src / script / lua_api / l_clientobject.h
1 /*
2 Dragonfire
3 Copyright (C) 2020 system32
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include "lua_api/l_base.h"
21 #include "client/clientobject.h"
22 #include "client/content_cao.h"
23
24 class ClientObjectRef : public ModApiBase
25 {
26 public:
27     ClientObjectRef(ClientActiveObject *object);
28
29     ~ClientObjectRef() = default;
30
31     static void Register(lua_State *L);
32
33     static void create(lua_State *L, ClientActiveObject *object);
34
35     static ClientObjectRef *checkobject(lua_State *L, int narg);
36
37 private:
38     ClientActiveObject *m_object = nullptr;
39     static const char className[];
40     static luaL_Reg methods[];
41
42     static ClientActiveObject *get_cao(ClientObjectRef *ref);
43     static GenericCAO *get_generic_cao(ClientObjectRef *ref, lua_State *L);
44
45     static int gc_object(lua_State *L);
46
47     // get_pos(self)
48     // returns: {x=num, y=num, z=num}
49     static int l_get_pos(lua_State *L);
50
51     // get_velocity(self)
52     static int l_get_velocity(lua_State *L);
53
54     // get_acceleration(self)
55     static int l_get_acceleration(lua_State *L);
56
57     // get_rotation(self)
58     static int l_get_rotation(lua_State *L);
59
60     // is_player(self)
61     static int l_is_player(lua_State *L);
62
63     // get_name(self)
64     static int l_get_name(lua_State *L);
65
66     // get_attach(self)
67     static int l_get_attach(lua_State *L);
68
69     // get_nametag(self)
70     static int l_get_nametag(lua_State *L);
71
72     // get_textures(self)
73     static int l_get_item_textures(lua_State *L);
74
75     // get_hp(self)
76     static int l_get_max_hp(lua_State *L);
77 };