mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-23 06:32:25 +01:00
Torches: Make liquids drop torches as items
Liquids that are 'igniters', such as lava, will drop the torch without a flame-extinguish sound, as the torch item will burn up after a few seconds with a sound and smoke particles. All other liquids cause a flame-extinguish sound.
This commit is contained in:
parent
57577596d6
commit
3294a2a515
@ -35,6 +35,21 @@ See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt
|
||||
|
||||
--]]
|
||||
|
||||
local function on_flood(pos, oldnode, newnode)
|
||||
minetest.add_item(pos, ItemStack("default:torch 1"))
|
||||
-- Play flame-extinguish sound if liquid is not an 'igniter'
|
||||
local nodedef = minetest.registered_items[newnode.name]
|
||||
if not (nodedef and nodedef.groups and
|
||||
nodedef.groups.igniter and nodedef.groups.igniter > 0) then
|
||||
minetest.sound_play(
|
||||
"default_cool_lava",
|
||||
{pos = pos, max_hear_distance = 16, gain = 0.1}
|
||||
)
|
||||
end
|
||||
-- Remove the torch node
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.register_node("default:torch", {
|
||||
description = "Torch",
|
||||
drawtype = "mesh",
|
||||
@ -83,7 +98,9 @@ minetest.register_node("default:torch", {
|
||||
itemstack:set_name("default:torch")
|
||||
|
||||
return itemstack
|
||||
end
|
||||
end,
|
||||
floodable = true,
|
||||
on_flood = on_flood,
|
||||
})
|
||||
|
||||
minetest.register_node("default:torch_wall", {
|
||||
@ -105,6 +122,8 @@ minetest.register_node("default:torch_wall", {
|
||||
wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8},
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
floodable = true,
|
||||
on_flood = on_flood,
|
||||
})
|
||||
|
||||
minetest.register_node("default:torch_ceiling", {
|
||||
@ -126,6 +145,8 @@ minetest.register_node("default:torch_ceiling", {
|
||||
wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8},
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
floodable = true,
|
||||
on_flood = on_flood,
|
||||
})
|
||||
|
||||
minetest.register_lbm({
|
||||
|
Loading…
Reference in New Issue
Block a user