From b56ead7a2337a06e9503e40f051766d9a733e46a Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 24 Mar 2020 19:53:08 +0100 Subject: [PATCH] Don't allow to set fire on fire --- mods/ITEMS/mcl_fire/fire_charge.lua | 4 ++-- mods/ITEMS/mcl_fire/flint_and_steel.lua | 4 ++-- mods/ITEMS/mcl_fire/init.lua | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_fire/fire_charge.lua b/mods/ITEMS/mcl_fire/fire_charge.lua index fbf75f18a..9f4f6bc0f 100644 --- a/mods/ITEMS/mcl_fire/fire_charge.lua +++ b/mods/ITEMS/mcl_fire/fire_charge.lua @@ -31,10 +31,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, user) + mcl_fire.set_fire(pointed_thing, user, false) end else - mcl_fire.set_fire(pointed_thing, user) + mcl_fire.set_fire(pointed_thing, user, false) end if not minetest.settings:get_bool("creative_mode") then itemstack:take_item() diff --git a/mods/ITEMS/mcl_fire/flint_and_steel.lua b/mods/ITEMS/mcl_fire/flint_and_steel.lua index c5b1290b2..bb8c6ce73 100644 --- a/mods/ITEMS/mcl_fire/flint_and_steel.lua +++ b/mods/ITEMS/mcl_fire/flint_and_steel.lua @@ -36,10 +36,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, user) + mcl_fire.set_fire(pointed_thing, user, false) end else - mcl_fire.set_fire(pointed_thing, user) + mcl_fire.set_fire(pointed_thing, user, false) end used = true end diff --git a/mods/ITEMS/mcl_fire/init.lua b/mods/ITEMS/mcl_fire/init.lua index ca61d9a43..ff7b79026 100644 --- a/mods/ITEMS/mcl_fire/init.lua +++ b/mods/ITEMS/mcl_fire/init.lua @@ -395,7 +395,8 @@ end -- 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) +-- * allow_on_fire: If false, can't ignite fire on fire (default: true) +mcl_fire.set_fire = function(pointed_thing, player, allow_on_fire) local pname if player == nil then pname = "" @@ -403,6 +404,10 @@ mcl_fire.set_fire = function(pointed_thing, player) pname = player:get_player_name() end local n = minetest.get_node(pointed_thing.above) + local nu = minetest.get_node(pointed_thing.under) + if allow_on_fire == false and minetest.get_item_group(nu.name, "fire") ~= 0 then + return + end if minetest.is_protected(pointed_thing.above, pname) then minetest.record_protection_violation(pointed_thing.above, pname) return