summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-03-01 18:20:15 -0500
committerGitHub <noreply@github.com>2017-03-01 18:20:15 -0500
commitcff06ab167c1e0cc978794ddc94314f818c28011 (patch)
treea63f861628bb733e335c0f98b9d3fbf689834b76
parente8529e7742a24290f592011e1b02f336e9cc7e59 (diff)
parent7ab8825460ad26a4697fec52a11c864a6cddde63 (diff)
Merge pull request #91 from ForbiddenJ/master
Make trash configurable but preserve default functionality
-rw-r--r--bags.lua7
-rw-r--r--init.lua3
-rw-r--r--register.lua7
-rw-r--r--settingtypes.txt4
-rw-r--r--textures/ui_crafting_form.pngbin2658 -> 2962 bytes
5 files changed, 17 insertions, 4 deletions
diff --git a/bags.lua b/bags.lua
index 4af4ff5..3923dab 100644
--- a/bags.lua
+++ b/bags.lua
@@ -51,8 +51,11 @@ for i = 1, 4 do
elseif slots == 24 then
formspec = formspec.."background[0.06,0.99;7.92,7.52;ui_bags_lg_form.png]"
end
- formspec = (formspec.."background[6.06,0;0.92,0.92;ui_bags_trash.png]"
- .."list[detached:trash;main;6,0.1;1,1;]")
+ local player_name = player:get_player_name() -- For if statement.
+ if unified_inventory.trash_enabled or unified_inventory.is_creative(player_name) or minetest.get_player_privs(player_name).give then
+ formspec = (formspec.."background[6.06,0;0.92,0.92;ui_bags_trash.png]"
+ .."list[detached:trash;main;6,0.1;1,1;]")
+ end
return {formspec=formspec}
end,
})
diff --git a/init.lua b/init.lua
index 67bc56e..6929600 100644
--- a/init.lua
+++ b/init.lua
@@ -45,6 +45,9 @@ unified_inventory = {
-- "Lite" mode
lite_mode = minetest.setting_getbool("unified_inventory_lite"),
+
+ -- Trash enabled
+ trash_enabled = (minetest.setting_getbool("unified_inventory_trash") ~= false),
pagecols = 8,
pagerows = 10,
diff --git a/register.lua b/register.lua
index 127df7e..bd6a13b 100644
--- a/register.lua
+++ b/register.lua
@@ -175,8 +175,11 @@ unified_inventory.register_page("craft", {
formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;craftpreview;6,"..formspecy..";1,1;]"
formspec = formspec.."list[current_player;craft;2,"..formspecy..";3,3;]"
- formspec = formspec.."label[7,"..(formspecy + 1.5)..";" .. F("Trash:") .. "]"
- formspec = formspec.."list[detached:trash;main;7,"..(formspecy + 2)..";1,1;]"
+ if unified_inventory.trash_enabled or unified_inventory.is_creative(player_name) or minetest.get_player_privs(player_name).give then
+ formspec = formspec.."label[7,"..(formspecy + 1.5)..";" .. F("Trash:") .. "]"
+ formspec = formspec.."background[7,"..(formspecy + 2)..";1,1;ui_single_slot.png]"
+ formspec = formspec.."list[detached:trash;main;7,"..(formspecy + 2)..";1,1;]"
+ end
formspec = formspec.."listring[current_name;craft]"
formspec = formspec.."listring[current_player;main]"
if unified_inventory.is_creative(player_name) then
diff --git a/settingtypes.txt b/settingtypes.txt
index 1054fa9..910989f 100644
--- a/settingtypes.txt
+++ b/settingtypes.txt
@@ -5,3 +5,7 @@ unified_inventory_lite (Lite mode) bool false
#If enabled, bags will be made available which can be used to extend
#inventory storage size.
unified_inventory_bags (Enable bags) bool true
+
+#If enabled, the trash slot can be used by those without both creative
+#and the give privilege.
+unified_inventory_trash (Enable trash) bool true
diff --git a/textures/ui_crafting_form.png b/textures/ui_crafting_form.png
index 02d337d..8c980ac 100644
--- a/textures/ui_crafting_form.png
+++ b/textures/ui_crafting_form.png
Binary files differ