forked from mtcontrib/minetest_returnmirror
Use TRUE ephemeral sounds
This commit is contained in:
parent
5462fba560
commit
ae1b85f1a0
16
init.lua
16
init.lua
|
@ -46,10 +46,10 @@ returnmirror.set_position_inactive = function(itemstack, user, pointed_thing)
|
||||||
if returnmirror.mana_check(user, returnmirror.cost_set) then
|
if returnmirror.mana_check(user, returnmirror.cost_set) then
|
||||||
local newitem = ItemStack("returnmirror:mirror_active")
|
local newitem = ItemStack("returnmirror:mirror_active")
|
||||||
newitem:set_metadata(minetest.pos_to_string(pos))
|
newitem:set_metadata(minetest.pos_to_string(pos))
|
||||||
minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12}, false)
|
minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12}, true)
|
||||||
return newitem
|
return newitem
|
||||||
else
|
else
|
||||||
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18}, false)
|
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18}, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -67,10 +67,10 @@ returnmirror.set_position_active = function(itemstack, user, pointed_thing)
|
||||||
local pos = user:getpos()
|
local pos = user:getpos()
|
||||||
if returnmirror.mana_check(user, returnmirror.cost_set) then
|
if returnmirror.mana_check(user, returnmirror.cost_set) then
|
||||||
itemstack:set_metadata(minetest.pos_to_string(pos))
|
itemstack:set_metadata(minetest.pos_to_string(pos))
|
||||||
minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12}, false)
|
minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12}, true)
|
||||||
return itemstack
|
return itemstack
|
||||||
else
|
else
|
||||||
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18}, false)
|
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18}, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ minetest.register_tool("returnmirror:mirror_inactive", {
|
||||||
groups = { disable_repair = 1 },
|
groups = { disable_repair = 1 },
|
||||||
range = 2,
|
range = 2,
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=user:getpos(), max_hear_distance=18}, false)
|
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=user:getpos(), max_hear_distance=18}, true)
|
||||||
end,
|
end,
|
||||||
on_place = returnmirror.set_position_inactive,
|
on_place = returnmirror.set_position_inactive,
|
||||||
on_secondary_use = 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 dest ~= nil then
|
||||||
if returnmirror.mana_check(user, returnmirror.cost_teleport) then
|
if returnmirror.mana_check(user, returnmirror.cost_teleport) then
|
||||||
fail = false
|
fail = false
|
||||||
minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=src, max_hear_distance=30}, false)
|
minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=src, max_hear_distance=30}, true)
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 50,
|
amount = 50,
|
||||||
time = 0.1,
|
time = 0.1,
|
||||||
|
@ -133,7 +133,7 @@ minetest.register_tool("returnmirror:mirror_active", {
|
||||||
texture = "returnmirror_particle_departure.png",
|
texture = "returnmirror_particle_departure.png",
|
||||||
})
|
})
|
||||||
user:setpos(dest)
|
user:setpos(dest)
|
||||||
minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=dest, max_hear_distance=30}, false)
|
minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=dest, max_hear_distance=30}, true)
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 100,
|
amount = 100,
|
||||||
time = 0.1,
|
time = 0.1,
|
||||||
|
@ -150,7 +150,7 @@ minetest.register_tool("returnmirror:mirror_active", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if fail then
|
if fail then
|
||||||
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=src, max_hear_distance=18}, false)
|
minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=src, max_hear_distance=18}, true)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_place = returnmirror.set_position_active,
|
on_place = returnmirror.set_position_active,
|
||||||
|
|
Loading…
Reference in New Issue