mirror of
https://repo.or.cz/minetest_returnmirror.git
synced 2025-07-05 17:40:38 +02:00
Add basic sounds
This commit is contained in:
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
|
||||||
})
|
})
|
||||||
|
BIN
sounds/returnmirror_set.ogg
Normal file
BIN
sounds/returnmirror_set.ogg
Normal file
Binary file not shown.
BIN
sounds/returnmirror_teleport.ogg
Normal file
BIN
sounds/returnmirror_teleport.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user