Mailbox : enforce using 16px images in tablecolumn
This commit is contained in:
parent
114cef1534
commit
a64dbfca47
14
mailbox.lua
14
mailbox.lua
@ -2,11 +2,13 @@ local mailbox = {}
|
||||
screwdriver = screwdriver or {}
|
||||
|
||||
local function img_col(stack)
|
||||
if not stack then return "" end
|
||||
if stack.inventory_image ~= "" then
|
||||
return stack.inventory_image:match("(.*)%.png")..".png"
|
||||
local def = minetest.registered_items[stack]
|
||||
if not def then return "" end
|
||||
|
||||
if def.inventory_image ~= "" then
|
||||
return def.inventory_image:match("(.*)%.png")..".png"
|
||||
else
|
||||
return stack.tiles[1]:match("(.*)%.png")..".png"
|
||||
return def.tiles[1]:match("(.*)%.png")..".png"
|
||||
end
|
||||
end
|
||||
|
||||
@ -23,7 +25,9 @@ function mailbox:formspec(pos, owner, num)
|
||||
local stack_count = meta:get_string("stack"..i):match("%s(%d+)") or 1
|
||||
|
||||
giver = giver.."#FFFF00,"..giver_name..","..i..",#FFFFFF,x "..stack_count..","
|
||||
img = img..i.."="..img_col(minetest.registered_items[stack_name])..","
|
||||
-- Hack to force using a 16px resolution for images in formspec's tablecolumn.
|
||||
-- The engine doesn't scale them automatically yet.
|
||||
img = img..i.."=mailbox_blank16.png^"..img_col(stack_name)..","
|
||||
end
|
||||
end
|
||||
|
||||
|
BIN
textures/mailbox_blank16.png
Normal file
BIN
textures/mailbox_blank16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 B |
Loading…
Reference in New Issue
Block a user