Convert minetest.sound_play uses to ephemeral
authorsfan5 <sfan5@live.de>
Sat, 25 Jan 2020 22:45:09 +0000 (23:45 +0100)
committersfan5 <sfan5@live.de>
Wed, 5 Feb 2020 21:24:23 +0000 (22:24 +0100)
mods/carts/cart_entity.lua
mods/default/chests.lua
mods/default/functions.lua
mods/default/item_entity.lua
mods/default/torch.lua
mods/doors/init.lua
mods/farming/api.lua
mods/fire/init.lua
mods/tnt/init.lua

index 3c131a669c5f99b3f305c64a439ec4cf598d5a14..02ff6cde104cf7b65c13ebf99f793bed05ad8b66 100644 (file)
@@ -414,7 +414,7 @@ minetest.register_craftitem("carts:cart", {
                end
 
                minetest.sound_play({name = "default_place_node_metal", gain = 0.5},
-                       {pos = pointed_thing.above})
+                       {pos = pointed_thing.above}, true)
 
                if not (creative and creative.is_enabled_for
                                and creative.is_enabled_for(placer:get_player_name())) then
index b401d9162f3d3a01fa9ada3a5ca7a4579a04ae6c..3fe9c1a0d59ced9a91e6217fff59541ed4da0ca1 100644 (file)
@@ -46,7 +46,8 @@ function default.chest.chest_lid_close(pn)
        local node = minetest.get_node(pos)
        minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap,
                        param2 = node.param2 })
-       minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
+       minetest.sound_play(sound, {gain = 0.3, pos = pos,
+               max_hear_distance = 10}, true)
 end
 
 default.chest.open_chests = {}
@@ -128,7 +129,7 @@ function default.chest.register_chest(name, d)
                        end
 
                        minetest.sound_play(def.sound_open, {gain = 0.3,
-                                       pos = pos, max_hear_distance = 10})
+                                       pos = pos, max_hear_distance = 10}, true)
                        if not default.chest.chest_lid_obstructed(pos) then
                                minetest.swap_node(pos,
                                                { name = "default:" .. name .. "_open",
@@ -199,7 +200,7 @@ function default.chest.register_chest(name, d)
                end
                def.on_rightclick = function(pos, node, clicker)
                        minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
-                                       max_hear_distance = 10})
+                                       max_hear_distance = 10}, true)
                        if not default.chest.chest_lid_obstructed(pos) then
                                minetest.swap_node(pos, {
                                                name = "default:" .. name .. "_open",
index 18ba561bfcf46b25cf89775bb17a62292ab0ab76..f67eadffbed05bd7c14dde4d6c18c50665ff203a 100644 (file)
@@ -141,7 +141,7 @@ default.cool_lava = function(pos, node)
                minetest.set_node(pos, {name = "default:stone"})
        end
        minetest.sound_play("default_cool_lava",
-               {pos = pos, max_hear_distance = 16, gain = 0.25})
+               {pos = pos, max_hear_distance = 16, gain = 0.25}, true)
 end
 
 if minetest.settings:get_bool("enable_lavacooling") ~= false then
index 2a61f08edd43956de20435c3b204d701afcb6837..85454365d60195713117a6b19968d5f2a2b26981 100644 (file)
@@ -20,7 +20,7 @@ local item = {
                minetest.sound_play("default_item_smoke", {
                        pos = p,
                        max_hear_distance = 8,
-               })
+               }, true)
                minetest.add_particlespawner({
                        amount = 3,
                        time = 0.1,
index 85035a5e883b60453ef88742c4747575055ec1f4..bf0201486fba5dc405cb61b7a7322a3f634fa082 100644 (file)
@@ -11,7 +11,8 @@ local function on_flood(pos, oldnode, newnode)
                        nodedef.groups.igniter and nodedef.groups.igniter > 0) then
                minetest.sound_play(
                        "default_cool_lava",
-                       {pos = pos, max_hear_distance = 16, gain = 0.1}
+                       {pos = pos, max_hear_distance = 16, gain = 0.1},
+                       true
                )
        end
        -- Remove the torch node
index 85af0ef81d5fcc6860aa7909223f24d38e06166c..ee4a188c9c6eb54e464213dfc52c6a1a3bff162a 100644 (file)
@@ -176,10 +176,10 @@ function doors.door_toggle(pos, node, clicker)
 
        if state % 2 == 0 then
                minetest.sound_play(def.door.sounds[1],
-                       {pos = pos, gain = 0.3, max_hear_distance = 10})
+                       {pos = pos, gain = 0.3, max_hear_distance = 10}, true)
        else
                minetest.sound_play(def.door.sounds[2],
-                       {pos = pos, gain = 0.3, max_hear_distance = 10})
+                       {pos = pos, gain = 0.3, max_hear_distance = 10}, true)
        end
 
        minetest.swap_node(pos, {
@@ -340,7 +340,7 @@ function doors.register(name, def)
                                itemstack:take_item()
                        end
 
-                       minetest.sound_play(def.sounds.place, {pos = pos})
+                       minetest.sound_play(def.sounds.place, {pos = pos}, true)
 
                        on_place_node(pos, minetest.get_node(pos),
                                placer, node, itemstack, pointed_thing)
@@ -550,12 +550,12 @@ function doors.trapdoor_toggle(pos, node, clicker)
 
        if string.sub(node.name, -5) == "_open" then
                minetest.sound_play(def.sound_close,
-                       {pos = pos, gain = 0.3, max_hear_distance = 10})
+                       {pos = pos, gain = 0.3, max_hear_distance = 10}, true)
                minetest.swap_node(pos, {name = string.sub(node.name, 1,
                        string.len(node.name) - 5), param1 = node.param1, param2 = node.param2})
        else
                minetest.sound_play(def.sound_open,
-                       {pos = pos, gain = 0.3, max_hear_distance = 10})
+                       {pos = pos, gain = 0.3, max_hear_distance = 10}, true)
                minetest.swap_node(pos, {name = node.name .. "_open",
                        param1 = node.param1, param2 = node.param2})
        end
