mirror of
https://github.com/minetest-mods/i3.git
synced 2024-12-25 02:10:39 +01:00
Fix potential crash during sprite creation
This commit is contained in:
parent
c421c49916
commit
dcc4068e46
@ -39,26 +39,31 @@ local function cache_groups(group, groups)
|
||||
|
||||
for _, item in ipairs(items) do
|
||||
local def = reg_items[item]
|
||||
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)
|
||||
elseif texture then
|
||||
texture = texture:gsub("%^", "\\^"):gsub(":", "\\:") .. "\\^[resize\\:150x150"
|
||||
end
|
||||
if def then
|
||||
local tiles = def.tiles or def.tile_images
|
||||
local texture = true_str(def.inventory_image) and def.inventory_image --or tiles[1]
|
||||
|
||||
if texture then
|
||||
sprite = sprite .. fmt(":0,%u=%s", c * px, texture)
|
||||
c++
|
||||
if c == lim then break end
|
||||
if is_cube(def.drawtype) then
|
||||
texture = get_cube(tiles)
|
||||
elseif texture then
|
||||
texture = texture:gsub("%^", "\\^"):gsub(":", "\\:") .. "\\^[resize\\:150x150"
|
||||
end
|
||||
|
||||
if texture then
|
||||
sprite = sprite .. fmt(":0,%u=%s", c * px, texture)
|
||||
c++
|
||||
if c == lim then break end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
sprite = sprite:gsub("WxH", px .. "x" .. px * c)
|
||||
if c > 1 then
|
||||
sprite = sprite:gsub("WxH", px .. "x" .. px * c)
|
||||
|
||||
i3.groups[group].sprite = sprite
|
||||
i3.groups[group].count = c
|
||||
i3.groups[group].sprite = sprite
|
||||
i3.groups[group].count = c
|
||||
end
|
||||
end
|
||||
|
||||
local function get_item_usages(item, recipe, added)
|
||||
|
Loading…
Reference in New Issue
Block a user