diff options
author | ANAND <ClobberXD@protonmail.com> | 2020-06-05 18:36:35 +0530 |
---|---|---|
committer | celeron55 <celeron55@gmail.com> | 2020-08-15 12:19:20 +0300 |
commit | 291a6b70d674d9003f522b5875a60f7e2753e32b (patch) | |
tree | eb4368dfc8d0055b53bd1160b5a8836726245ffb /src/script | |
parent | fff03931871b68e092e12bfce9056f760e8ec9dd (diff) | |
download | minetest-291a6b70d674d9003f522b5875a60f7e2753e32b.tar.gz minetest-291a6b70d674d9003f522b5875a60f7e2753e32b.tar.bz2 minetest-291a6b70d674d9003f522b5875a60f7e2753e32b.zip |
Allow binding dig, place actions to keys; remove LMB/RMB hardcoding
Co-authored-by: Sam Caulfield <sam@samcaulfield.com>
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/lua_api/l_localplayer.cpp | 4 | ||||
-rw-r--r-- | src/script/lua_api/l_object.cpp | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/script/lua_api/l_localplayer.cpp b/src/script/lua_api/l_localplayer.cpp index 851ede535..33fa27c8b 100644 --- a/src/script/lua_api/l_localplayer.cpp +++ b/src/script/lua_api/l_localplayer.cpp @@ -231,8 +231,8 @@ int LuaLocalPlayer::l_get_control(lua_State *L) set("aux1", c.aux1); set("sneak", c.sneak); set("zoom", c.zoom); - set("LMB", c.LMB); - set("RMB", c.RMB); + set("dig", c.dig); + set("place", c.place); return 1; } diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index e7394133a..495d8bced 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -1455,9 +1455,14 @@ int ObjectRef::l_get_player_control(lua_State *L) lua_setfield(L, -2, "aux1"); lua_pushboolean(L, control.sneak); lua_setfield(L, -2, "sneak"); - lua_pushboolean(L, control.LMB); + lua_pushboolean(L, control.dig); + lua_setfield(L, -2, "dig"); + lua_pushboolean(L, control.place); + lua_setfield(L, -2, "place"); + // Legacy fields to ensure mod compatibility + lua_pushboolean(L, control.dig); lua_setfield(L, -2, "LMB"); - lua_pushboolean(L, control.RMB); + lua_pushboolean(L, control.place); lua_setfield(L, -2, "RMB"); lua_pushboolean(L, control.zoom); lua_setfield(L, -2, "zoom"); |