0
0
Fork 0

Fix weird arguments given to is_protected

This commit is contained in:
Wuzzy 2019-02-11 21:27:17 +01:00
parent dee5f3bda6
commit aa3739528b
6 changed files with 31 additions and 10 deletions

View File

@ -652,7 +652,11 @@ minetest.register_node("mcl_core:bedrock", {
local dim = mcl_worlds.pos_to_dimension(pos)
local flame_pos = {x = pos.x, y = pos.y + 1, z = pos.z}
local fn = minetest.get_node(flame_pos)
if dim == "end" and fn.name == "air" and not minetest.is_protected(flame_pos, "fire") and pointed_thing.under.y < pointed_thing.above.y then
local pname = player:get_player_name()
if minetest.is_protected(flame_pos, pname) then
return minetest.record_protection_violation(flame_pos, pname)
end
if dim == "end" and fn.name == "air" and pointed_thing.under.y < pointed_thing.above.y then
minetest.set_node(flame_pos, {name = "mcl_fire:eternal_fire"})
return true
else

View File

@ -28,10 +28,10 @@ minetest.register_craftitem("mcl_fire:fire_charge", {
if nodedef and nodedef._on_ignite then
local overwrite = nodedef._on_ignite(user, pointed_thing)
if not overwrite then
mcl_fire.set_fire(pointed_thing)
mcl_fire.set_fire(pointed_thing, user)
end
else
mcl_fire.set_fire(pointed_thing)
mcl_fire.set_fire(pointed_thing, user)
end
if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item()

View File

@ -33,10 +33,10 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
if nodedef and nodedef._on_ignite then
local overwrite = nodedef._on_ignite(user, pointed_thing)
if not overwrite then
mcl_fire.set_fire(pointed_thing)
mcl_fire.set_fire(pointed_thing, user)
end
else
mcl_fire.set_fire(pointed_thing)
mcl_fire.set_fire(pointed_thing, user)
end
used = true
end

View File

@ -393,10 +393,22 @@ else -- Fire enabled
end
-- Set pointed_thing on (normal) fire
mcl_fire.set_fire = function(pointed_thing)
-- Set pointed_thing on (normal) fire.
-- * pointed_thing: Pointed thing to ignite
-- * player: Player who sets fire or nil if nobody
mcl_fire.set_fire = function(pointed_thing, player)
local pname
if player == nil then
pname = ""
else
pname = player:get_player_name()
end
local n = minetest.get_node(pointed_thing.above)
if n.name == "air" and not minetest.is_protected(pointed_thing.above, "fire") then
if minetest.is_protected(pointed_thing.above, pname) then
minetest.record_protection_violation(pointed_thing.above, pname)
return
end
if n.name == "air" then
minetest.add_node(pointed_thing.above, {name="mcl_fire:fire"})
end
end

View File

@ -46,7 +46,12 @@ local eternal_on_ignite = function(player, pointed_thing)
local pos = pointed_thing.under
local flame_pos = {x = pos.x, y = pos.y + 1, z = pos.z}
local fn = minetest.get_node(flame_pos)
if fn.name == "air" and not minetest.is_protected(flame_pos, "fire") and pointed_thing.under.y < pointed_thing.above.y then
local pname = player:get_player_name()
if minetest.is_protected(flame_pos, pname) then
minetest.record_protection_violation(flame_pos, pname)
return
end
if fn.name == "air" and pointed_thing.under.y < pointed_thing.above.y then
minetest.set_node(flame_pos, {name = "mcl_fire:eternal_fire"})
return true
else

View File

@ -204,7 +204,7 @@ tnt.boom = function(pos, info)
end
minetest.sound_play(sound, {pos = pos,gain = 1.0,max_hear_distance = 16,})
local node = minetest.get_node(pos)
if minetest.get_item_group("water") == 1 or minetest.get_item_group("lava") == 1 or minetest.is_protected(pos, "tnt") then
if minetest.get_item_group("water") == 1 or minetest.get_item_group("lava") == 1 then
-- Cancel the Explosion
return
end