Compare commits

...

7 commits
2.0.0 ... main

Author SHA1 Message Date
Simon Brodtmann
8f6d9ad578 2.0.2 2025-10-11 17:44:58 +02:00
Simon Brodtmann
dc37e0eb3e Mod compatibility fixes 2025-10-11 17:44:28 +02:00
Simon Brodtmann
0fb68ca151 2.0.1 2025-10-11 00:58:56 +02:00
Simon Brodtmann
6498ce9276 data-util 2025-10-11 00:50:35 +02:00
Simon Brodtmann
11474b74dd Mod compatibility 2025-10-10 21:31:11 +02:00
Simon Brodtmann
8dd9c6a547 description 2025-10-10 19:05:31 +02:00
Simon Brodtmann
b8fbc58f2c gitignore 2025-10-10 19:03:47 +02:00
10 changed files with 55 additions and 51 deletions

3
.gitignore vendored
View file

@ -1 +1,2 @@
.idea .idea
*.zip

View file

@ -1,4 +1,14 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 2.0.2
Date: 11.10.2025
Bug Fixes:
- Increase mod compatibility
---------------------------------------------------------------------------------------------------
Version: 2.0.1
Date: 11.10.2025
Bug Fixes:
- Increase mod compatibility
---------------------------------------------------------------------------------------------------
Version: 2.0.0 Version: 2.0.0
Date: 10.10.2025 Date: 10.10.2025
Features: Features:

View file

