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 return
end end
-- Destroy item in lava or special nodes -- Destroy item in lava, fire or special nodes
local nn = node.name local nn = node.name
local def = minetest.registered_nodes[nn] local def = minetest.registered_nodes[nn]
if (def and def.groups and (def.groups.lava or def.groups.destroys_items == 1)) then local lg = minetest.get_item_group(nn, "lava")
-- Special effect for lava local fg = minetest.get_item_group(nn, "fire")
if def.groups.lava then 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}) minetest.sound_play("builtin_item_lava", {pos = self.object:get_pos(), gain = 0.5})
end end
self._removed = true self._removed = true

View file

@ -35,7 +35,7 @@ minetest.register_node("mcl_fire:fire", {
buildable_to = true, buildable_to = true,
sunlight_propagates = true, sunlight_propagates = true,
damage_per_second = 1, 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, floodable = true,
on_flood = function(pos, oldnode, newnode) on_flood = function(pos, oldnode, newnode)
if minetest.get_item_group(newnode.name, "water") ~= 0 then if minetest.get_item_group(newnode.name, "water") ~= 0 then
@ -114,7 +114,7 @@ minetest.register_node("mcl_fire:eternal_fire", {
buildable_to = true, buildable_to = true,
sunlight_propagates = true, sunlight_propagates = true,
damage_per_second = 1, 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, floodable = true,
on_flood = function(pos, oldnode, newnode) on_flood = function(pos, oldnode, newnode)
if minetest.get_item_group(newnode.name, "water") ~= 0 then if minetest.get_item_group(newnode.name, "water") ~= 0 then