From 48f9316410825870b51183697a16e64d1112b943 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Sun, 5 Feb 2017 13:52:02 -0700 Subject: [PATCH] add checking for protection bypass priv, remove a redundant texture --- ladder.lua | 7 +++++-- ropeboxes.lua | 9 ++++++--- textures/ropes_rope_top.png | Bin 133 -> 0 bytes 3 files changed, 11 insertions(+), 5 deletions(-) delete mode 100644 textures/ropes_rope_top.png diff --git a/ladder.lua b/ladder.lua index 016f0d0..7b8515a 100644 --- a/ladder.lua +++ b/ladder.lua @@ -32,7 +32,9 @@ minetest.register_node("ropes:ropeladder_top", { local this_node = minetest.get_node(pos) local placer_name = placer:get_player_name() -- param2 holds the facing direction of this node. If it's 0 or 1 the node is "flat" and we don't want the ladder to extend. - if node_below.name == "air" and this_node.param2 > 1 and not minetest.is_protected(pos_below, placer_name) then + if node_below.name == "air" and this_node.param2 > 1 + and (not minetest.is_protected(pos_below, placer_name) + or minetest.check_player_privs(placer_name, "protection_bypass")) then minetest.add_node(pos_below, {name="ropes:ropeladder_bottom", param2=this_node.param2}) local meta = minetest.get_meta(pos_below) meta:set_int("length_remaining", ropes.ropeLadderLength) @@ -108,7 +110,8 @@ minetest.register_node("ropes:ropeladder_bottom", { local newpos = {x=pos.x, y=pos.y-1, z=pos.z} local newnode = minetest.get_node(newpos) local oldnode = minetest.get_node(pos) - if currentlength > 1 and not minetest.is_protected(newpos, placer_name) then + if currentlength > 1 and (not minetest.is_protected(newpos, placer_name) + or minetest.check_player_privs(placer_name, "protection_bypass")) then if newnode.name == "air" then minetest.add_node(newpos, {name="ropes:ropeladder_bottom", param2=oldnode.param2}) local newmeta = minetest.get_meta(newpos) diff --git a/ropeboxes.lua b/ropeboxes.lua index ef5249e..392ce06 100644 --- a/ropeboxes.lua +++ b/ropeboxes.lua @@ -37,7 +37,7 @@ local function register_rope_block(multiple, pixels) local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} local placer_name = placer:get_player_name() - if minetest.is_protected(pos_below, placer_name) then + if minetest.is_protected(pos_below, placer_name) and not minetest.check_player_privs(placer, "protection_bypass") then return end @@ -139,7 +139,10 @@ minetest.register_node("ropes:rope_bottom", { local placer_name = currentmeta:get_string("placer") local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} local node_below = minetest.get_node(pos_below) - if node_below.name == "air" and (currentlength > 1) and not minetest.is_protected(pos_below, placer_name) then + if node_below.name == "air" + and (currentlength > 1) + and (not minetest.is_protected(pos_below, placer_name) or + minetest.check_player_privs(placer_name, "protection_bypass")) then minetest.add_node(pos_below, {name="ropes:rope_bottom"}) local newmeta = minetest.get_meta(pos_below) newmeta:set_int("length_remaining", currentlength-1) @@ -164,7 +167,7 @@ minetest.register_node("ropes:rope_top", { sunlight_propagates = true, paramtype = "light", drop = "", - tiles = { "ropes_rope_top.png" }, + tiles = { "ropes_rope_bottom.png^[transformR180" }, drawtype = "plantlike", groups = {not_in_creative_inventory=1}, sounds = default.node_sound_leaves_defaults(), diff --git a/textures/ropes_rope_top.png b/textures/ropes_rope_top.png deleted file mode 100644 index 8964e9654974b80e741805c3891eed5245ffc220..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 133 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-u0R?H0z7RUtPEuJ-3)*n z#*!evU`0#KL*c+9YG3_kB%^8 WL~|~fd;XU!$TUw^KbLh*2~7aynju&K