diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-07-18 13:53:15 +0200 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-07-18 13:53:15 +0200 |
commit | ffe3c2ae0db6fed0f2b08b71bfa69f3d3df3bb1f (patch) | |
tree | cc7d9f74a43215c5d8e3965a2bfc2aea5867a7a0 /builtin/common/misc_helpers.lua | |
parent | 45aa2516b2fc675df7049bc9ed713600c95b6423 (diff) | |
parent | 82731d0d3d8bfe9e56f89466991f13c037f3a61e (diff) | |
download | dragonfireclient-ffe3c2ae0db6fed0f2b08b71bfa69f3d3df3bb1f.tar.xz |
Update to minetest 5.4.0-dev
Diffstat (limited to 'builtin/common/misc_helpers.lua')
-rw-r--r-- | builtin/common/misc_helpers.lua | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index c904bccfc..bd27a01dc 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -20,6 +20,8 @@ local function basic_dump(o) -- dump's output is intended for humans. --elseif tp == "function" then -- return string.format("loadstring(%q)", string.dump(o)) + elseif tp == "userdata" then + return tostring(o) else return string.format("<%s>", tp) end @@ -290,7 +292,8 @@ if INIT == "game" then return end local undef = core.registered_nodes[unode.name] - if undef and undef.on_rightclick then + local sneaking = placer and placer:get_player_control().sneak + if undef and undef.on_rightclick and not sneaking then return undef.on_rightclick(pointed_thing.under, unode, placer, itemstack, pointed_thing) end @@ -344,18 +347,12 @@ if INIT == "game" then --Wrapper for rotate_and_place() to check for sneak and assume Creative mode --implies infinite stacks when performing a 6d rotation. -------------------------------------------------------------------------------- - local creative_mode_cache = core.settings:get_bool("creative_mode") - local function is_creative(name) - return creative_mode_cache or - core.check_player_privs(name, {creative = true}) - end - core.rotate_node = function(itemstack, placer, pointed_thing) local name = placer and placer:get_player_name() or "" local invert_wall = placer and placer:get_player_control().sneak or false return core.rotate_and_place(itemstack, placer, pointed_thing, - is_creative(name), - {invert_wall = invert_wall}, true) + core.is_creative_enabled(name), + {invert_wall = invert_wall}, true) end end |