aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_localplayer.cpp
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_localplayer.cpp
parentc1aea404b862256e6bf9316eeb8f32c72b78a4c2 (diff)
downloaddragonfireclient-28a560684b9b9048f8436583805f3f733d7ce829.tar.xz
Added the API additions from waspsaliva
Diffstat (limited to 'src/script/lua_api/l_localplayer.cpp')
-rw-r--r--src/script/lua_api/l_localplayer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/script/lua_api/l_localplayer.cpp b/src/script/lua_api/l_localplayer.cpp
index 8e743c3ab..8057802a4 100644
--- a/src/script/lua_api/l_localplayer.cpp
+++ b/src/script/lua_api/l_localplayer.cpp
@@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "l_clientobject.h"
#include "l_localplayer.h"
#include "l_internal.h"
#include "lua_api/l_item.h"
@@ -452,6 +453,17 @@ int LuaLocalPlayer::l_hud_get(lua_State *L)
return 1;
}
+int LuaLocalPlayer::l_get_object(lua_State *L)
+{
+ LocalPlayer *player = getobject(L, 1);
+ ClientEnvironment &env = getClient(L)->getEnv();
+ ClientActiveObject *obj = env.getGenericCAO(player->getCAO()->getId());
+
+ ClientObjectRef::create(L, obj);
+
+ return 1;
+}
+
LuaLocalPlayer *LuaLocalPlayer::checkobject(lua_State *L, int narg)
{
luaL_checktype(L, narg, LUA_TUSERDATA);
@@ -546,6 +558,7 @@ const luaL_Reg LuaLocalPlayer::methods[] = {
luamethod(LuaLocalPlayer, hud_remove),
luamethod(LuaLocalPlayer, hud_change),
luamethod(LuaLocalPlayer, hud_get),
+ luamethod(LuaLocalPlayer, get_object),
{0, 0}
};