Use ephemeral sounds

This commit is contained in:
Wuzzy 2020-04-06 00:09:42 +02:00
parent abde0ee1dc
commit 57a1aa7f7f

View File

@ -46,10 +46,10 @@ returnmirror.set_position_inactive = function(itemstack, user, pointed_thing)
if returnmirror.mana_check(user, returnmirror.cost_set) then
local newitem = ItemStack("returnmirror:mirror_active")
newitem:set_metadata(minetest.pos_to_string(pos))
minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12})
minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12}, false)
return newitem
else
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18})
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18}, false)
end
end
@ -67,10 +67,10 @@ returnmirror.set_position_active = function(itemstack, user, pointed_thing)
local pos = user:getpos()
if returnmirror.mana_check(user, returnmirror.cost_set) then
itemstack:set_metadata(minetest.pos_to_string(pos))
minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12})
minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12}, false)
return itemstack
else
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18})
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18}, false)
end
end
@ -95,7 +95,7 @@ minetest.register_tool("returnmirror:mirror_inactive", {
groups = { disable_repair = 1 },
range = 2,
on_use = function(itemstack, user, pointed_thing)
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=user:getpos(), max_hear_distance=18})
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=user:getpos(), max_hear_distance=18}, false)
end,
on_place = returnmirror.set_position_inactive,
on_secondary_use = returnmirror.set_position_inactive,
@ -118,7 +118,7 @@ minetest.register_tool("returnmirror:mirror_active", {
if dest ~= nil then
if returnmirror.mana_check(user, returnmirror.cost_teleport) then
fail = false
minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=src, max_hear_distance=30})
minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=src, max_hear_distance=30}, false)
minetest.add_particlespawner({
amount = 50,
time = 0.1,
@ -133,7 +133,7 @@ minetest.register_tool("returnmirror:mirror_active", {
texture = "returnmirror_particle_departure.png",
})
user:setpos(dest)
minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=dest, max_hear_distance=30})
minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=dest, max_hear_distance=30}, false)
minetest.add_particlespawner({
amount = 100,
time = 0.1,
@ -150,7 +150,7 @@ minetest.register_tool("returnmirror:mirror_active", {
end
end
if fail then
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=src, max_hear_distance=18})
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=src, max_hear_distance=18}, false)
end
end,
on_place = returnmirror.set_position_active,