mirror of
https://github.com/minetest-mods/i3.git
synced 2024-12-25 18:30:38 +01:00
Some last fix
This commit is contained in:
parent
2db1e885fc
commit
cb1dce66f9
@ -28,28 +28,32 @@ local function cache_groups(groupname, groups)
|
|||||||
i3.groups[groupname].items = groups_to_items(groups, true)
|
i3.groups[groupname].items = groups_to_items(groups, true)
|
||||||
|
|
||||||
local items = i3.groups[groupname].items
|
local items = i3.groups[groupname].items
|
||||||
local nb_items = #items
|
if #items <= 1 then return end
|
||||||
|
|
||||||
if nb_items > 1 then
|
local c = 0
|
||||||
local px = 256
|
local px = 256
|
||||||
local sprite = fmt("[combine:%ux%u", px, px * nb_items)
|
local sprite = "[combine:WxH"
|
||||||
|
|
||||||
for i = 1, nb_items do
|
for _, item in ipairs(items) do
|
||||||
local item = items[i]
|
local def = reg_items[item]
|
||||||
local def = reg_items[item]
|
local texture = def.inventory_image or def.wield_image
|
||||||
local texture = def.inventory_image or def.wield_image
|
|
||||||
|
|
||||||
if is_cube(def.drawtype) then
|
if true_str(texture) then
|
||||||
texture = get_cube(def.tiles)
|
texture = texture .. "\\^[resize\\:150x150"
|
||||||
elseif true_str(texture) then
|
elseif is_cube(def.drawtype) then
|
||||||
texture = texture .. "\\^[resize\\:150x150"
|
texture = get_cube(def.tiles)
|
||||||
end
|
|
||||||
|
|
||||||
sprite = sprite .. fmt(":0,%u=%s", (i - 1) * px, texture)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
i3.groups[groupname].sprite = sprite
|
if true_str(texture) then
|
||||||
|
sprite = sprite .. fmt(":0,%u=%s", c * px, texture)
|
||||||
|
c++
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sprite = sprite:gsub("WxH", px .. "x" .. px * c)
|
||||||
|
|
||||||
|
i3.groups[groupname].sprite = sprite
|
||||||
|
i3.groups[groupname].count = c
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_item_usages(item, recipe, added)
|
local function get_item_usages(item, recipe, added)
|
||||||
|
@ -1035,7 +1035,7 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
|
|||||||
local sprite = ESC(group_cache.sprite)
|
local sprite = ESC(group_cache.sprite)
|
||||||
|
|
||||||
fs("item_image_button", X, Y, btn_size, btn_size, "", btn_name, "")
|
fs("item_image_button", X, Y, btn_size, btn_size, "", btn_name, "")
|
||||||
fs("animated_image", X + 0.01, Y + 0.01, 1.89, 1.89, sprite, #group_cache.items, 1000)
|
fs("animated_image", X + 0.01, Y + 0.01, 1.89, 1.89, sprite, group_cache.count, 1000)
|
||||||
fs("label", X + 0.45, Y + 0.18, label)
|
fs("label", X + 0.45, Y + 0.18, label)
|
||||||
|
|
||||||
if _count > 1 then
|
if _count > 1 then
|
||||||
|
Loading…
Reference in New Issue
Block a user