From c3bc95e3c563260d0033d814e62e47d4bc3478bb Mon Sep 17 00:00:00 2001 From: Brevven Date: Wed, 1 Jan 2025 04:25:17 -0800 Subject: [PATCH] hot metals support --- changelog.txt | 1 + compatibility/data/hot-metals.lua | 13 +++++++++++++ data-util.lua | 22 ++++++++++++++++++++++ data.lua | 1 + info.json | 1 + lead-recipe.lua | 3 --- 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 compatibility/data/hot-metals.lua diff --git a/changelog.txt b/changelog.txt index 5cffb7d..082075c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Version: 2.0.9 Date: 2025-01-01 Features: + - Hot metals mod support - Casting for lead expansion bolts --------------------------------------------------------------------------------------------------- Version: 2.0.8 diff --git a/compatibility/data/hot-metals.lua b/compatibility/data/hot-metals.lua new file mode 100644 index 0000000..82f3d67 --- /dev/null +++ b/compatibility/data/hot-metals.lua @@ -0,0 +1,13 @@ +local util = require("data-util"); + +util.add_hot_metals({ + {name="lead-plate", spoilTicks=20*60, icons={ + { icon = "__bzlead__/graphics/icons/lead-plate.png", icon_size = 64}, + { icon = "__bzlead__/graphics/icons/lead-plate.png", icon_size = 64, tint={.9,.3,0, .5}}, + }}, + {name="lead-expansion-bolt", spoilTicks=20*60, icons={ + { icon = "__bzlead__/graphics/icons/lead-expansion-bolt.png", icon_size = 128}, + { icon = "__bzlead__/graphics/icons/lead-expansion-bolt.png", icon_size = 128, tint={.9,.3,0, .5}}, + }}, +}) + diff --git a/data-util.lua b/data-util.lua index 6e3873f..de873bd 100644 --- a/data-util.lua +++ b/data-util.lua @@ -1144,6 +1144,28 @@ function util.add_crafting_category(entity_type, entity, category) end end +-- Add crafting category to all entities that have another category +function util.add_crafting_category_if(entity_type, category, other_category) + if data.raw[entity_type] and data.raw["recipe-category"][category] and data.raw["recipe-category"][other_category] then + for _, entity in pairs(data.raw[entity_type]) do + local found_good = false + local found_bad = false + for _, existing in pairs(entity.crafting_categories) do + if existing == other_category then + found_good = true + end + if existing == category then + found_bad = true + end + end + if found_good and not found_bad then + table.insert(entity.crafting_categories, category) + end + end + end +end + + function util.add_to_ingredient(recipe, ingredient, amount, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe] then diff --git a/data.lua b/data.lua index f309761..c9f09dd 100644 --- a/data.lua +++ b/data.lua @@ -5,5 +5,6 @@ require("other-entities") require("lead-enriched") -- Enriched Ti for Krastorio 2 require("lead-recipe-se") -- Space Exploration special recipes (depends on K2 if present) require("lead-compressed") +require("compatibility.data.hot-metals") -- require("lead-sim") diff --git a/info.json b/info.json index ddaa154..f59f198 100644 --- a/info.json +++ b/info.json @@ -10,6 +10,7 @@ "base >= 1.1.0", "? space-age", "? bzsilicon", + "? hot-metals", "? space-exploration", "? Krastorio2", "? Rich-Rocks-Requiem", diff --git a/lead-recipe.lua b/lead-recipe.lua index f2be325..b8750d0 100644 --- a/lead-recipe.lua +++ b/lead-recipe.lua @@ -104,9 +104,6 @@ data:extend({ stack_size=100, icon = "__bzlead__/graphics/icons/lead-expansion-bolt.png", icon_size = 128, - pictures = { - {filename="__bzlead__/graphics/icons/lead-expansion-bolt.png", size=128, scale=0.25}, - }, order = "a[basic-intermediates]-e[expansion-bolt]", }, {