diff --git a/doors_chest.lua b/doors_chest.lua index f5a2dea..1d7819e 100644 --- a/doors_chest.lua +++ b/doors_chest.lua @@ -625,14 +625,17 @@ minetest.register_node("protector:chest", { local spos = pos.x .. "," .. pos.y .. "," ..pos.z local formspec = "size[8,9]" --- .. default.gui_bg --- .. default.gui_bg_img --- .. default.gui_slots .. "list[nodemeta:".. spos .. ";main;0,0.3;8,4;]" - .. "button[0,4.5;2,0.25;toup;" .. F(S("To Chest")) .. "]" - .. "field[2.3,4.8;4,0.25;chestname;;" + + .. "image_button[-0.01,4.26;1.05,0.8;protector_up_icon.png;protect_up;]" + .. "image_button[0.98,4.26;1.05,0.8;protector_down_icon.png;protect_down;]" + .. "tooltip[protect_up;" .. S("To Chest") .. "]" + .. "tooltip[protect_down;" .. S("To Inventory") .. "]" + + .. "field[2.3,4.8;4,0.25;protect_name;;" .. meta:get_string("name") .. "]" - .. "button[6,4.5;2,0.25;todn;" .. F(S("To Inventory")) .. "]" + .. "button[5.99,4.5;2.05,0.25;protect_rename;" .. S("Rename") .. "]" + .. "list[current_player;main;0,5;8,1;]" .. "list[current_player;main;0,6.08;8,3;8]" .. "listring[nodemeta:" .. spos .. ";main]" @@ -691,22 +694,22 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) local player_inv = player:get_inventory() -- copy contents of player inventory to chest - if fields.toup then + if fields.protect_up then to_from(player_inv, chest_inv) -- copy contents of chest to player inventory - elseif fields.todn then + elseif fields.protect_down then to_from(chest_inv, player_inv) - elseif fields.chestname then + elseif fields.protect_name or fields.protect_rename then -- change chest infotext to display name - if fields.chestname ~= "" then + if fields.protect_name ~= "" then - meta:set_string("name", fields.chestname) - meta:set_string("infotext", fields.chestname) + meta:set_string("name", fields.protect_name) + meta:set_string("infotext", fields.protect_name) else meta:set_string("name", S("Protected Chest")) meta:set_string("infotext", S("Protected Chest")) diff --git a/init.lua b/init.lua index d0a8f94..7044b74 100644 --- a/init.lua +++ b/init.lua @@ -651,15 +651,13 @@ minetest.register_node("protector:protect2", { -- recipes to switch between protectors minetest.register_craft({ - type = "shapeless", output = "protector:protect", - recipe = {"protector:protect2"} + recipe = {{"protector:protect2"}} }) minetest.register_craft({ - type = "shapeless", output = "protector:protect2", - recipe = {"protector:protect"} + recipe = {{"protector:protect"}} }) diff --git a/textures/license.txt b/textures/license.txt index 8798df4..acf6423 100644 --- a/textures/license.txt +++ b/textures/license.txt @@ -28,3 +28,7 @@ following textures by TenPlus1 (CC BY-SA 3.0): protector_logo.png protector_display.png protector_overlay.png + +following textures by Kilbith (CC BY-SA 3.0): + protector_up_icon.png + protector_down_icon.png (both rotated) diff --git a/textures/protector_down_icon.png b/textures/protector_down_icon.png new file mode 100644 index 0000000..f1161a2 Binary files /dev/null and b/textures/protector_down_icon.png differ diff --git a/textures/protector_up_icon.png b/textures/protector_up_icon.png new file mode 100644 index 0000000..4c47592 Binary files /dev/null and b/textures/protector_up_icon.png differ