X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=mailbox.lua;h=b8b18bb7dc929157cac30fac887607f730c1e9c4;hb=696d84e8717b673cf337e432da705ccd0c3d4ef5;hp=b23c41660f6a6ffe79e6fcf4d77f72d66f29c724;hpb=b3a6063dc1f7a7cf7611c9363ac592e7307f66d6;p=xdecor.git diff --git a/mailbox.lua b/mailbox.lua index b23c416..b8b18bb 100644 --- a/mailbox.lua +++ b/mailbox.lua @@ -63,9 +63,13 @@ xdecor.register("mailbox", { if listname == "drop" then local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - if inv:room_for_item("mailbox", stack) then return -1 end + if inv:room_for_item("mailbox", stack) then + return -1 + else + minetest.chat_send_player(player_name, "The mailbox is full") + end end - minetest.chat_send_player(player_name, "The mailbox is full.") + return 0 end }) @@ -80,7 +84,6 @@ local function img_col(stack) end function mailbox.formspec(pos, owner, num) - local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots local spos = pos.x..","..pos.y..","..pos.z local meta = minetest.get_meta(pos) local giver, img = "", "" @@ -92,28 +95,30 @@ function mailbox.formspec(pos, owner, num) ","..i..",#FFFFFF,x "..meta:get_string("stack"..i):match("%s(%d+)").."," img = img..i.."="..img_col(minetest.registered_items[ - meta:get_string("stack"..i):match("([%w_]+:[%w_]+)")]).."," + meta:get_string("stack"..i):match("([%w_:]+)")]).."," end end - return "size[9.5,9]"..xbg.. - default.get_hotbar_bg(0.75,5.25).. - "label[0,0;Mailbox :]".. - "label[6,0;Last donators :]".. - "box[6,0.72;3.3,3.5;#555555]".. - "tablecolumns[color;text;image,"..img.."0;color;text]".. - "tableoptions[background=#00000000;highlight=#00000000;border=false]".. + return [[ size[9.5,9] + label[0,0;Mailbox] + label[6,0;Last donators] + box[6,0.72;3.3,3.5;#555555] + listring[current_player;main] + list[current_player;main;0.75,5.25;8,4;] + tableoptions[background=#00000000;highlight=#00000000;border=false] ]] + .."tablecolumns[color;text;image,"..img.."0;color;text]".. "table[6,0.75;3.3,4;givers;"..giver.."]".. "list[nodemeta:"..spos..";mailbox;0,0.75;6,4;]".. - "list[current_player;main;0.75,5.25;8,4;]".. "listring[nodemeta:"..spos..";mailbox]".. - "listring[current_player;main]" + xbg..default.get_hotbar_bg(0.75,5.25) else - return "size[8,5]"..xbg.. - default.get_hotbar_bg(0,1.25).. - "label[0.5,0;Send your goods\nto "..owner.." :]".. + return [[ size[8,5] + list[current_player;main;0,1.25;8,4;] + tablecolumns[color;text;color;text] + tableoptions[background=#00000000;highlight=#00000000;border=false] ]] + .."table[0,0;3,1;sendform;#FFFFFF,Send your goods to,,,#FFFF00,"..owner.."]".. "list[nodemeta:"..spos..";drop;3.5,0;1,1;]".. - "list[current_player;main;0,1.25;8,4;]" + xbg..default.get_hotbar_bg(0,1.25) end end