aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_localplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api/l_localplayer.cpp')
-rw-r--r--src/script/lua_api/l_localplayer.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/script/lua_api/l_localplayer.cpp b/src/script/lua_api/l_localplayer.cpp
index 821b1cb66..3538c4fe4 100644
--- a/src/script/lua_api/l_localplayer.cpp
+++ b/src/script/lua_api/l_localplayer.cpp
@@ -217,6 +217,15 @@ int LuaLocalPlayer::l_get_pos(lua_State *L)
return 1;
}
+int LuaLocalPlayer::l_set_pos(lua_State *L)
+{
+ LocalPlayer *player = getobject(L, 1);
+
+ v3f pos = checkFloatPos(L, 2);
+ player->setPosition(pos);
+ return 0;
+}
+
int LuaLocalPlayer::l_get_movement_acceleration(lua_State *L)
{
LocalPlayer *player = getobject(L, 1);
@@ -423,6 +432,7 @@ const luaL_Reg LuaLocalPlayer::methods[] = {
luamethod(LuaLocalPlayer, get_key_pressed),
luamethod(LuaLocalPlayer, get_breath),
luamethod(LuaLocalPlayer, get_pos),
+ luamethod(LuaLocalPlayer, set_pos),
luamethod(LuaLocalPlayer, get_movement_acceleration),
luamethod(LuaLocalPlayer, get_movement_speed),
luamethod(LuaLocalPlayer, get_movement),