Add basic sounds
This commit is contained in:
parent
425d355b0b
commit
f6b9b5d1bf
15
init.lua
15
init.lua
|
@ -8,16 +8,21 @@ minetest.register_tool("returnmirror:returnmirror", {
|
||||||
wield_image = "returnmirror_returnmirror.png",
|
wield_image = "returnmirror_returnmirror.png",
|
||||||
tool_capabilities = {},
|
tool_capabilities = {},
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
local pos_string = itemstack:get_metadata()
|
local dest_string = itemstack:get_metadata()
|
||||||
local pos = minetest.string_to_pos(pos_string)
|
local dest = minetest.string_to_pos(dest_string)
|
||||||
if pos ~= nil then
|
if dest ~= nil then
|
||||||
if mana.subtract(user:get_player_name(), returnmirror.cost) then
|
if mana.subtract(user:get_player_name(), returnmirror.cost) then
|
||||||
user:setpos(pos)
|
local src = user:getpos()
|
||||||
|
minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=src, max_hear_distance=30})
|
||||||
|
user:setpos(dest)
|
||||||
|
minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=dest, max_hear_distance=30})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
itemstack:set_metadata(minetest.pos_to_string(placer:getpos()))
|
local pos = placer:getpos()
|
||||||
|
itemstack:set_metadata(minetest.pos_to_string(pos))
|
||||||
|
minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12})
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue