Add failure sound

master
Wuzzy 2015-02-14 08:11:50 +01:00
parent c56346c8e2
commit 86a3f1406a
2 changed files with 9 additions and 1 deletions

View File

@ -58,6 +58,7 @@ minetest.register_tool("teletool:teletool", {
wield_image = "teletool_teletool.png",
inventory_image = "teletool_teletool.png",
on_use = function(itemstack, user, pointed_thing)
local failure = false
if(pointed_thing.type == "node") then
local has_technic = minetest.get_modpath("technic") ~= nil
if(has_technic) then
@ -68,12 +69,19 @@ minetest.register_tool("teletool:teletool", {
teletool.teleport(user, pointed_thing)
technic.set_RE_wear(itemstack, meta.charge, 50000)
itemstack:set_metadata(minetest.serialize(meta))
else
failure = true
end
else
teletool.teleport(user, pointed_thing)
end
return itemstack
else
failure = true
end
if failure then
minetest.sound_play( {name="teletool_fail", gain=0.5}, {pos=user:getpos(), max_hear_distance=4})
end
return itemstack
end,
-- Technic data

BIN
sounds/teletool_fail.ogg Normal file

Binary file not shown.