@@ -744,7 +744,7 @@ function doors.register_fencegate(name, def)
                        local node_def = minetest.registered_nodes[node.name]
                        minetest.swap_node(pos, {name = node_def.gate, param2 = node.param2})
                        minetest.sound_play(node_def.sound, {pos = pos, gain = 0.3,
-                               max_hear_distance = 8})
+                               max_hear_distance = 8}, true)
                        return itemstack
                end,
                selection_box = {
index c2c549e432fd1a826822d3059b1f880ff1e156cf..4a482fac602bbf85321ee8f522a3229b748b5377 100644 (file)
@@ -59,7 +59,7 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
        minetest.sound_play("default_dig_crumbly", {
                pos = pt.under,
                gain = 0.5,
-       })
+       }, true)
 
        if not (creative and creative.is_enabled_for
                        and creative.is_enabled_for(user:get_player_name())) then
@@ -68,7 +68,8 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
                itemstack:add_wear(65535/(uses-1))
                -- tool break sound
                if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then
-                       minetest.sound_play(wdef.sound.breaks, {pos = pt.above, gain = 0.5})
+                       minetest.sound_play(wdef.sound.breaks, {pos = pt.above,
+                               gain = 0.5}, true)
                end
        end
        return itemstack
index 3c8a8fcf2baa508594bac2cd083c564583df9382..c35207e2a3dcf47552bd71052c8a9a88f334df42 100644 (file)
@@ -34,7 +34,7 @@ local function flood_flame(pos, oldnode, newnode)
        if not (nodedef and nodedef.groups and
                        nodedef.groups.igniter and nodedef.groups.igniter > 0) then
                minetest.sound_play("fire_extinguish_flame",
-                       {pos = pos, max_hear_distance = 16, gain = 0.15})
+                       {pos = pos, max_hear_distance = 16, gain = 0.15}, true)
        end
        -- Remove the flame
        return false
@@ -127,7 +127,8 @@ minetest.register_tool("fire:flint_and_steel", {
                local sound_pos = pointed_thing.above or user:get_pos()
                minetest.sound_play(
                        "fire_flint_and_steel",
-                       {pos = sound_pos, gain = 0.5, max_hear_distance = 8}
+                       {pos = sound_pos, gain = 0.5, max_hear_distance = 8},
+                       true
                )
                local player_name = user:get_player_name()
                if pointed_thing.type == "node" then
@@ -154,7 +155,8 @@ minetest.register_tool("fire:flint_and_steel", {
                        itemstack:add_wear(1000)
                        -- Tool break sound
                        if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then
-                               minetest.sound_play(wdef.sound.breaks, {pos = sound_pos, gain = 0.5})
+                               minetest.sound_play(wdef.sound.breaks, {pos = sound_pos,
+                                       gain = 0.5}, true)
                        end
                        return itemstack
                end
index 0e061fa62d3a6d6b4e3db1de8a6fba4ad2d6a2b7..82f0b9bea8df1cb72bf2080ed7d140ffa20a8b43 100644 (file)
@@ -274,7 +274,7 @@ function tnt.burn(pos, nodename)
                def.on_ignite(pos)
        elseif minetest.get_item_group(name, "tnt") > 0 then
                minetest.swap_node(pos, {name = name .. "_burning"})
-               minetest.sound_play("tnt_ignite", {pos = pos})
+               minetest.sound_play("tnt_ignite", {pos = pos}, true)
                minetest.get_node_timer(pos):start(1)
        end
 end
@@ -403,7 +403,7 @@ function tnt.boom(pos, def)
        end
        local sound = def.sound or "tnt_explode"
        minetest.sound_play(sound, {pos = pos, gain = 2.5,
-                       max_hear_distance = math.min(def.radius * 20, 128)})
+                       max_hear_distance = math.min(def.radius * 20, 128)}, true)
        local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection,
                        def.ignore_on_blast, owner, def.explode_center)
        -- append entity drops
@@ -541,7 +541,8 @@ minetest.register_node("tnt:gunpowder_burning", {
        -- unaffected by explosions
        on_blast = function() end,
        on_construct = function(pos)
-               minetest.sound_play("tnt_gunpowder_burning", {pos = pos, gain = 2})
+               minetest.sound_play("tnt_gunpowder_burning", {pos = pos,
+                       gain = 2}, true)
                minetest.get_node_timer(pos):start(1)
        end,
 })
@@ -672,7 +673,7 @@ function tnt.register_tnt(def)
                -- unaffected by explosions
                on_blast = function() end,
                on_construct = function(pos)
-                       minetest.sound_play("tnt_ignite", {pos = pos})
+                       minetest.sound_play("tnt_ignite", {pos = pos}, true)
                        minetest.get_node_timer(pos):start(4)
                        minetest.check_for_falling(pos)
                end,