From b729ffc604e350b22ef75e0a6e501315ded37543 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 8 Feb 2019 23:17:20 +0100 Subject: [PATCH] Spawning fire now respects protection --- mods/ITEMS/mcl_fire/fire_charge.lua | 7 +++++++ mods/ITEMS/mcl_fire/flint_and_steel.lua | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/mods/ITEMS/mcl_fire/fire_charge.lua b/mods/ITEMS/mcl_fire/fire_charge.lua index 144d195907..26259e04f4 100644 --- a/mods/ITEMS/mcl_fire/fire_charge.lua +++ b/mods/ITEMS/mcl_fire/fire_charge.lua @@ -15,6 +15,13 @@ minetest.register_craftitem("mcl_fire:fire_charge", { end end + -- Check protection + local protname = user:get_player_name() + if minetest.is_protected(pointed_thing.under, protname) then + minetest.record_protection_violation(pointed_thing.under, protname) + return itemstack + end + -- Ignite/light fire if pointed_thing.type == "node" then local nodedef = minetest.registered_nodes[node.name] diff --git a/mods/ITEMS/mcl_fire/flint_and_steel.lua b/mods/ITEMS/mcl_fire/flint_and_steel.lua index 3b6861f58d..0ab4043f1b 100644 --- a/mods/ITEMS/mcl_fire/flint_and_steel.lua +++ b/mods/ITEMS/mcl_fire/flint_and_steel.lua @@ -15,6 +15,12 @@ minetest.register_tool("mcl_fire:flint_and_steel", { return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack end end + -- Check protection + local protname = user:get_player_name() + if minetest.is_protected(pointed_thing.under, protname) then + minetest.record_protection_violation(pointed_thing.under, protname) + return itemstack + end local idef = itemstack:get_definition() minetest.sound_play( @@ -44,11 +50,13 @@ minetest.register_tool("mcl_fire:flint_and_steel", { end, _dispense_into_walkable = true, _on_dispense = function(stack, pos, droppos, dropnode, dropdir) + -- Ignite air if dropnode.name == "air" then minetest.add_node(droppos, {name="mcl_fire:fire"}) if not minetest.settings:get_bool("creative_mode") then stack:add_wear(65535/65) -- 65 uses end + -- Ignite TNT elseif dropnode.name == "mcl_tnt:tnt" then tnt.ignite(droppos) if not minetest.settings:get_bool("creative_mode") then