Fix teleport sounds when teleport fails (#155)

This commit is contained in:
Maksim 2020-07-10 21:58:45 +02:00 committed by GitHub
parent 04b2edceb4
commit f25426911d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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!"))