mirror of
https://github.com/minetest/minetest.git
synced 2024-12-24 15:12:23 +01:00
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.
This commit is contained in:
parent
5b7687c08c
commit
41bc0efe71
@ -104,12 +104,16 @@ core.register_entity(":__builtin:falling_node", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Create node and remove entity
|
-- 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)
|
core.add_node(np, self.node)
|
||||||
if self.meta then
|
if self.meta then
|
||||||
local meta = core.get_meta(np)
|
local meta = core.get_meta(np)
|
||||||
meta:from_table(self.meta)
|
meta:from_table(self.meta)
|
||||||
end
|
end
|
||||||
|
if def.sounds and def.sounds.place and def.sounds.place.name then
|
||||||
|
core.sound_play(def.sounds.place, {pos = np})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
core.check_for_falling(np)
|
core.check_for_falling(np)
|
||||||
|
Loading…
Reference in New Issue
Block a user