forked from minetest/minetest_game
Convert minetest.sound_play uses to ephemeral
This commit is contained in:
parent
176ddba176
commit
d3e26dba18
@ -414,7 +414,7 @@ minetest.register_craftitem("carts:cart", {
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.sound_play({name = "default_place_node_metal", gain = 0.5},
|
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
|
if not (creative and creative.is_enabled_for
|
||||||
and creative.is_enabled_for(placer:get_player_name())) then
|
and creative.is_enabled_for(placer:get_player_name())) then
|
||||||
|
@ -46,7 +46,8 @@ function default.chest.chest_lid_close(pn)
|
|||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap,
|
minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap,
|
||||||
param2 = node.param2 })
|
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
|
end
|
||||||
|
|
||||||
default.chest.open_chests = {}
|
default.chest.open_chests = {}
|
||||||
@ -128,7 +129,7 @@ function default.chest.register_chest(name, d)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.sound_play(def.sound_open, {gain = 0.3,
|
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
|
if not default.chest.chest_lid_obstructed(pos) then
|
||||||
minetest.swap_node(pos,
|
minetest.swap_node(pos,
|
||||||
{ name = "default:" .. name .. "_open",
|
{ name = "default:" .. name .. "_open",
|
||||||
@ -199,7 +200,7 @@ function default.chest.register_chest(name, d)
|
|||||||
end
|
end
|
||||||
def.on_rightclick = function(pos, node, clicker)
|
def.on_rightclick = function(pos, node, clicker)
|
||||||
minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos,
|
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
|
if not default.chest.chest_lid_obstructed(pos) then
|
||||||
minetest.swap_node(pos, {
|
minetest.swap_node(pos, {
|
||||||
name = "default:" .. name .. "_open",
|
name = "default:" .. name .. "_open",
|
||||||
|
@ -141,7 +141,7 @@ default.cool_lava = function(pos, node)
|
|||||||
minetest.set_node(pos, {name = "default:stone"})
|
minetest.set_node(pos, {name = "default:stone"})
|
||||||
end
|
end
|
||||||
minetest.sound_play("default_cool_lava",
|
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
|
end
|
||||||
|
|
||||||
if minetest.settings:get_bool("enable_lavacooling") ~= false then
|
if minetest.settings:get_bool("enable_lavacooling") ~= false then
|
||||||
|
@ -20,7 +20,7 @@ local item = {
|
|||||||
minetest.sound_play("default_item_smoke", {
|
minetest.sound_play("default_item_smoke", {
|
||||||
pos = p,
|
pos = p,
|
||||||
max_hear_distance = 8,
|
max_hear_distance = 8,
|
||||||
})
|
}, true)
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 3,
|
amount = 3,
|
||||||
time = 0.1,
|
time = 0.1,
|
||||||
|
@ -11,7 +11,8 @@ local function on_flood(pos, oldnode, newnode)
|
|||||||
nodedef.groups.igniter and nodedef.groups.igniter > 0) then
|
nodedef.groups.igniter and nodedef.groups.igniter > 0) then
|
||||||
minetest.sound_play(
|
minetest.sound_play(
|
||||||
"default_cool_lava",
|
"default_cool_lava",
|
||||||
{pos = pos, max_hear_distance = 16, gain = 0.1}
|
{pos = pos, max_hear_distance = 16, gain = 0.1},
|
||||||
|
true
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
-- Remove the torch node
|
-- Remove the torch node
|
||||||
|
@ -176,10 +176,10 @@ function doors.door_toggle(pos, node, clicker)
|
|||||||
|
|
||||||
if state % 2 == 0 then
|
if state % 2 == 0 then
|
||||||
minetest.sound_play(def.door.sounds[1],
|
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
|
else
|
||||||
minetest.sound_play(def.door.sounds[2],
|
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
|
end
|
||||||
|
|
||||||
minetest.swap_node(pos, {
|
minetest.swap_node(pos, {
|
||||||
@ -340,7 +340,7 @@ function doors.register(name, def)
|
|||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
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),
|
on_place_node(pos, minetest.get_node(pos),
|
||||||
placer, node, itemstack, pointed_thing)
|
placer, node, itemstack, pointed_thing)
|
||||||
@ -550,12 +550,12 @@ function doors.trapdoor_toggle(pos, node, clicker)
|
|||||||
|
|
||||||
if string.sub(node.name, -5) == "_open" then
|
if string.sub(node.name, -5) == "_open" then
|
||||||
minetest.sound_play(def.sound_close,
|
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,
|
minetest.swap_node(pos, {name = string.sub(node.name, 1,
|
||||||
string.len(node.name) - 5), param1 = node.param1, param2 = node.param2})
|
string.len(node.name) - 5), param1 = node.param1, param2 = node.param2})
|
||||||
else
|
else
|
||||||
minetest.sound_play(def.sound_open,
|
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",
|
minetest.swap_node(pos, {name = node.name .. "_open",
|
||||||
param1 = node.param1, param2 = node.param2})
|
param1 = node.param1, param2 = node.param2})
|
||||||
end
|
end
|
||||||
@ -744,7 +744,7 @@ function doors.register_fencegate(name, def)
|
|||||||
local node_def = minetest.registered_nodes[node.name]
|
local node_def = minetest.registered_nodes[node.name]
|
||||||
minetest.swap_node(pos, {name = node_def.gate, param2 = node.param2})
|
minetest.swap_node(pos, {name = node_def.gate, param2 = node.param2})
|
||||||
minetest.sound_play(node_def.sound, {pos = pos, gain = 0.3,
|
minetest.sound_play(node_def.sound, {pos = pos, gain = 0.3,
|
||||||
max_hear_distance = 8})
|
max_hear_distance = 8}, true)
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
|
@ -59,7 +59,7 @@ farming.hoe_on_use = function(itemstack, user, pointed_thing, uses)
|
|||||||
minetest.sound_play("default_dig_crumbly", {
|
minetest.sound_play("default_dig_crumbly", {
|
||||||
pos = pt.under,
|
pos = pt.under,
|
||||||
gain = 0.5,
|
gain = 0.5,
|
||||||
})
|
}, true)
|
||||||
|
|
||||||
if not (creative and creative.is_enabled_for
|
if not (creative and creative.is_enabled_for
|
||||||
and creative.is_enabled_for(user:get_player_name())) then
|
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))
|
itemstack:add_wear(65535/(uses-1))
|
||||||
-- tool break sound
|
-- tool break sound
|
||||||
if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then
|
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
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -34,7 +34,7 @@ local function flood_flame(pos, oldnode, newnode)
|
|||||||
if not (nodedef and nodedef.groups and
|
if not (nodedef and nodedef.groups and
|
||||||
nodedef.groups.igniter and nodedef.groups.igniter > 0) then
|
nodedef.groups.igniter and nodedef.groups.igniter > 0) then
|
||||||
minetest.sound_play("fire_extinguish_flame",
|
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
|
end
|
||||||
-- Remove the flame
|
-- Remove the flame
|
||||||
return false
|
return false
|
||||||
@ -127,7 +127,8 @@ minetest.register_tool("fire:flint_and_steel", {
|
|||||||
local sound_pos = pointed_thing.above or user:get_pos()
|
local sound_pos = pointed_thing.above or user:get_pos()
|
||||||
minetest.sound_play(
|
minetest.sound_play(
|
||||||
"fire_flint_and_steel",
|
"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()
|
local player_name = user:get_player_name()
|
||||||
if pointed_thing.type == "node" then
|
if pointed_thing.type == "node" then
|
||||||
@ -154,7 +155,8 @@ minetest.register_tool("fire:flint_and_steel", {
|
|||||||
itemstack:add_wear(1000)
|
itemstack:add_wear(1000)
|
||||||
-- Tool break sound
|
-- Tool break sound
|
||||||
if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then
|
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
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
@ -274,7 +274,7 @@ function tnt.burn(pos, nodename)
|
|||||||
def.on_ignite(pos)
|
def.on_ignite(pos)
|
||||||
elseif minetest.get_item_group(name, "tnt") > 0 then
|
elseif minetest.get_item_group(name, "tnt") > 0 then
|
||||||
minetest.swap_node(pos, {name = name .. "_burning"})
|
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)
|
minetest.get_node_timer(pos):start(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -403,7 +403,7 @@ function tnt.boom(pos, def)
|
|||||||
end
|
end
|
||||||
local sound = def.sound or "tnt_explode"
|
local sound = def.sound or "tnt_explode"
|
||||||
minetest.sound_play(sound, {pos = pos, gain = 2.5,
|
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,
|
local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection,
|
||||||
def.ignore_on_blast, owner, def.explode_center)
|
def.ignore_on_blast, owner, def.explode_center)
|
||||||
-- append entity drops
|
-- append entity drops
|
||||||
@ -541,7 +541,8 @@ minetest.register_node("tnt:gunpowder_burning", {
|
|||||||
-- unaffected by explosions
|
-- unaffected by explosions
|
||||||
on_blast = function() end,
|
on_blast = function() end,
|
||||||
on_construct = function(pos)
|
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)
|
minetest.get_node_timer(pos):start(1)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -672,7 +673,7 @@ function tnt.register_tnt(def)
|
|||||||
-- unaffected by explosions
|
-- unaffected by explosions
|
||||||
on_blast = function() end,
|
on_blast = function() end,
|
||||||
on_construct = function(pos)
|
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.get_node_timer(pos):start(4)
|
||||||
minetest.check_for_falling(pos)
|
minetest.check_for_falling(pos)
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user