diff options
author | ShadowNinja <noreply@gmail.com> | 2013-09-24 22:04:29 -0400 |
---|---|---|
committer | ShadowNinja <noreply@gmail.com> | 2013-09-24 22:04:29 -0400 |
commit | 2e52c6c795704c12bebf3790e1ef70d7f0234801 (patch) | |
tree | bbd9a2d4a0cb06194bb61a01380397236cc67c62 /unified_inventory | |
parent | bd3cc74d0576250af06a367369b7ea709d5581f4 (diff) |
Disable the trash button outside of creative mode
Diffstat (limited to 'unified_inventory')
-rw-r--r-- | unified_inventory/register.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/unified_inventory/register.lua b/unified_inventory/register.lua index 0baea9b..ad85537 100644 --- a/unified_inventory/register.lua +++ b/unified_inventory/register.lua @@ -99,7 +99,15 @@ unified_inventory.register_button("clear_inv", { type = "image", image = "ui_trash_icon.png", action = function(player) - local player_name = player:get_player_name() + local player_name = player:get_player_name() + if not unified_inventory.is_creative(player_name) then + minetest.chat_send_player(player_name, + "This button has been disabled outside" + .." of creative mode to prevent" + .." accidental inventory trashing." + .." Use the trash slot instead.") + return + end player:get_inventory():set_list("main", {}) minetest.chat_send_player(player_name, 'Inventory Cleared!') minetest.sound_play("trash_all", |