]> git.lizzy.rs Git - xdecor.git/commitdiff
Mailbox: use minetest.colorize
authorJP Guerrero <jeanpatrick.guerrero@gmail.com>
Sat, 3 Dec 2016 11:52:47 +0000 (12:52 +0100)
committerJP Guerrero <jeanpatrick.guerrero@gmail.com>
Sat, 3 Dec 2016 11:54:45 +0000 (12:54 +0100)
NOTE: Minetest 0.4.14-git or 0.4.15 required

src/mailbox.lua

index 67cb43e9618a2ebb85068ad169227e9b0ab22fb1..dba667b24f23414eb5e679ce502ddc085f319b02 100644 (file)
@@ -16,15 +16,12 @@ local function img_col(stack)
        end
 
        if def.tiles then
-               local img
-               local tile = def.tiles[1]
-
+               local tile, img = def.tiles[1]
                if type(tile) == "table" then
                        img = get_img(tile.name)
                elseif type(tile) == "string" then
                        img = get_img(tile)
                end
-
                if img then return img end
        end
 
@@ -56,18 +53,16 @@ function mailbox:formspec(pos, owner, num)
                        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]"..
+                       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;]"..
                        "listring[nodemeta:"..spos..";mailbox]"..
                        xbg..default.get_hotbar_bg(0.75,5.25)
        else
                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[current_player;main;0,1.25;8,4;] ]]..
+                       "label[0,0;Send your goods to\n"..minetest.colorize("#FFFF00", owner).."]"..
                        "list[nodemeta:"..spos..";drop;3.5,0;1,1;]"..
                        xbg..default.get_hotbar_bg(0,1.25)
        end