Fix Rotate Node Placement (#6424)
authortenplus1 <tenplus1@users.noreply.github.com>
Sat, 16 Sep 2017 20:39:38 +0000 (21:39 +0100)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Sat, 16 Sep 2017 20:39:38 +0000 (22:39 +0200)
This properly checks for creative mode or privilege when using fixed rotate_node() function.

builtin/common/misc_helpers.lua

index 87561726e7e1776bcef0e38074d4d4e80675d8e8..31d335fe287cad9c0a9cc434b1febeefb69529e9 100644 (file)
@@ -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