diff --git a/data-util.lua b/data-util.lua index 4c4cd1e..674a115 100644 --- a/data-util.lua +++ b/data-util.lua @@ -963,6 +963,19 @@ function util.set_item_icons(item_name, icons) end end +-- Gets an item or fluid icon +function util.get_item_or_fluid_icon(name) + icon = "" + if data.raw.item[name] then + icon = data.raw.item[name].icon + if not icon then icon = data.raw.item[name].icons[1].icon end + elseif data.raw.fluid[name] then + icon = data.raw.fluid[name].icon + if not icon then icon = data.raw.fluid[name].icons[1].icon end + end + return icon +end + function util.set_to_founding(recipe, options) util.set_category(recipe, "founding", options) util.set_subgroup(recipe, "foundry-intermediate", options) @@ -980,7 +993,8 @@ function util.add_crafting_category(entity_type, entity, category) end end -function util.add_to_ingredient(recipe, ingredient, amount) +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 add_to_ingredient(data.raw.recipe[recipe], ingredient, amount) add_to_ingredient(data.raw.recipe[recipe].normal, ingredient, amount)