Add support for custom icons

https://mods.factorio.com/mod/hot-metals/discussion/6773ea5e1c4d7b0e4bba85b6
This commit is contained in:
Simon Brodtmann 2025-01-01 10:57:29 +01:00
parent ee97c9cb52
commit 1b24772cbb
2 changed files with 6 additions and 2 deletions

View file

@ -10,7 +10,7 @@ This mod adds a global variable named `HotMetals`. Add things to it to add suppo
It has the following properties.
### `items`
Add an item name as string or a table with `name` and optional `spoilTicks` and `iconFolder`. The icon file will be `iconFolder .. "hot-" .. itemName .. ".png"`.
Add an item name as string or a table with `name` and optional `spoilTicks` and `iconFolder`. The icon file will be `iconFolder .. "hot-" .. itemName .. ".png"`. If you need more control over the icons, provide a table `icons` instead of `iconFolder`.
### `craftingCategories`
A table containing all supported crafting categories. This mod uses a white list to prevent unwanted categories by default. Only categories used by smelting buildings like the furnace and the foundry should be added.

View file

@ -15,7 +15,11 @@ function createHotVariant(item)
local hotItem = table.deepcopy(data.raw.item[itemName])
hotItem.name = "hot-" .. itemName
hotItem.localised_name = { "", { "item-name.hot" }, " ", { "item-name." .. itemName } }
hotItem.icon = iconFolder .. "hot-" .. itemName .. ".png"
if (item.icons) then
hotItem.icons = item.icons
else
hotItem.icon = iconFolder .. "hot-" .. itemName .. ".png"
end
hotItem.order = hotItem.order .. "-hot"
hotItem.spoil_result = itemName
hotItem.spoil_ticks = spoilTicks