@ -56,16 +56,16 @@ function util.se_matter(params)
energy_required = params.energy_required, energy_required = params.energy_required,
enabled = false, enabled = false,
ingredients = { ingredients = {
{sedata, 1}, {type = "item", name = sedata, amount=1},
{type="fluid", name="se-particle-stream", amount=50}, {type="fluid", name="se-particle-stream", amount=50},
{type="fluid", name="se-space-coolant-supercooled", amount=25}, {type="fluid", name="se-space-coolant-supercooled", amount=25},
}, },
results = { results = {
{type = "item", name = params.ore, amount = params.quant_out}, {type = "item", name = params.ore, amount = params.quant_out},
{type="item", name="se-contaminated-scrap", amount=1}, {type="item", name="se-contaminated-scrap", amount=1},
{type=item, name=sedata, amount=1, probability=.99}, {type="item", name=sedata, amount=1, probability=.99},
{type=item, name=sejunk, amount=1, probability=.01}, {type="item", name=sejunk, amount=1, probability=.01},
{type="fluid", name="se-space-coolant-hot", amount=25, catalyst_amount=25}, {type="fluid", name="se-space-coolant-hot", amount=25, ignored_by_productivity = 25, ignored_by_stats = 25},
} }
} }
}) })
@ -100,9 +100,9 @@ function util.se_matter(params)
{type="fluid", name="se-particle-stream", amount=50}, {type="fluid", name="se-particle-stream", amount=50},
}, },
results = { results = {
{type=item, name="se-kr-matter-liberation-data", amount=1, probability=.99}, {type="item", name="se-kr-matter-liberation-data", amount=1, probability=.99},
{type=item, name=sejunk, amount=1, probability=.01}, {type="item", name=sejunk, amount=1, probability=.01},
{type="fluid", name="se-particle-stream", amount=params.stream_out, catalyst_amount=50}, {type="fluid", name="se-particle-stream", amount=params.stream_out, ignored_by_productivity = 50, ignored_by_stats = 50},
} }
} }
}) })
@ -129,7 +129,7 @@ function util.se_matter(params)
{"se-astronomic-science-pack-4", 1}, {"se-astronomic-science-pack-4", 1},
{"se-energy-science-pack-4", 1}, {"se-energy-science-pack-4", 1},
{"se-material-science-pack-4", 1}, {"se-material-science-pack-4", 1},
{"matter-tech-card", 1}, {"kr-matter-tech-card", 1},
{"se-deep-space-science-pack-1", 1}, {"se-deep-space-science-pack-1", 1},
} }
}, },
@ -309,10 +309,7 @@ end
function add_ingredient_raw(recipe, ingredient) function add_ingredient_raw(recipe, ingredient)
if recipe ~= nil and recipe.ingredients ~= nil then if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do for i, existing in pairs(recipe.ingredients) do
if ( if (existing.name and existing.name == ingredient.name) then
(existing[1] and (existing[1] == ingredient[1] or existing[1] == ingredient.name)) or
(existing.name and (existing.name == ingredient[1] or existing.name == ingredient.name))
) then
return return
end end
end end
@ -330,10 +327,7 @@ end
function set_ingredient(recipe, ingredient, quantity) function set_ingredient(recipe, ingredient, quantity)
if recipe ~= nil and recipe.ingredients ~= nil then if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do for i, existing in pairs(recipe.ingredients) do
if existing[1] == ingredient then if existing.name == ingredient then
existing[2] = quantity
return
elseif existing.name == ingredient then
existing.amount = quantity existing.amount = quantity
existing.amount_min = nil existing.amount_min = nil
existing.amount_max = nil existing.amount_max = nil
@ -343,22 +337,21 @@ function set_ingredient(recipe, ingredient, quantity)
table.insert(recipe.ingredients, {ingredient, quantity}) table.insert(recipe.ingredients, {ingredient, quantity})
end end
end end
-- Add a given quantity of product to a given recipe. -- Add a given quantity of product to a given recipe.
-- Only works for recipes with multiple products -- Only works for recipes with multiple products
function util.add_product(recipe_name, product) function util.add_product(recipe_name, product)
if data.raw.recipe[recipe_name] and if data.raw.recipe[recipe_name] and
(data.raw.item[product.name] or data.raw.fluid[product.name]) then (data.raw.item[product.name] or data.raw.fluid[product.name]) then
local is_fluid = data.raw.fluid[product.name] add_product(data.raw.recipe[recipe_name], product)
add_product(data.raw.recipe[recipe_name], product, is_fluid)
end end
end end
function add_product(recipe, product, is_fluid) function add_product(recipe, product)
if recipe ~= nil then if recipe ~= nil then
if recipe.results == nil then if recipe.results == nil then
recipe.results = {} recipe.results = {}
end end
table.insert(recipe.results, {type = is_fluid and "fluid" or "item", name = product.result, amount = product.result_count and product.result_count or 1}) table.insert(recipe.results, product)
end end
end end
@ -395,7 +388,7 @@ end
-- Use amount to set an amount. If that amount is a multiplier instead of an exact amount, set multiply true. -- Use amount to set an amount. If that amount is a multiplier instead of an exact amount, set multiply true.
function util.replace_ingredient(recipe_name, old, new, amount, multiply) function util.replace_ingredient(recipe_name, old, new, amount, multiply)
if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then
replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply) replace_ingredient(data.raw.recipe[recipe_name], old, new, amount or 1, multiply)
end end
end end
@ -452,23 +445,20 @@ end
function replace_some_ingredient(recipe, old, old_amount, new, new_amount, is_fluid) function replace_some_ingredient(recipe, old, old_amount, new, new_amount, is_fluid)
if recipe ~= nil and recipe.ingredients ~= nil then if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do for i, existing in pairs(recipe.ingredients) do
if existing[1] == new or existing.name == new then if existing.name == new then
return return
end end
end end
for i, ingredient in pairs(recipe.ingredients) do for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == old then if ingredient.name == old then
ingredient.amount = math.max(1, ingredient.amount - old_amount) ingredient.amount = math.max(1, ingredient.amount - old_amount)
end
if ingredient[1] == old then
ingredient[2] = math.max(1, ingredient[2] - old_amount)
end end
end end
add_ingredient(recipe, new, new_amount, is_fluid) add_ingredient(recipe, new, new_amount, is_fluid)
end end
end end
-- set the amount of a product. -- set the amount of a product.
function util.set_product_amount(recipe_name, product, amount) function util.set_product_amount(recipe_name, product, amount)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
set_product_amount(data.raw.recipe[recipe_name], product, amount) set_product_amount(data.raw.recipe[recipe_name], product, amount)
@ -912,7 +902,7 @@ function util.add_unlock_force(technology_name, recipe)
util.add_unlock(technology_name, recipe) util.add_unlock(technology_name, recipe)
end end
-- sum the products of a recipe -- sum the products of a recipe
function util.sum_products(recipe_name) function util.sum_products(recipe_name)
-- this is going to end up approximate in some cases, integer division is probs fine -- this is going to end up approximate in some cases, integer division is probs fine
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then

View file

