1 local function on_flood(pos, oldnode, newnode)
2 minetest.add_item(pos, ItemStack("default:torch 1"))
3 -- Play flame-extinguish sound if liquid is not an 'igniter'
4 local nodedef = minetest.registered_items[newnode.name]
5 if not (nodedef and nodedef.groups and
6 nodedef.groups.igniter and nodedef.groups.igniter > 0) then
9 {pos = pos, max_hear_distance = 16, gain = 0.1}
12 -- Remove the torch node
16 minetest.register_node("default:torch", {
17 description = "Torch",
19 mesh = "torch_floor.obj",
20 inventory_image = "default_torch_on_floor.png",
21 wield_image = "default_torch_on_floor.png",
23 name = "default_torch_on_floor_animated.png",
24 animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
27 paramtype2 = "wallmounted",
28 sunlight_propagates = true,
30 liquids_pointable = false,
32 groups = {choppy=2, dig_immediate=3, flammable=1, attached_node=1, torch=1},
33 drop = "default:torch",
36 wall_bottom = {-1/8, -1/2, -1/8, 1/8, 2/16, 1/8},
38 sounds = default.node_sound_wood_defaults(),
39 on_place = function(itemstack, placer, pointed_thing)
40 local under = pointed_thing.under
41 local node = minetest.get_node(under)
42 local def = minetest.registered_nodes[node.name]
43 if def and def.on_rightclick and
44 not (placer and placer:is_player() and
45 placer:get_player_control().sneak) then
46 return def.on_rightclick(under, node, placer, itemstack,
47 pointed_thing) or itemstack
50 local above = pointed_thing.above
51 local wdir = minetest.dir_to_wallmounted(vector.subtract(under, above))
52 local fakestack = itemstack
54 fakestack:set_name("default:torch_ceiling")
56 fakestack:set_name("default:torch")
58 fakestack:set_name("default:torch_wall")
61 itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir)
62 itemstack:set_name("default:torch")
70 minetest.register_node("default:torch_wall", {
72 mesh = "torch_wall.obj",
74 name = "default_torch_on_floor_animated.png",
75 animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
78 paramtype2 = "wallmounted",
79 sunlight_propagates = true,
82 groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1},
83 drop = "default:torch",
86 wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8},
88 sounds = default.node_sound_wood_defaults(),
93 minetest.register_node("default:torch_ceiling", {
95 mesh = "torch_ceiling.obj",
97 name = "default_torch_on_floor_animated.png",
98 animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
101 paramtype2 = "wallmounted",
102 sunlight_propagates = true,
105 groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1},
106 drop = "default:torch",
108 type = "wallmounted",
109 wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8},
111 sounds = default.node_sound_wood_defaults(),
116 minetest.register_lbm({
117 name = "default:3dtorch",
118 nodenames = {"default:torch", "torches:floor", "torches:wall"},
119 action = function(pos, node)
120 if node.param2 == 0 then
121 minetest.set_node(pos, {name = "default:torch_ceiling",
122 param2 = node.param2})
123 elseif node.param2 == 1 then
124 minetest.set_node(pos, {name = "default:torch",
125 param2 = node.param2})
127 minetest.set_node(pos, {name = "default:torch_wall",
128 param2 = node.param2})