2 footstep = { "Footstep Sound Node", "soundstuff_node_footstep.png", "Plays sound when you step on it" },
3 dig = { "Dig Sound Node", "soundstuff_node_dig.png", "Plays sound when you dig it" },
4 dug = { "Dug Sound Node", "soundstuff_node_dug.png", "Plays sound when you've dug it" },
5 place = { "Place Sound Node", "soundstuff_node_place.png", "Plays sound when you place it" },
6 place_failed = { "Place Failed Sound Node", "soundstuff_node_place_failed.png", "Plays sound when you try to place it but failed" },
9 for k,v in pairs(simple_nodes) do
10 minetest.register_node("soundstuff:"..k, {
11 description = v[1].."\n"..v[3],
12 tiles = {"soundstuff_node_sound.png","soundstuff_node_sound.png",v[2]},
13 groups = {dig_immediate=2},
15 [k] = { name = "soundstuff_mono", gain = 1.0 },
20 minetest.register_node("soundstuff:place_failed_attached", {
21 description = "Attached Place Failed Sound Node".."\n"..
22 "Attached to the floor; plays a sound when you try to place it but failed",
23 tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_place_failed.png"},
24 groups = {dig_immediate=2, attached_node=1},
27 node_box = { type = "fixed", fixed = {
28 { -7/16, -7/16, -7/16, 7/16, 7/16, 7/16 },
29 { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 },
32 place_failed = { name = "soundstuff_mono", gain = 1.0 },
36 minetest.register_node("soundstuff:fall", {
37 description = "Fall Sound Node".."\n"..
38 "Falls and plays sound if node below is gone",
39 tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"},
40 groups = {dig_immediate=2, falling_node=1},
42 fall = { name = "soundstuff_mono", gain = 1.0 },
46 minetest.register_node("soundstuff:fall_attached", {
47 description = "Attached Fall Sound Node".."\n"..
48 "Drops as item and plays sound if node below is gone",
49 tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"},
50 groups = {dig_immediate=2, attached_node=1},
53 node_box = { type = "fixed", fixed = {
54 { -7/16, -7/16, -7/16, 7/16, 7/16, 7/16 },
55 { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 },
58 fall = { name = "soundstuff_mono", gain = 1.0 },
62 minetest.register_node("soundstuff:footstep_liquid", {
63 description = "Liquid Footstep Sound Node".."\n"..
64 "Plays sound when moving inside it; swimmable",
67 "soundstuff_node_sound.png^[colorize:#0000FF:127^[opacity:190",
70 {name = "soundstuff_node_sound.png^[colorize:#0000FF:127^[opacity:190",
71 backface_culling = false},
72 {name = "soundstuff_node_sound.png^[colorize:#0000FF:127^[opacity:190",
73 backface_culling = true},
75 liquids_pointable = true,
76 liquidtype = "source",
77 liquid_alternative_flowing = "soundstuff:footstep_liquid",
78 liquid_alternative_source = "soundstuff:footstep_liquid",
79 liquid_renewable = false,
82 use_texture_alpha = "blend",
88 is_ground_content = false,
89 post_effect_color = {a = 64, r = 0, g = 0, b = 200},
91 footstep = { name = "soundstuff_mono", gain = 1.0 },
95 minetest.register_node("soundstuff:footstep_climbable", {
96 description = "Climbable Footstep Sound Node".."\n"..
97 "Plays sound when moving inside it; can climb up and down here",
98 drawtype = "allfaces",
100 "soundstuff_node_climbable.png",
103 sunlight_propagates = true,
106 is_ground_content = false,
107 groups = { dig_immediate = 2 },
109 footstep = { name = "soundstuff_mono", gain = 1.0 },
115 minetest.register_craftitem("soundstuff:eat", {
116 description = "Eat Sound Item".."\n"..
117 "Makes a sound when 'eaten' (with punch key)",
118 inventory_image = "soundstuff_eat.png",
119 on_use = minetest.item_eat(0),
121 eat = { name = "soundstuff_mono", gain = 1.0 },
125 minetest.register_tool("soundstuff:breaks", {
126 description = "Break Sound Tool".."\n"..
127 "Digs cracky=3 and more".."\n"..
128 "Makes a sound when it breaks",
129 inventory_image = "soundstuff_node_dug.png",
131 breaks = { name = "soundstuff_mono", gain = 1.0 },
133 tool_capabilities = {
136 cracky={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0},
137 choppy={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0},
138 snappy={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0},
139 crumbly={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0},
145 minetest.register_tool("soundstuff:punch_use", {
146 description = "Punch Use Sound Tool\n"..
147 "Digs cracky=3 and more\n"..
148 "Makes a sound when used on node or entity",
149 inventory_image = "soundstuff_node_dig.png",
151 punch_use = { name = "soundstuff_mono", gain = 1.0 },
153 tool_capabilities = {
156 cracky={times={[2]=2.00, [3]=1.20}, uses=0, maxlevel=0},
157 choppy={times={[2]=2.00, [3]=1.20}, uses=0, maxlevel=0},
158 snappy={times={[2]=2.00, [3]=1.20}, uses=0, maxlevel=0},
159 crumbly={times={[2]=2.00, [3]=1.20}, uses=0, maxlevel=0},
164 minetest.register_tool("soundstuff:punch_use_air", {
165 description = "Punch Use (Air) Sound Tool\n"..
166 "Makes a sound when used pointing at nothing",
167 inventory_image = "soundstuff_node_dig.png",
169 punch_use_air = { name = "soundstuff_mono", gain = 1.0 },
173 -- Plays sound repeatedly
174 minetest.register_node("soundstuff:positional", {
175 description = "Positional Sound Node".."\n"..
176 "Repeatedly plays a sound at the node location",
177 on_construct = function(pos)
178 local timer = minetest.get_node_timer(pos)
181 on_timer = function(pos, elapsed)
182 local node = minetest.get_node(pos)
183 local dist = node.param2
187 minetest.sound_play("soundstuff_mono", { pos = pos, max_hear_distance = dist })
188 local timer = minetest.get_node_timer(pos)
191 on_rightclick = function(pos, node, clicker)
192 node.param2 = (node.param2 + 1) % 64
193 minetest.set_node(pos, node)
194 if clicker and clicker:is_player() then
195 local dist = node.param2
198 diststr = "<default>"
200 diststr = tostring(dist)
202 minetest.chat_send_player(clicker:get_player_name(), "max_hear_distance = " .. diststr)
206 groups = { dig_immediate = 2 },
207 tiles = { "soundstuff_node_sound.png" },