@ -1,6 +1,6 @@
{ {
"name": "Chromium2", "name": "Chromium2",
"version": "2.0.0", "version": "2.0.2",
"factorio_version": "2.0", "factorio_version": "2.0",
"title": "Chromium", "title": "Chromium",
"author": "Timeken, cackling fiend", "author": "Timeken, cackling fiend",
@ -16,12 +16,12 @@
"? bzgas", "? bzgas",
"? bzsilicon", "? bzsilicon",
"? IfNickel-Updated", "? IfNickel-Updated",
"? Indium", "? Indium2",
"? Krastorio2", "? Krastorio2",
"? RampantArsenal", "? RampantArsenal",
"? space-exploration", "? space-exploration",
"? Tantalite", "? Tantalite2",
"? ThemTharHills-Updated" "? ThemTharHills-Updated"
], ],
"description": "Chromium is a mod adding the element chromium.\n\nThis mod is inspired by Brevven's BZ mods. \n\n Most if not all art is placeholder." "description": "Chromium is a mod adding the element chromium.\n\nThis mod is inspired by Brevven's BZ mods."
} }

View file

@ -68,6 +68,6 @@ data:extend({
weight = 20*kg, weight = 20*kg,
inventory_move_sound = item_sounds.resource_inventory_move, inventory_move_sound = item_sounds.resource_inventory_move,
pick_sound = item_sounds.resource_inventory_pickup, pick_sound = item_sounds.resource_inventory_pickup,
drop_sound = item_sounds.resource_inventory_move, drop_sound = item_sounds.resource_inventory_move
}, },
}) })

View file

