Destroy items in fire

This commit is contained in:
Wuzzy 2019-02-01 08:31:17 +01:00
parent 29040f9352
commit 0586c0ea18
2 changed files with 8 additions and 6 deletions

View File

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

View File

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