diff --git a/mods/lord/Player/lord_inventory/locale/lottarmor.en.tr b/mods/lord/Player/lord_inventory/locale/lottarmor.en.tr index 01005228a..b74dfa65d 100644 --- a/mods/lord/Player/lord_inventory/locale/lottarmor.en.tr +++ b/mods/lord/Player/lord_inventory/locale/lottarmor.en.tr @@ -1,8 +1,13 @@ # textdomain: lord_inventory +# Tabs: +Main=Main +Bags=Bags + + +# Main Tab: crafting_image=lord_inventory_crafting.en.png -Back=Back +# Bags Tab: +All Bags=All Bags Bag=Bag -Main=Main -Bags=Bags diff --git a/mods/lord/Player/lord_inventory/locale/lottarmor.ru.tr b/mods/lord/Player/lord_inventory/locale/lottarmor.ru.tr index 04e9b11e6..13b7c0684 100644 --- a/mods/lord/Player/lord_inventory/locale/lottarmor.ru.tr +++ b/mods/lord/Player/lord_inventory/locale/lottarmor.ru.tr @@ -1,8 +1,13 @@ # textdomain: lord_inventory +# Tabs: +Main=Основное +Bags=Сумки + + +# Main Tab: crafting_image=lord_inventory_crafting.ru.png -Back=На главную +# Bags Tab: +All Bags=Все Сумки Bag=Сумка -Main=На главную -Bags=Сумки diff --git a/mods/lord/Player/lord_inventory/src/inventory/Form/BagsTab.lua b/mods/lord/Player/lord_inventory/src/inventory/Form/BagsTab.lua index 6e208cb65..b103d92b9 100644 --- a/mods/lord/Player/lord_inventory/src/inventory/Form/BagsTab.lua +++ b/mods/lord/Player/lord_inventory/src/inventory/Form/BagsTab.lua @@ -1,4 +1,4 @@ -local S = minetest.get_translator("lord_inventory") +local S = minetest.get_translator('lord_inventory') --- @class inventory.Form.BagsTab: base_classes.Form.Element.Tab @@ -19,27 +19,37 @@ function BagsTab:get_spec() -- Form with bags selection if bag == 0 then - return "list[current_player;main;0,3.5;8,4;]" - .. "button[0,2;2,0.5;bag1;" .. S("Bag") .. " 1]" - .. "button[2,2;2,0.5;bag2;" .. S("Bag") .. " 2]" - .. "button[4,2;2,0.5;bag3;" .. S("Bag") .. " 3]" - .. "button[6,2;2,0.5;bag4;" .. S("Bag") .. " 4]" - .. "list[detached:" .. player_name .. "_bags;bag1;0.5,1;1,1;]" - .. "list[detached:" .. player_name .. "_bags;bag2;2.5,1;1,1;]" - .. "list[detached:" .. player_name .. "_bags;bag3;4.5,1;1,1;]" - .. "list[detached:" .. player_name .. "_bags;bag4;6.5,1;1,1;]" + return '' + .. 'button[0,2;2,0.5;bag1;' .. S('Bag') .. ' 1]' + .. 'button[2,2;2,0.5;bag2;' .. S('Bag') .. ' 2]' + .. 'button[4,2;2,0.5;bag3;' .. S('Bag') .. ' 3]' + .. 'button[6,2;2,0.5;bag4;' .. S('Bag') .. ' 4]' + .. 'list[detached:' .. player_name .. '_bags;bag1;0.5,1;1,1;]' + .. 'list[detached:' .. player_name .. '_bags;bag2;2.5,1;1,1;]' + .. 'list[detached:' .. player_name .. '_bags;bag3;4.5,1;1,1;]' + .. 'list[detached:' .. player_name .. '_bags;bag4;6.5,1;1,1;]' + .. 'list[current_player;main;0,4.5 ;8,1; ]' + .. 'list[current_player;main;0,5.75;8,3;8]' end -- Form with bag contents local player = minetest.get_player_by_name(player_name) - local image = player:get_inventory():get_stack("bag" .. bag, 1):get_definition().inventory_image - - return "list[current_player;main;0,4.5;8,4;]" - .. "button[0,0;2,0.5;bags;" .. S("Bags") .. "]" - .. "image[7,-0.15;1,1;" .. image .. "]" - .. "list[current_player;bag" .. bag .. "contents;0,1;8,3;]" - .. "listring[current_player;bag" .. bag .. "contents]" - .. "listring[current_player;main]" + local image = player:get_inventory():get_stack('bag' .. bag, 1):get_definition().inventory_image + local bags_buttons = 'style_type[image_button;font=bold;textcolor=#fffb]' + for i = 1, 4 do + local button_image = player:get_inventory():get_stack('bag' .. i, 1):get_definition().inventory_image or '' + bags_buttons = bags_buttons .. + 'image_button['.. + (1 + i) .. ',-0.125;1,0.83;' .. button_image .. ';bag'..i..';' .. i .. + ']' + end + + return 'button[0,0;2,0.5;bags;' .. S('All Bags') .. ']' .. bags_buttons .. 'image[7,-0.15;1,1;' .. image .. ']' + .. 'list[current_player;bag' .. bag .. 'contents;0,1;8,3;]' + .. 'list[current_player;main;0,4.5 ;8,1; ]' + .. 'list[current_player;main;0,5.75;8,3;8]' + .. 'listring[current_player;bag' .. bag .. 'contents]' + .. 'listring[current_player;main]' end --- @param fields table @@ -52,7 +62,7 @@ function BagsTab:handle(fields) end for i = 1, 4 do - local page = "bag" .. i + local page = 'bag' .. i if fields[page] then self.current_bag = i local item_in_slot_definition = minetest.get_player_by_name(self.form.player_name) @@ -73,10 +83,10 @@ minetest.register_on_joinplayer(function(joined_player, last_login) local player_name = joined_player:get_player_name() local player_inv = joined_player:get_inventory() - local bags_inv = minetest.create_detached_inventory(player_name .. "_bags", { + local bags_inv = minetest.create_detached_inventory(player_name .. '_bags', { on_put = function(inv, list_name, index, stack, player) player:get_inventory():set_stack(list_name, index, stack) - player:get_inventory():set_size(list_name .. "contents", stack:get_definition().groups.bagslots) + player:get_inventory():set_size(list_name .. 'contents', stack:get_definition().groups.bagslots) end, on_take = function(inv, list_name, index, stack, player) player:get_inventory():set_stack(list_name, index, nil) @@ -89,7 +99,7 @@ minetest.register_on_joinplayer(function(joined_player, last_login) end end, allow_take = function(inv, list_name, index, stack, player) - if player:get_inventory():is_empty(list_name .. "contents") == true then + if player:get_inventory():is_empty(list_name .. 'contents') == true then return stack:get_count() else return 0 @@ -101,7 +111,7 @@ minetest.register_on_joinplayer(function(joined_player, last_login) }, player_name) for i = 1, 4 do - local bag = "bag" .. i + local bag = 'bag' .. i player_inv:set_size(bag, 1) bags_inv:set_size(bag, 1) bags_inv:set_stack(bag, 1, player_inv:get_stack(bag, 1)) diff --git a/mods/lord/Player/lord_inventory/src/inventory/Form/MainTab.lua b/mods/lord/Player/lord_inventory/src/inventory/Form/MainTab.lua index 7e940e696..db6b5ed2a 100644 --- a/mods/lord/Player/lord_inventory/src/inventory/Form/MainTab.lua +++ b/mods/lord/Player/lord_inventory/src/inventory/Form/MainTab.lua @@ -44,8 +44,8 @@ local formspec_template = '' .. 'image[7,3;1,1;lord_inventory_trash_slot.png]' .. 'list[detached:trash;main;7,3;1,1;]' -- Player inventory content - .. 'list[current_player;main;0,4.25;8,1;]' - .. 'list[current_player;main;0,5.5;8,3;8]' + .. 'list[current_player;main;0,4.5 ;8,1; ]' + .. 'list[current_player;main;0,5.75;8,3;8]' -- options .. 'listring[current_player;main]' .. 'listring[current_player;craft]'