diff options
author | paramat <mat.gregory@virginmedia.com> | 2017-04-05 12:18:22 +0100 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2017-04-17 10:13:05 +0100 |
commit | f6da7b3fda5bbb793c7795a228ea6f2602b93fbe (patch) | |
tree | ca2bd50fdf29414cbee58576786170928676b8a5 /src/script | |
parent | 907be0ab918a99c30c37c4abfe3e11722691f3bc (diff) | |
download | minetest-f6da7b3fda5bbb793c7795a228ea6f2602b93fbe.tar.gz minetest-f6da7b3fda5bbb793c7795a228ea6f2602b93fbe.tar.bz2 minetest-f6da7b3fda5bbb793c7795a228ea6f2602b93fbe.zip |
Sneak: Add option for old move code
Temporary option for the old move code for specific old sneak behaviour.
Enabled by setting the added 'new move' physics override to false.
By default 'new move' is true.
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/lua_api/l_object.cpp | 21 | ||||
-rw-r--r-- | src/script/lua_api/l_object.h | 2 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 0699705cb..95e977f9e 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -401,7 +401,7 @@ int ObjectRef::l_get_armor_groups(lua_State *L) } // set_physics_override(self, physics_override_speed, physics_override_jump, -// physics_override_gravity, sneak, sneak_glitch) +// physics_override_gravity, sneak, sneak_glitch, new_move) int ObjectRef::l_set_physics_override(lua_State *L) { NO_MAP_LOCK_REQUIRED; @@ -410,11 +410,18 @@ int ObjectRef::l_set_physics_override(lua_State *L) if (co == NULL) return 0; // Do it if (lua_istable(L, 2)) { - co->m_physics_override_speed = getfloatfield_default(L, 2, "speed", co->m_physics_override_speed); - co->m_physics_override_jump = getfloatfield_default(L, 2, "jump", co->m_physics_override_jump); - co->m_physics_override_gravity = getfloatfield_default(L, 2, "gravity", co->m_physics_override_gravity); - co->m_physics_override_sneak = getboolfield_default(L, 2, "sneak", co->m_physics_override_sneak); - co->m_physics_override_sneak_glitch = getboolfield_default(L, 2, "sneak_glitch", co->m_physics_override_sneak_glitch); + co->m_physics_override_speed = getfloatfield_default( + L, 2, "speed", co->m_physics_override_speed); + co->m_physics_override_jump = getfloatfield_default( + L, 2, "jump", co->m_physics_override_jump); + co->m_physics_override_gravity = getfloatfield_default( + L, 2, "gravity", co->m_physics_override_gravity); + co->m_physics_override_sneak = getboolfield_default( + L, 2, "sneak", co->m_physics_override_sneak); + co->m_physics_override_sneak_glitch = getboolfield_default( + L, 2, "sneak_glitch", co->m_physics_override_sneak_glitch); + co->m_physics_override_new_move = getboolfield_default( + L, 2, "new_move", co->m_physics_override_new_move); co->m_physics_override_sent = false; } else { // old, non-table format @@ -454,6 +461,8 @@ int ObjectRef::l_get_physics_override(lua_State *L) lua_setfield(L, -2, "sneak"); lua_pushboolean(L, co->m_physics_override_sneak_glitch); lua_setfield(L, -2, "sneak_glitch"); + lua_pushboolean(L, co->m_physics_override_new_move); + lua_setfield(L, -2, "new_move"); return 1; } diff --git a/src/script/lua_api/l_object.h b/src/script/lua_api/l_object.h index b6fc35bc2..98f5c2b11 100644 --- a/src/script/lua_api/l_object.h +++ b/src/script/lua_api/l_object.h @@ -105,7 +105,7 @@ private: static int l_get_armor_groups(lua_State *L); // set_physics_override(self, physics_override_speed, physics_override_jump, - // physics_override_gravity, sneak, sneak_glitch) + // physics_override_gravity, sneak, sneak_glitch, new_move) static int l_set_physics_override(lua_State *L); // get_physics_override(self) |