diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2016-11-27 13:36:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-27 13:36:02 -0500 |
commit | 2e00206f586d2fef2d836a752e1ffdc9460aa190 (patch) | |
tree | f771c5bdb42b5cedec4b1f836e21cc014a918210 /register.lua | |
parent | e57a5f80b4258c3408ecfff965f0fd527f592f6f (diff) | |
parent | 8770b7df93e42beb9f717662620e509ca74487f7 (diff) |
Merge pull request #81 from Wuzzy2/master
Disable useless main buttons
Diffstat (limited to 'register.lua')
-rw-r--r-- | register.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/register.lua b/register.lua index f0c045c..127df7e 100644 --- a/register.lua +++ b/register.lua @@ -59,8 +59,12 @@ unified_inventory.register_button("home_gui_set", { else minetest.chat_send_player(player_name, S("You don't have the \"home\" privilege!")) + unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name]) end end, + condition = function(player) + return minetest.check_player_privs(player:get_player_name(), {home=true}) + end, }) unified_inventory.register_button("home_gui_go", { @@ -77,8 +81,12 @@ unified_inventory.register_button("home_gui_go", { else minetest.chat_send_player(player_name, S("You don't have the \"home\" privilege!")) + unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name]) end end, + condition = function(player) + return minetest.check_player_privs(player:get_player_name(), {home=true}) + end, }) unified_inventory.register_button("misc_set_day", { @@ -97,8 +105,12 @@ unified_inventory.register_button("misc_set_day", { else minetest.chat_send_player(player_name, S("You don't have the settime privilege!")) + unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name]) end end, + condition = function(player) + return minetest.check_player_privs(player:get_player_name(), {settime=true}) + end, }) unified_inventory.register_button("misc_set_night", { @@ -117,8 +129,12 @@ unified_inventory.register_button("misc_set_night", { else minetest.chat_send_player(player_name, S("You don't have the settime privilege!")) + unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name]) end end, + condition = function(player) + return minetest.check_player_privs(player:get_player_name(), {settime=true}) + end, }) unified_inventory.register_button("clear_inv", { @@ -133,6 +149,7 @@ unified_inventory.register_button("clear_inv", { .." of creative mode to prevent" .." accidental inventory trashing." .."\nUse the trash slot instead.")) + unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name]) return end player:get_inventory():set_list("main", {}) @@ -140,6 +157,9 @@ unified_inventory.register_button("clear_inv", { minetest.sound_play("trash_all", {to_player=player_name, gain = 1.0}) end, + condition = function(player) + return unified_inventory.is_creative(player:get_player_name()) + end, }) unified_inventory.register_page("craft", { |