From 91cec3f12d7008f479414b03a0eb0aaccda09dc7 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Tue, 21 Apr 2020 21:28:10 +0200 Subject: [PATCH] Add symbols to clarify the list purpose --- shop.lua | 31 ++++++++++++++++++++----------- textures/exchange_shop_arrow.png | Bin 0 -> 438 bytes 2 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 textures/exchange_shop_arrow.png diff --git a/shop.lua b/shop.lua index c626989..c0c66d7 100644 --- a/shop.lua +++ b/shop.lua @@ -17,17 +17,27 @@ local function get_exchange_shop_formspec(mode, pos, meta) return "listring[".. name ..";" .. src .. "]" .. "listring[current_player;main]" end + local function make_slots(x, y, list, label) + local arrow = "exchange_shop_arrow.png" + if list == "cust_ow" then + arrow = arrow .. "\\^\\[transformFY" + end + return table.concat({ + ("label[%f,%f;%s]"):format(x, y - 0.6, label), + ("image[%f,%f;0.6,0.6;shop_front.png]"):format(x + 0.15, y + 0.3), + ("image[%f,%f;0.6,0.6;%s]"):format(x + 0.15, y + 0.0, arrow), + ("list["..name..";%s;%f,%f;2,2;]"):format(list, x, y) + }) + end if mode == "customer" then local overflow = not meta:get_inventory():is_empty("cust_ej") -- customer local formspec = ( (overflow and "size[8,9]" or "size[8,8]").. - "label[1,0.4;" .. FS("You give:") .. "]".. - "list["..name..";cust_ow;1,1;2,2;]".. - "button[3,2.4;2,1;exchange;" .. FS("Exchange") .. "]".. - "label[5,0.4;" .. FS("You get:") .. "]".. - "list["..name..";cust_og;5,1;2,2;]" + make_slots(1, 1, "cust_ow", FS("You give:")) .. + "button[3,2.5;2,1;exchange;" .. FS("Exchange") .. "]".. + make_slots(5, 1, "cust_og", FS("You get:")) ) -- Insert fallback slots local inv_pos = 4 @@ -56,12 +66,8 @@ local function get_exchange_shop_formspec(mode, pos, meta) "field[1.2,0.5;3,0.5;title;;"..title.."]".. "field_close_on_enter[title;false]".. "button[3.9,0.2;1,0.5;set_title;" .. FS("Set") .. "]".. - "container[0,2]".. - "label[0,-0.6;" .. FS("You need") .. FS(":") .. "]".. - "list["..name..";cust_ow;0,0;2,2;]".. - "label[2.5,-0.6;" .. FS("You give") .. FS(":") .. "]".. - "list["..name..";cust_og;2.5,0;2,2;]".. - "container_end[]".. + make_slots( 0, 2, "cust_ow", FS("You need") .. FS(":")) .. + make_slots(2.5, 2, "cust_og", FS("You give") .. FS(":")) .. "label[5,0.1;" .. FS("Current stock:") .. "]" ) @@ -73,11 +79,13 @@ local function get_exchange_shop_formspec(mode, pos, meta) ) end + local arrow = "exchange_shop_arrow.png" if mode == "owner_custm" then formspec = (formspec.. "button[7.5,0.2;2.5,0.5;view_stock;" .. FS("Income") .. "]".. "list["..name..";custm;5,1;5,4;]".. listring("custm")) + arrow = arrow .. "\\^\\[transformFY" else formspec = (formspec.. "button[7.5,0.2;2.5,0.5;view_custm;" .. FS("Outgoing") .. "]".. @@ -86,6 +94,7 @@ local function get_exchange_shop_formspec(mode, pos, meta) end return (formspec.. "label[1,5.4;" .. FS("Use (E) + (Right click) for customer interface") .. "]".. + "image[8.2,5.2;0.6,0.6;" .. arrow .. "]" .. "list[current_player;main;1,6;8,4;]") end return "" diff --git a/textures/exchange_shop_arrow.png b/textures/exchange_shop_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..4d316d7134045875abea0b3171093b827b755ec8 GIT binary patch literal 438 zcmV;n0ZIOeP) zFGvGX9LM)IML`*gSTtD#!!U`~Rim&dW~;#rD|6K>NO5 z7-)F4S{(2G8;!0pQ89tX!1h9ZSL(V|GJ@yRN$gxJe5D@2ysAHq7+bk`lm4 zuV+?KQUnM*&s+JOIrjTQL~LVBshearo84DRt^KtoBKJV0$G;*M_h!85GT~{|^Rk&C gGZGjHj0A?x7n`Au6}md-pa1{>07*qoM6N<$f*VJ{I{*Lx literal 0 HcmV?d00001