From 1c5038ff140951fd6e3d680f77a6afb50da6b83b Mon Sep 17 00:00:00 2001 From: Vanic Date: Tue, 6 Jan 2026 14:12:15 +0300 Subject: [PATCH] ItemFactory: change params for `registerNodesByShortDef`: remove titile & description params --- mods/CORE/ItemFactory/src/ItemFactory.lua | 10 ++++------ mods/GAME/ITEMS/rocks/init.lua | 16 ++++++++-------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/mods/CORE/ItemFactory/src/ItemFactory.lua b/mods/CORE/ItemFactory/src/ItemFactory.lua index 1523789..17c4a3b 100644 --- a/mods/CORE/ItemFactory/src/ItemFactory.lua +++ b/mods/CORE/ItemFactory/src/ItemFactory.lua @@ -22,7 +22,7 @@ local defMerge = function(...) return table.merge(...) end ----@param itemDefs Item.ItemDefinition[]|Node.NodeDefinition[] List of nodes with parameters unique to them. +---@param itemDefs Item.ItemDefinition[]|Node.NodeDefinition[] List of nodes with parameters unique to them. function ItemFactory:registerItems(itemDefs) ---@param nodeDef Item.ItemDefinition | Node.NodeDefinition for _, itemDef in ipairs(itemDefs) do @@ -39,16 +39,14 @@ local defMerge = function(...) return table.merge(...) end ----@param shortNodeDefs table Table of the form `{ {name, title, description, tiles}, {name, title, description, tiles}, ...}` +---@param shortNodeDefs [string, (string[]|TileDefinition[])?][] Format list {{name, tiles}, {name, tiles}, ...} function ItemFactory:registerNodesByShortDef(shortNodeDefs) for _, shortNodeDef in ipairs(shortNodeDefs) do ---@type Node.NodeDefinition local nodeDef = { settings = { - name = shortNodeDef[1], - title = shortNodeDef[2], - description = shortNodeDef[3], - tiles = shortNodeDef[4] + name = shortNodeDef[1], + tiles = shortNodeDef[2] } } diff --git a/mods/GAME/ITEMS/rocks/init.lua b/mods/GAME/ITEMS/rocks/init.lua index be5b2b4..d3a382c 100644 --- a/mods/GAME/ITEMS/rocks/init.lua +++ b/mods/GAME/ITEMS/rocks/init.lua @@ -25,14 +25,14 @@ local rockFactory = defaultRock:getFactory() local ts = TileSheet:new("rocks_sheet.png", 16, 16) rockFactory:registerNodesByShortDef({ - {"sylite", "Sylite", nil, {ts:t(0, 0)}}, - {"tauitite", "Tauitite", nil, {ts:t(0, 2)}}, - {"iyellite", "Iyellite", nil, {ts:t(0, 4)}}, - {"falmyte", "Falmyte", nil, {ts:t(0, 6)}}, - {"hapcoryte", "Hapcoryte", nil, {ts:t(0, 8)}}, - {"burcite", "Burcite", nil, {ts:t(0, 10)}}, - {"felhor", "Felhor", nil, {ts:t(0, 12)}}, - {"malachite", "malachite", nil, {ts:t(0, 14)}} + {"sylite", {ts:t(0, 0)}}, + {"tauitite", {ts:t(0, 2)}}, + {"iyellite", {ts:t(0, 4)}}, + {"falmyte", {ts:t(0, 6)}}, + {"hapcoryte", {ts:t(0, 8)}}, + {"burcite", {ts:t(0, 10)}}, + {"felhor", {ts:t(0, 12)}}, + {"malachite", {ts:t(0, 14)}} }) --[[