Mailbox : fancier donators list

This commit is contained in:
jp 2015-11-25 11:57:53 +01:00
parent 92c60845cf
commit e0a0c607e4

View File

@ -18,7 +18,7 @@ xdecor.register("mailbox", {
meta:set_string("infotext", player_name.."'s Mailbox")
local inv = meta:get_inventory()
inv:set_size("mailbox", 8*4)
inv:set_size("mailbox", 6*4)
inv:set_size("drop", 1)
end,
on_rightclick = function(pos, _, clicker, _)
@ -50,7 +50,7 @@ xdecor.register("mailbox", {
inv:remove_item("drop", stack)
inv:add_item("mailbox", stack)
for i = 7, 2, -1 do
for i = 4, 2, -1 do
meta:set_string("giver"..i, meta:get_string("giver"..(i-1)))
meta:set_string("stack"..i, meta:get_string("stack"..(i-1)))
end
@ -75,13 +75,13 @@ function mailbox.formspec(pos, owner, num)
local giver = ""
if num == 1 then
for i = 1, 7 do
for i = 1, 4 do
if meta:get_string("giver"..i) ~= "" then
giver = giver..meta:get_string("giver"..i).." - "..meta:get_string("stack"..i)..","
giver = giver.."#FFFF00,"..meta:get_string("giver"..i)..",,\t"..meta:get_string("stack"..i)..","
end
end
return "size[13.5,9]"..xbg..default.get_hotbar_bg(2.75,5.25)..
"label[0,0;You have received...]label[8,0;Last donators :]box[8,0.75;5.35,3.9;#555555]textlist[8,0.75;5.35,3.9;givers;"..giver..";;true]list[nodemeta:"..spos..";mailbox;0,0.75;8,4;]list[current_player;main;2.75,5.25;8,4;]"
return "size[11,9]"..xbg..default.get_hotbar_bg(1.5,5.25)..
"label[0,0;You have received...]label[6,0;Last donators :]box[6,0.75;4.85,3.9;#555555]tablecolumns[color;text]tableoptions[background=#00000000;highlight=#00000000;border=false]table[6,0.75;4.85,4.4;givers;"..giver.."]list[nodemeta:"..spos..";mailbox;0,0.75;6,4;]list[current_player;main;1.5,5.25;8,4;]"
else
return "size[8,5]"..xbg..default.get_hotbar_bg(0,1.25)..
"label[0.5,0;Send your goods\nto "..owner.." :]list[nodemeta:"..spos..";drop;3.5,0;1,1;]list[current_player;main;0,1.25;8,4;]"