add checking for protection bypass priv, remove a redundant texture

This commit is contained in:
FaceDeer 2017-02-05 13:52:02 -07:00
parent 0e8057ecda
commit 48f9316410
3 changed files with 11 additions and 5 deletions

@ -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)

@ -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(),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 B