aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorDS <vorunbekannt75@web.de>2019-03-05 08:17:48 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2019-03-05 08:17:48 +0100
commit60ab2d94f07953e74fc98a33d468328c2adac75b (patch)
tree6174d405b25768f467e3bb4d6e0b036842c63201 /builtin
parentee698770b98145bbb39f8671f8586e835b2e9ab4 (diff)
downloadminetest-60ab2d94f07953e74fc98a33d468328c2adac75b.tar.gz
minetest-60ab2d94f07953e74fc98a33d468328c2adac75b.tar.bz2
minetest-60ab2d94f07953e74fc98a33d468328c2adac75b.zip
Add sounds for falling and attached nodes (#7719)
* Add sounds for falling and attached nodes The sound specified in `node_definition.sounds.fall` is used. When a falling node is spawned at a position or an attached node drops, the sound is played at this position. * allow all sorts of soundspecs
Diffstat (limited to 'builtin')
-rw-r--r--builtin/game/falling.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua
index 62b6973a7..df213e304 100644
--- a/builtin/game/falling.lua
+++ b/builtin/game/falling.lua
@@ -116,7 +116,7 @@ core.register_entity(":__builtin:falling_node", {
local meta = core.get_meta(np)
meta:from_table(self.meta)
end
- if def.sounds and def.sounds.place and def.sounds.place.name then
+ if def.sounds and def.sounds.place then
core.sound_play(def.sounds.place, {pos = np})
end
end
@@ -141,6 +141,11 @@ local function convert_to_falling_node(pos, node)
local meta = core.get_meta(pos)
local metatable = meta and meta:to_table() or {}
+ local def = core.registered_nodes[node.name]
+ if def and def.sounds and def.sounds.fall then
+ core.sound_play(def.sounds.fall, {pos = pos})
+ end
+
obj:get_luaentity():set_node(node, metatable)
core.remove_node(pos)
return true
@@ -170,6 +175,9 @@ local function drop_attached_node(p)
drops = drop_stacks
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
end
+ if def and def.sounds and def.sounds.fall then
+ core.sound_play(def.sounds.fall, {pos = p})
+ end
core.remove_node(p)
for _, item in pairs(drops) do
local pos = {