aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_clientobject.h
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-10-18 14:16:18 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-10-18 14:16:18 +0200
commit28a560684b9b9048f8436583805f3f733d7ce829 (patch)
tree7615dddb67a38982d10660c751ef4db229a702f8 /src/script/lua_api/l_clientobject.h
parentc1aea404b862256e6bf9316eeb8f32c72b78a4c2 (diff)
downloaddragonfireclient-28a560684b9b9048f8436583805f3f733d7ce829.tar.xz
Added the API additions from waspsaliva
Diffstat (limited to 'src/script/lua_api/l_clientobject.h')
-rw-r--r--src/script/lua_api/l_clientobject.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/script/lua_api/l_clientobject.h b/src/script/lua_api/l_clientobject.h
new file mode 100644
index 000000000..c538c339e
--- /dev/null
+++ b/src/script/lua_api/l_clientobject.h
@@ -0,0 +1,77 @@
+/*
+Dragonfire
+Copyright (C) 2020 system32
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#include "lua_api/l_base.h"
+#include "client/clientobject.h"
+#include "client/content_cao.h"
+
+class ClientObjectRef : public ModApiBase
+{
+public:
+ ClientObjectRef(ClientActiveObject *object);
+
+ ~ClientObjectRef() = default;
+
+ static void Register(lua_State *L);
+
+ static void create(lua_State *L, ClientActiveObject *object);
+
+ static ClientObjectRef *checkobject(lua_State *L, int narg);
+
+private:
+ ClientActiveObject *m_object = nullptr;
+ static const char className[];
+ static luaL_Reg methods[];
+
+ static ClientActiveObject *get_cao(ClientObjectRef *ref);
+ static GenericCAO *get_generic_cao(ClientObjectRef *ref, lua_State *L);
+
+ static int gc_object(lua_State *L);
+
+ // get_pos(self)
+ // returns: {x=num, y=num, z=num}
+ static int l_get_pos(lua_State *L);
+
+ // get_velocity(self)
+ static int l_get_velocity(lua_State *L);
+
+ // get_acceleration(self)
+ static int l_get_acceleration(lua_State *L);
+
+ // get_rotation(self)
+ static int l_get_rotation(lua_State *L);
+
+ // is_player(self)
+ static int l_is_player(lua_State *L);
+
+ // get_name(self)
+ static int l_get_name(lua_State *L);
+
+ // get_attach(self)
+ static int l_get_attach(lua_State *L);
+
+ // get_nametag(self)
+ static int l_get_nametag(lua_State *L);
+
+ // get_textures(self)
+ static int l_get_item_textures(lua_State *L);
+
+ // get_hp(self)
+ static int l_get_max_hp(lua_State *L);
+};