Minor improvement
This commit is contained in:
parent
563dc719d0
commit
5f413a150b
|
@ -31,26 +31,24 @@ local function cache_groups(group, groups)
|
||||||
local items = i3.groups[group].items
|
local items = i3.groups[group].items
|
||||||
if #items <= 1 then return end
|
if #items <= 1 then return end
|
||||||
|
|
||||||
local c = 0
|
local c, px, lim = 0, 256, 10
|
||||||
local px = 256
|
|
||||||
local limit = 10
|
|
||||||
local sprite = "[combine:WxH"
|
local sprite = "[combine:WxH"
|
||||||
|
|
||||||
for _, item in ipairs(items) do
|
for _, item in ipairs(items) do
|
||||||
local def = reg_items[item]
|
local def = reg_items[item]
|
||||||
local texture = def.inventory_image
|
|
||||||
|
|
||||||
if true_str(texture) then
|
|
||||||
texture = texture:gsub("%^", "\\^"):gsub(":", "\\:") .. "\\^[resize\\:150x150"
|
|
||||||
elseif is_cube(def.drawtype) then
|
|
||||||
local tiles = def.tiles or def.tile_images
|
local tiles = def.tiles or def.tile_images
|
||||||
|
local texture = true_str(def.inventory_image) and def.inventory_image --or tiles[1]
|
||||||
|
|
||||||
|
if is_cube(def.drawtype) then
|
||||||
texture = get_cube(tiles)
|
texture = get_cube(tiles)
|
||||||
|
elseif texture then
|
||||||
|
texture = texture:gsub("%^", "\\^"):gsub(":", "\\:") .. "\\^[resize\\:150x150"
|
||||||
end
|
end
|
||||||
|
|
||||||
if true_str(texture) then
|
if texture then
|
||||||
sprite = sprite .. fmt(":0,%u=%s", c * px, texture)
|
sprite = sprite .. fmt(":0,%u=%s", c * px, texture)
|
||||||
c++
|
c++
|
||||||
if c == limit then break end
|
if c == lim then break end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -331,12 +329,16 @@ local function init_cubes()
|
||||||
for name, def in pairs(reg_nodes) do
|
for name, def in pairs(reg_nodes) do
|
||||||
if def then
|
if def then
|
||||||
local id = core.get_content_id(name)
|
local id = core.get_content_id(name)
|
||||||
|
local tiles = def.tiles or def.tile_images
|
||||||
|
|
||||||
if is_cube(def.drawtype) then
|
if is_cube(def.drawtype) then
|
||||||
local tiles = def.tiles or def.tile_images
|
|
||||||
i3.cubes[id] = get_cube(tiles)
|
i3.cubes[id] = get_cube(tiles)
|
||||||
elseif sub(def.drawtype, 1, 9) == "plantlike" or sub(def.drawtype, 1, 8) == "firelike" then
|
elseif sub(def.drawtype, 1, 9) == "plantlike" or sub(def.drawtype, 1, 8) == "firelike" then
|
||||||
i3.plants[id] = def.inventory_image
|
local texture = true_str(def.inventory_image) and def.inventory_image or tiles[1]
|
||||||
|
|
||||||
|
if texture then
|
||||||
|
i3.plants[id] = texture
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1032,7 +1032,7 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
|
||||||
local btn_name = groups and fmt("group!%s!%s", groups[1], name) or name
|
local btn_name = groups and fmt("group!%s!%s", groups[1], name) or name
|
||||||
local _count = count * (is_recipe and data.scrbar_rcp or data.scrbar_usg or 1)
|
local _count = count * (is_recipe and data.scrbar_rcp or data.scrbar_usg or 1)
|
||||||
|
|
||||||
if group_cache and group_cache.sprite then
|
if group_cache and group_cache.sprite and not large_recipe then
|
||||||
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, "")
|
||||||
|
|
Ŝarĝante…
Reference in New Issue