Fix teleport sounds when teleport fails (#155)
This commit is contained in:
parent
04b2edceb4
commit
f25426911d
2
api.lua
2
api.lua
@ -188,7 +188,9 @@ function unified_inventory.go_home(player)
|
|||||||
local pos = unified_inventory.home_pos[player:get_player_name()]
|
local pos = unified_inventory.home_pos[player:get_player_name()]
|
||||||
if pos then
|
if pos then
|
||||||
player:set_pos(pos)
|
player:set_pos(pos)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- register_craft
|
-- register_craft
|
||||||
|
@ -76,9 +76,9 @@ unified_inventory.register_button("home_gui_go", {
|
|||||||
action = function(player)
|
action = function(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
if minetest.check_player_privs(player_name, {home=true}) then
|
if minetest.check_player_privs(player_name, {home=true}) then
|
||||||
minetest.sound_play("teleport",
|
if unified_inventory.go_home(player) then
|
||||||
{to_player=player:get_player_name(), gain = 1.0})
|
minetest.sound_play("teleport", {to_player = player_name})
|
||||||
unified_inventory.go_home(player)
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(player_name,
|
minetest.chat_send_player(player_name,
|
||||||
S("You don't have the \"home\" privilege!"))
|
S("You don't have the \"home\" privilege!"))
|
||||||
|
Loading…
Reference in New Issue
Block a user