From 0586c0ea18333902ea3a42b699ca58faacc9fe00 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 1 Feb 2019 08:31:17 +0100 Subject: [PATCH] Destroy items in fire --- mods/ENTITIES/mcl_item_entity/init.lua | 10 ++++++---- mods/ITEMS/mcl_fire/init.lua | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 63bb07b602..d1c502fcef 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -524,12 +524,14 @@ core.register_entity(":__builtin:item", { return end - -- Destroy item in lava or special nodes + -- Destroy item in lava, fire or special nodes local nn = node.name local def = minetest.registered_nodes[nn] - if (def and def.groups and (def.groups.lava or def.groups.destroys_items == 1)) then - -- Special effect for lava - if def.groups.lava then + local lg = minetest.get_item_group(nn, "lava") + local fg = minetest.get_item_group(nn, "fire") + local dg = minetest.get_item_group(nn, "destroys_items") + if (def and (lg ~= 0 or fg ~= 0 or dg == 1)) then + if dg ~= 2 then minetest.sound_play("builtin_item_lava", {pos = self.object:get_pos(), gain = 0.5}) end self._removed = true diff --git a/mods/ITEMS/mcl_fire/init.lua b/mods/ITEMS/mcl_fire/init.lua index c8c12ea365..665b13deba 100644 --- a/mods/ITEMS/mcl_fire/init.lua +++ b/mods/ITEMS/mcl_fire/init.lua @@ -35,7 +35,7 @@ minetest.register_node("mcl_fire:fire", { buildable_to = true, sunlight_propagates = true, damage_per_second = 1, - groups = {fire = 1, dig_immediate = 3, not_in_creative_inventory = 1, dig_by_piston=1}, + groups = {fire = 1, dig_immediate = 3, not_in_creative_inventory = 1, dig_by_piston=1, destroys_items=1 }, floodable = true, on_flood = function(pos, oldnode, newnode) if minetest.get_item_group(newnode.name, "water") ~= 0 then @@ -114,7 +114,7 @@ minetest.register_node("mcl_fire:eternal_fire", { buildable_to = true, sunlight_propagates = true, damage_per_second = 1, - groups = {fire = 1, dig_immediate = 3, not_in_creative_inventory = 1, dig_by_piston = 1}, + groups = {fire = 1, dig_immediate = 3, not_in_creative_inventory = 1, dig_by_piston = 1, destroys_items = 1}, floodable = true, on_flood = function(pos, oldnode, newnode) if minetest.get_item_group(newnode.name, "water") ~= 0 then