From c91f787cb2578f466ebd74332ca83bd845fe0bce Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Tue, 28 Jun 2022 01:24:36 +0200 Subject: [PATCH] Correct condition --- src/caches.lua | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/caches.lua b/src/caches.lua index c204d37..eb8a0de 100644 --- a/src/caches.lua +++ b/src/caches.lua @@ -39,22 +39,19 @@ 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 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 def.drawtype and is_cube(def.drawtype) then + texture = get_cube(tiles) + elseif texture then + texture = texture:gsub("%^", "\\^"):gsub(":", "\\:") .. "\\^[resize\\:150x150" + 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 + if texture then + sprite = sprite .. fmt(":0,%u=%s", c * px, texture) + c++ + if c == lim then break end end end