aboutsummaryrefslogtreecommitdiff
path: root/builtin/common
diff options
context:
space:
mode:
authortenplus1 <tenplus1@users.noreply.github.com>2017-09-16 21:39:38 +0100
committerSmallJoker <mk939@ymail.com>2018-06-03 17:31:59 +0200
commitb1fae4c7beb66b4aa63ad04ac6ba9e145b39ca82 (patch)
tree8497c3fb6a810182a2bedabdfd62d60ae7610ea7 /builtin/common
parentc2a0333901a696f7dcb67356aeb0206b89be14e6 (diff)
downloadminetest-b1fae4c7beb66b4aa63ad04ac6ba9e145b39ca82.tar.gz
minetest-b1fae4c7beb66b4aa63ad04ac6ba9e145b39ca82.tar.bz2
minetest-b1fae4c7beb66b4aa63ad04ac6ba9e145b39ca82.zip
Fix Rotate Node Placement (#6424)
This properly checks for creative mode or privilege when using fixed rotate_node() function.
Diffstat (limited to 'builtin/common')
-rw-r--r--builtin/common/misc_helpers.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index 4840dcbaa..1e282f886 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -425,11 +425,15 @@ 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)
core.rotate_and_place(itemstack, placer, pointed_thing,
- core.settings:get_bool("creative_mode"),
+ is_creative(placer:get_player_name()),
{invert_wall = placer:get_player_control().sneak})
return itemstack
end