summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorProt <prot64@logicmachine.fannet.ru>2015-07-19 16:59:09 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-07-19 17:01:36 -0400
commit2355dc6fc27c392a4610b2951d30b5e5482fac09 (patch)
tree1c93d428531817f9dd9b34ef71e2910a046a2e2f
parent8338b406d3e142d0163c95fa9b7dd6e14f5ccec9 (diff)
require "home" privilege to use home/sethome buttons
-rw-r--r--register.lua27
1 files changed, 19 insertions, 8 deletions
diff --git a/register.lua b/register.lua
index 8fb0a33..a1ce6d4 100644
--- a/register.lua
+++ b/register.lua
@@ -40,13 +40,18 @@ if not unified_inventory.lite_mode then
tooltip = S("Set home position"),
action = function(player)
local player_name = player:get_player_name()
- unified_inventory.set_home(player, player:getpos())
- local home = unified_inventory.home_pos[player_name]
- if home ~= nil then
- minetest.sound_play("dingdong",
- {to_player=player_name, gain = 1.0})
+ 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
+ minetest.sound_play("dingdong",
+ {to_player=player_name, gain = 1.0})
+ 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("Home position set to: %s"):format(minetest.pos_to_string(home)))
+ 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)
- minetest.sound_play("teleport",
+ 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)
+ unified_inventory.go_home(player)
+ else
+ minetest.chat_send_player(player_name,
+ S("You don't have the \"home\" privilege!"))
+ end
end,
})