Convert sound_play uses in builtin to ephemeral

This commit is contained in:
sfan5 2020-01-25 21:57:29 +01:00
parent c10e188594
commit 7d29611c1b
2 changed files with 11 additions and 5 deletions

@ -128,7 +128,7 @@ core.register_entity(":__builtin:falling_node", {
meta:from_table(self.meta) meta:from_table(self.meta)
end end
if def.sounds and def.sounds.place then if def.sounds and def.sounds.place then
core.sound_play(def.sounds.place, {pos = np}) core.sound_play(def.sounds.place, {pos = np}, true)
end end
end end
self.object:remove() self.object:remove()
@ -154,7 +154,7 @@ local function convert_to_falling_node(pos, node)
local def = core.registered_nodes[node.name] local def = core.registered_nodes[node.name]
if def and def.sounds and def.sounds.fall then if def and def.sounds and def.sounds.fall then
core.sound_play(def.sounds.fall, {pos = pos}) core.sound_play(def.sounds.fall, {pos = pos}, true)
end end
obj:get_luaentity():set_node(node, metatable) obj:get_luaentity():set_node(node, metatable)
@ -187,7 +187,7 @@ local function drop_attached_node(p)
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops) def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
end end
if def and def.sounds and def.sounds.fall then if def and def.sounds and def.sounds.fall then
core.sound_play(def.sounds.fall, {pos = p}) core.sound_play(def.sounds.fall, {pos = p}, true)
end end
core.remove_node(p) core.remove_node(p)
for _, item in pairs(drops) do for _, item in pairs(drops) do

@ -475,7 +475,10 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
user:set_hp(user:get_hp() + hp_change) user:set_hp(user:get_hp() + hp_change)
if def and def.sound and def.sound.eat then if def and def.sound and def.sound.eat then
minetest.sound_play(def.sound.eat, { pos = user:get_pos(), max_hear_distance = 16 }) core.sound_play(def.sound.eat, {
pos = user:get_pos(),
max_hear_distance = 16
}, true)
end end
if replace_with_item then if replace_with_item then
@ -582,7 +585,10 @@ function core.node_dig(pos, node, digger)
if not core.settings:get_bool("creative_mode") then if not core.settings:get_bool("creative_mode") then
wielded:add_wear(dp.wear) wielded:add_wear(dp.wear)
if wielded:get_count() == 0 and wdef.sound and wdef.sound.breaks then if wielded:get_count() == 0 and wdef.sound and wdef.sound.breaks then
core.sound_play(wdef.sound.breaks, {pos = pos, gain = 0.5}) core.sound_play(wdef.sound.breaks, {
pos = pos,
gain = 0.5
}, true)
end end
end end
end end