Skip to content

Commit 41bc0ef

Browse files
sofarparamat
authored andcommittedNov 14, 2017
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.
1 parent 5b7687c commit 41bc0ef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

Diff for: ‎builtin/game/falling.lua

+5-1
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,16 @@ core.register_entity(":__builtin:falling_node", {
104104
end
105105
end
106106
-- Create node and remove entity
107-
if core.registered_nodes[self.node.name] then
107+
local def = core.registered_nodes[self.node.name]
108+
if def then
108109
core.add_node(np, self.node)
109110
if self.meta then
110111
local meta = core.get_meta(np)
111112
meta:from_table(self.meta)
112113
end
114+
if def.sounds and def.sounds.place and def.sounds.place.name then
115+
core.sound_play(def.sounds.place, {pos = np})
116+
end
113117
end
114118
self.object:remove()
115119
core.check_for_falling(np)

0 commit comments

Comments
 (0)
Please sign in to comment.