@ -36,7 +36,7 @@ data:extend(
{ {
{type = "item", name = "enriched-chromium", amount = 6}, {type = "item", name = "enriched-chromium", amount = 6},
{type = "item", name = "iron-ore", amount = 1}, {type = "item", name = "iron-ore", amount = 1},
{type = "fluid", name = "dirty-water", amount = 25, catalyst_amount = 25} {type = "fluid", name = "kr-dirty-water", amount = 25, catalyst_amount = 25}
}, },
crafting_machine_tint = crafting_machine_tint =
{ {
@ -67,12 +67,12 @@ data:extend(
{ {
type = "recipe", type = "recipe",
name = "dirty-water-filtration-chromium", name = "dirty-water-filtration-chromium",
category = "fluid-filtration", category = "kr-fluid-filtration",
icons = icons =
{ {
{ {
icon = data.raw.fluid["dirty-water"].icon, icon = data.raw.fluid["kr-dirty-water"].icon,
icon_size = data.raw.fluid["dirty-water"].icon_size icon_size = data.raw.fluid["kr-dirty-water"].icon_size
}, },
{ {
icon = data.raw.item["chromite-ore"].icon, icon = data.raw.item["chromite-ore"].icon,
@ -81,7 +81,7 @@ data:extend(
shift = {0, 4} shift = {0, 4}
} }
}, },
icon_size = data.raw.fluid["dirty-water"].icon_size, icon_size = data.raw.fluid["kr-dirty-water"].icon_size,
energy_required = 2, energy_required = 2,
enabled = false, enabled = false,
allow_as_intermediate = false, allow_as_intermediate = false,
@ -89,7 +89,7 @@ data:extend(
always_show_products = true, always_show_products = true,
ingredients = ingredients =
{ {
{type = "fluid", name = "dirty-water", amount = 100, catalyst_amount = 100}, {type = "fluid", name = "kr-dirty-water", amount = 100, catalyst_amount = 100},
}, },
results = results =
{ {

View file

@ -27,14 +27,14 @@ if mods["Krastorio2"] then
{ {
{ "production-science-pack", 1 }, { "production-science-pack", 1 },
{ "utility-science-pack", 1 }, { "utility-science-pack", 1 },
{ "matter-tech-card", 1 } { "kr-matter-tech-card", 1 }
}, },
time = 45 time = 45
} }
}, },
}) })
matter.createMatterRecipe({ matter.make_recipes({
material = { type = "item", name = "chromite-ore", amount = 10 }, material = { type = "item", name = "chromite-ore", amount = 10 },
matter_count = 5, matter_count = 5,
energy_required = 1, energy_required = 1,
@ -42,7 +42,7 @@ if mods["Krastorio2"] then
unlocked_by_technology = "chromium-matter-processing" unlocked_by_technology = "chromium-matter-processing"
}) })
matter.createMatterRecipe({ matter.make_recipes({
material = { type = "item", name = "chromium-plate", amount = 10 }, material = { type = "item", name = "chromium-plate", amount = 10 },
matter_count = 10, matter_count = 10,
energy_required = 3, energy_required = 3,

View file

@ -50,7 +50,7 @@ if mods["space-exploration"] then
}, },
energy_required = 45, energy_required = 45,
ingredients = { ingredients = {
{name = mods["Krastorio2"] and "enriched-chromium" or "chromite-ore", amount = 24}, {type = "item", name = mods["Krastorio2"] and "enriched-chromium" or "chromite-ore", amount = 24},
{type = "fluid", name = "se-pyroflux", amount = 10}, {type = "fluid", name = "se-pyroflux", amount = 10},
}, },
enabled = false, enabled = false,
@ -81,11 +81,11 @@ if mods["space-exploration"] then
{icon = "__Chromium2__/graphics/icons/chromium-ingot.png", icon_size = 32, scale = 0.125, shift = {-8, -8}}, {icon = "__Chromium2__/graphics/icons/chromium-ingot.png", icon_size = 32, scale = 0.125, shift = {-8, -8}},
}, },
results = { results = {
{name = "chromium-plate", amount = 10}, {type="item", name = "chromium-plate", amount = 10},
}, },
energy_required = 3.75, energy_required = 3.75,
ingredients = { ingredients = {
{name = "chromium-ingot", amount = 1} {type="item", name = "chromium-ingot", amount = 1}
}, },
enabled = false, enabled = false,
always_show_made_in = true, always_show_made_in = true,

View file

@ -56,14 +56,14 @@ if mods["Krastorio2"] then
{ icon = "__Chromium2__/graphics/icons/chromium-plate.png", icon_size = 64}, { icon = "__Chromium2__/graphics/icons/chromium-plate.png", icon_size = 64},
{ icon = "__Chromium2__/graphics/icons/chromite-ore.png", icon_size = 64, scale=0.125, shift= {-8, -8}} { icon = "__Chromium2__/graphics/icons/chromite-ore.png", icon_size = 64, scale=0.125, shift= {-8, -8}}
}, },
category = "electrolysis", category = "kr-electrolysis",
order = "a[chromium-plate]", order = "a[chromium-plate]",
energy_required = 25, energy_required = 25,
enabled = false, enabled = false,
always_show_made_in = true, always_show_made_in = true,
ingredients = { ingredients = {
{type = "fluid", name = "sulfuric-acid", amount = 25}, {type = "fluid", name = "sulfuric-acid", amount = 25},
{type = "fluid", name = "ammonia", amount = 50}, {type = "fluid", name = "kr-ammonia", amount = 50},
{type = "item", name = "chromite-ore", amount = 20} {type = "item", name = "chromite-ore", amount = 20}
}, },
results = { results = {
@ -214,9 +214,12 @@ data:extend({
} }
}) })
local inconel_ingredients = {{type="item", name="steel-plate", amount=5}, {type="item", name="chromium-plate", amount=3}, {type="item", name="iron-plate", amount=1}, mods["Tantalite"] and {type="item", name="niobium-plate", amount=1}} local inconel_ingredients = {{type="item", name="steel-plate", amount=5}, {type="item", name="chromium-plate", amount=3}, {type="item", name="iron-plate", amount=1}}
if mods["IfNickel-Updated"] then if mods["IfNickel-Updated"] then
inconel_ingredients = {{type="item", name="nickel-plate", amount=5}, {type="item", name="chromium-plate", amount=3}, {type="item", name="iron-plate", amount=1}, mods["Tantalite"] and {type="item", name="niobium-plate", amount=1}} inconel_ingredients = {{type="item", name="nickel-plate", amount=5}, {type="item", name="chromium-plate", amount=3}, {type="item", name="iron-plate", amount=1}}
end
if mods["Tantalite2"] then
table.insert(inconel_ingredients, {type="item", name="niobium-plate", amount=1})
end end
local inconel_category = "crafting" local inconel_category = "crafting"
local inconel_subgroup = "intermediate-product" local inconel_subgroup = "intermediate-product"

View file

@ -38,7 +38,7 @@ if mods["space-exploration"] then
util.replace_ingredient("se-thruster-suit", "low-density-structure", "chromel-r-fabric") util.replace_ingredient("se-thruster-suit", "low-density-structure", "chromel-r-fabric")
end end
if mods["Indium"] then if mods["Indium2"] then
util.replace_ingredient("cryogenic-seal", "steel-plate", "stainless-steel-plate") util.replace_ingredient("cryogenic-seal", "steel-plate", "stainless-steel-plate")
end end