require "home" privilege to use home/sethome buttons

This commit is contained in:
Prot 2015-07-19 16:59:09 -04:00 committed by Vanessa Ezekowitz
parent 8338b406d3
commit 2355dc6fc2

View File

@ -40,6 +40,7 @@ if not unified_inventory.lite_mode then
tooltip = S("Set home position"),
action = function(player)
local player_name = player:get_player_name()
if minetest.check_player_privs(player_name, {home=true}) then
unified_inventory.set_home(player, player:getpos())
local home = unified_inventory.home_pos[player_name]
if home ~= nil then
@ -48,6 +49,10 @@ if not unified_inventory.lite_mode then
minetest.chat_send_player(player_name,
S("Home position set to: %s"):format(minetest.pos_to_string(home)))
end
else
minetest.chat_send_player(player_name,
S("You don't have the \"home\" privilege!"))
end
end,
})
@ -56,9 +61,15 @@ if not unified_inventory.lite_mode then
image = "ui_gohome_icon.png",
tooltip = S("Go home"),
action = function(player)
local player_name = player:get_player_name()
if minetest.check_player_privs(player_name, {home=true}) then
minetest.sound_play("teleport",
{to_player=player:get_player_name(), gain = 1.0})
unified_inventory.go_home(player)
else
minetest.chat_send_player(player_name,
S("You don't have the \"home\" privilege!"))
end
end,
})