summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuke Kok <sofar@foo-projects.org>2017-11-08 22:40:59 -0800
committerparamat <mat.gregory@virginmedia.com>2017-11-14 00:37:31 +0000
commit41bc0efe717b0543fe5988018a43ca2fffc52c9d (patch)
tree52f023848343793a1979e542ec16701bf99bad39
parent5b7687c08c02dc79a9307cd6917ee2c9981117d4 (diff)
downloadminetest-41bc0efe717b0543fe5988018a43ca2fffc52c9d.tar.gz
minetest-41bc0efe717b0543fe5988018a43ca2fffc52c9d.tar.bz2
minetest-41bc0efe717b0543fe5988018a43ca2fffc52c9d.zip
Sounds: Add falling node sounds
Falling nodes should make a sound. This can only be done here, so for simplicity we just call the sound_play() here with the node place sound. We ignore any gain value in the sound spec since a falling node should be loud, so the 1.0 default gain makes sense here.
-rw-r--r--builtin/game/falling.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua
index a553400f0..1876cf2a8 100644
--- a/builtin/game/falling.lua
+++ b/builtin/game/falling.lua
@@ -104,12 +104,16 @@ core.register_entity(":__builtin:falling_node", {
end
end
-- Create node and remove entity
- if core.registered_nodes[self.node.name] then
+ local def = core.registered_nodes[self.node.name]
+ if def then
core.add_node(np, self.node)
if self.meta then
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
+ core.sound_play(def.sounds.place, {pos = np})
+ end
end
self.object:remove()
core.check_for_falling(np)