From a69cfd59db746d4dc47a6062219935becf9d0641 Mon Sep 17 00:00:00 2001 From: gononono64 <96976330+gononono64@users.noreply.github.com> Date: Mon, 21 Apr 2025 02:04:01 -0500 Subject: [PATCH] Update ItemsBuilder.lua added some image stuff for ox and fixed an issue with images --- lib/generators/server/ItemsBuilder.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/generators/server/ItemsBuilder.lua b/lib/generators/server/ItemsBuilder.lua index cdd627b..48bb998 100644 --- a/lib/generators/server/ItemsBuilder.lua +++ b/lib/generators/server/ItemsBuilder.lua @@ -41,6 +41,8 @@ ItemsBuilder.Generate = function(invoking, outputPrefix, itemsTable, useQB) "['%s'] = {['name'] = '%s', ['label'] = '%s', ['weight'] = %s, ['type'] = 'item',['image'] = '%s', ['unique'] = %s, ['useable'] = %s, ['shouldClose'] = %s, ['description'] = '%s'},", key, key, item.label, item.weight, item.image or key .. 'png', item.unique, item.useable, item.shouldClose, item.description ) + imagewithoutpng = item?.image and item.image:gsub(".png", "") + shouldRenderImage = imagewithoutpng and imagewithoutpng ~= key oxInventory[key] = string.format( [[ ["%s"] = { @@ -52,7 +54,9 @@ ItemsBuilder.Generate = function(invoking, outputPrefix, itemsTable, useQB) %s }, ]], key, item.label, item.description, item.weight, not item.unique, item.shouldClose, - item.image and string.format("image = '%s'", item.image) or "" + shouldRenderImage and item.image and string.format([[client = { + image = '%s' + }]], item.image) or "" ) end @@ -68,6 +72,8 @@ ItemsBuilder.Generate = function(invoking, outputPrefix, itemsTable, useQB) "['%s'] = {['name'] = '%s', ['label'] = '%s', ['weight'] = %s, ['type'] = 'item', ['image'] = '%s', ['unique'] = %s, ['useable'] = %s, ['shouldClose'] = %s, ['description'] = '%s'},", key, key, item.label, item.weight, item?.client?.image or key .. 'png', not item.stack, true, item.close, item.description ) + imagewithoutpng = item?.client?.image and item.client.image:gsub(".png", "") + shouldRenderImage = imagewithoutpng and imagewithoutpng ~= key oxInventory[key] = string.format( [[ ["%s"] = { @@ -79,7 +85,9 @@ ItemsBuilder.Generate = function(invoking, outputPrefix, itemsTable, useQB) %s }, ]], key, item.label, item.description, item.weight, item.stack, item.close, - item?.client?.image and string.format("image = '%s'", item.client.image) or "" + shouldRenderImage and item?.client?.image and string.format( [[client = { + image = '%s' + }]], item.client.image) or "" ) end end