Update to 2.0

This commit is contained in:
Simon Brodtmann 2025-10-05 08:52:53 +02:00
parent 126c1bf6b3
commit 06281ea9ca
14 changed files with 196 additions and 341 deletions

3
.editorconfig Normal file
View file

@ -0,0 +1,3 @@
[*]
indent_style = space
indent_size = 2

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.idea

View file

@ -14,6 +14,7 @@ See changelog.txt
## Thanks to ## Thanks to
- [Benjah-bmm27](https://commons.wikimedia.org/wiki/File:Vinyl-chloride-3D-vdW.png) (vinyl chloride icon) - [Benjah-bmm27](https://commons.wikimedia.org/wiki/File:Vinyl-chloride-3D-vdW.png) (vinyl chloride icon)
- [snouz](https://github.com/snouz) (logo inspiration) - [snouz](https://github.com/snouz) (logo inspiration)
- [cackling fiend](https://mods.factorio.com/user/cackling.fiend) (Update to 2.0)
### Compatibility ### Compatibility
- [nihilistzsche](https://github.com/nihilistzsche) - [nihilistzsche](https://github.com/nihilistzsche)

View file

@ -1,10 +1,10 @@
local util = require("data-util"); local util = require("data-util");
if mods.bobelectronics or mods.MDbobelectronics then if mods.bobelectronics or mods.MDbobelectronics or mods.MDbobelectronics2 then
-- FeCL3 is now anhydrous, so hydrate it for bob -- FeCL3 is now anhydrous, so hydrate it for bob
util.remove_ingredient("ferric-chloride-solution", "iron-ore") util.remove_ingredient("ferric-chloride-solution", "iron-ore")
util.remove_ingredient("ferric-chloride-solution", "hydrogen-chloride") util.remove_ingredient("ferric-chloride-solution", mods["Krastorio2"] and "kr-hydrogen-chloride" or "hydrogen-chloride")
util.add_ingredient("ferric-chloride-solution", "ferric-chloride", 5) util.add_ingredient("ferric-chloride-solution", "ferric-chloride", 5)
util.add_ingredient("ferric-chloride-solution", "water", 50) util.add_ingredient("ferric-chloride-solution", "water", 50)

View file

@ -64,16 +64,6 @@ function util.fe_plus(sub)
end end
end end
function util.get_stack_size(default)
if mods.Krastorio2 then
local size = get_setting("kr-stack-size")
if size and tonumber(size) then
return tonumber(size)
end
end
return default
end
function util.k2assets() function util.k2assets()
if mods["Krastorio2Assets"] then if mods["Krastorio2Assets"] then
return "__Krastorio2Assets__" return "__Krastorio2Assets__"
@ -111,8 +101,8 @@ function util.se_landfill(params)
category = "hard-recycling", category = "hard-recycling",
order = "z-b-"..params.ore, order = "z-b-"..params.ore,
subgroup = "terrain", subgroup = "terrain",
result = "landfill", results = {{type="item", name="landfill", amount=1}},
ingredients = {{params.ore, 50}}, ingredients = {{type="item", name=params.ore, amount=50}},
} }
}) })
util.add_unlock("se-recycling-facility", lname) util.add_unlock("se-recycling-facility", lname)
@ -123,7 +113,7 @@ end
-- k2 matter -- k2 matter
-- params: {k2matter}, k2baseicon , {icon} -- params: {k2matter}, k2baseicon , {icon}
function util.k2matter(params) function util.k2matter(params)
local matter = require("__Krastorio2__/lib/public/data-stages/matter-util") local matter = require("__Krastorio2__/prototypes/libraries/matter")
if mods["space-exploration"] then if mods["space-exploration"] then
params.k2matter.need_stabilizer = true params.k2matter.need_stabilizer = true
end end
@ -169,15 +159,15 @@ function util.k2matter(params)
{ {
{"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,
}, },
-- (ignore for now) localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}}, localised_name = {"technology-name.k2-conversion", {"item-name."..params.k2matter.item_name}},
}, },
}) })
end end
matter.createMatterRecipe(params.k2matter) matter.make_recipes(params.k2matter)
end end
@ -211,16 +201,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 = {
{params.ore, params.quant_out}, {type="item", name=params.ore, amount=params.quant_out},
{"se-contaminated-scrap", 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},
} }
} }
}) })
@ -250,14 +240,14 @@ function util.se_matter(params)
energy_required = 30, energy_required = 30,
enabled = false, enabled = false,
ingredients = { ingredients = {
{"se-kr-matter-liberation-data", 1}, {type="item", name="se-kr-matter-liberation-data", amount=1},
{params.ore, params.quant_in}, {type="item", name=params.ore, amount=params.quant_in},
{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},
} }
} }
}) })
@ -284,7 +274,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},
} }
@ -298,18 +288,6 @@ function util.se_matter(params)
end end
end end
-- Get the normal prototype for a recipe -- either .normal or the recipe itself
function util.get_normal(recipe_name)
if data.raw.recipe[recipe_name] then
recipe = data.raw.recipe[recipe_name]
if recipe.normal and recipe.normal.ingredients then
return recipe.normal
elseif recipe.ingredients then
return recipe
end
end
end
-- Set/override a technology's prerequisites -- Set/override a technology's prerequisites
function util.set_prerequisite(technology_name, prerequisites) function util.set_prerequisite(technology_name, prerequisites)
local technology = data.raw.technology[technology_name] local technology = data.raw.technology[technology_name]
@ -376,7 +354,7 @@ function util.add_unlock(technology_name, recipe)
end end
-- Check if a tech unlocks a recipe -- Check if a tech unlocks a recipe
function util.check_unlock(technology_name, recipe_name) function util.check_unlock(technology_name, recipe)
local technology = data.raw.technology[technology_name] local technology = data.raw.technology[technology_name]
if technology and technology.effects then if technology and technology.effects then
for i, effect in pairs(technology.effects) do for i, effect in pairs(technology.effects) do
@ -421,17 +399,13 @@ end
function util.set_enabled(recipe_name, enabled) function util.set_enabled(recipe_name, enabled)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.enabled = enabled end data.raw.recipe[recipe_name].enabled = enabled
if data.raw.recipe[recipe_name].expensive then data.raw.recipe[recipe_name].expensive.enabled = enabled end
if not data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].enabled = enabled end
end end
end end
function util.set_hidden(recipe_name) function util.set_hidden(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.hidden = true end data.raw.recipe[recipe_name].hidden = true
if data.raw.recipe[recipe_name].expensive then data.raw.recipe[recipe_name].expensive.hidden = true end
if not data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].hidden = true end
end end
end end
@ -441,8 +415,6 @@ function util.add_or_add_to_ingredient(recipe_name, ingredient, quantity, option
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
me.add_modified(recipe_name) me.add_modified(recipe_name)
add_or_add_to_ingredient(data.raw.recipe[recipe_name], ingredient, quantity) add_or_add_to_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
add_or_add_to_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
add_or_add_to_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
end end
end end
@ -465,8 +437,6 @@ function util.add_ingredient(recipe_name, ingredient, quantity, options)
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then
me.add_modified(recipe_name) me.add_modified(recipe_name)
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid) add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid)
add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity, is_fluid)
add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity, is_fluid)
end end
end end
@ -480,7 +450,7 @@ function add_ingredient(recipe, ingredient, quantity, is_fluid)
if is_fluid then if is_fluid then
table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity}) table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity})
else else
table.insert(recipe.ingredients, {ingredient, quantity}) table.insert(recipe.ingredients, {type="item", name=ingredient, amount=quantity})
end end
end end
end end
@ -491,8 +461,6 @@ function util.add_ingredient_raw(recipe_name, ingredient, options)
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient.name] or data.raw.item[ingredient[1]]) then if data.raw.recipe[recipe_name] and (data.raw.item[ingredient.name] or data.raw.item[ingredient[1]]) then
me.add_modified(recipe_name) me.add_modified(recipe_name)
add_ingredient_raw(data.raw.recipe[recipe_name], ingredient) add_ingredient_raw(data.raw.recipe[recipe_name], ingredient)
add_ingredient_raw(data.raw.recipe[recipe_name].normal, ingredient)
add_ingredient_raw(data.raw.recipe[recipe_name].expensive, ingredient)
end end
end end
@ -516,8 +484,6 @@ function util.set_ingredient(recipe_name, ingredient, quantity, options)
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
me.add_modified(recipe_name) me.add_modified(recipe_name)
set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity) set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
set_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
set_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
end end
end end
@ -542,47 +508,31 @@ end
function util.add_product(recipe_name, product, options) function util.add_product(recipe_name, product, options)
if not should_force(options) and bypass(recipe_name) then return end if not should_force(options) and bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] and if data.raw.recipe[recipe_name] and
(data.raw.item[product[1]] or data.raw.item[product.name] or (data.raw.item[product.name] or data.raw.fluid[product.name]) then
data.raw.fluid[product[1]] or data.raw.fluid[product.name]
) then
add_product(data.raw.recipe[recipe_name], product) add_product(data.raw.recipe[recipe_name], product)
add_product(data.raw.recipe[recipe_name].normal, product)
add_product(data.raw.recipe[recipe_name].expensive, product)
end end
end end
function add_product(recipe, product) function add_product(recipe, product)
if recipe ~= nil then if recipe ~= nil then
if (product[1] and data.raw.item[product[1]]) or
(product.name and data.raw[product.type][product.name]) then
if not recipe.normal then
if recipe.results == nil then if recipe.results == nil then
recipe.results = {{recipe.result, recipe.result_count and recipe.result_count or 1}} recipe.results = {}
end end
recipe.result = nil
recipe.result_count = nil
table.insert(recipe.results, product) table.insert(recipe.results, product)
end end
end end
end
end
-- Get the amount of the ingredient, will check base/normal not expensive -- Get the amount of the ingredient, will check base/normal not expensive
function util.get_ingredient_amount(recipe_name, ingredient_name) function util.get_ingredient_amount(recipe_name, ingredient_name)
local recipe = data.raw.recipe[recipe_name] local recipe = data.raw.recipe[recipe_name]
if recipe then if recipe then
if recipe.normal and recipe.normal.ingredients then if recipe.ingredients then
for i, ingredient in pairs(recipe.normal.ingredients) do
if ingredient[1] == ingredient_name then return ingredient[2] end
if ingredient.name == ingredient_name then return ingredient.amount end
end
elseif recipe.ingredients then
for i, ingredient in pairs(recipe.ingredients) do for i, ingredient in pairs(recipe.ingredients) do
if ingredient[1] == ingredient_name then return ingredient[2] end if ingredient[1] == ingredient_name then return ingredient[2] end
if ingredient.name == ingredient_name then return ingredient.amount end if ingredient.name == ingredient_name then return ingredient.amount end
end end
end end
return 0 return 1
end end
return 0 return 0
end end
@ -592,14 +542,7 @@ function util.get_amount(recipe_name, product)
if not product then product = recipe_name end if not product then product = recipe_name end
local recipe = data.raw.recipe[recipe_name] local recipe = data.raw.recipe[recipe_name]
if recipe then if recipe then
if recipe.normal and recipe.normal.results then if recipe.results then
for i, result in pairs(recipe.normal.results) do
if result[1] == product then return result[2] end
if result.name == product then return result.amount end
end
elseif recipe.normal and recipe.normal.result_count then
return recipe.normal.result_count
elseif recipe.results then
for i, result in pairs(recipe.results) do for i, result in pairs(recipe.results) do
if result[1] == product then return result[2] end if result[1] == product then return result[2] end
if result.name == product then return result.amount end if result.name == product then return result.amount end
@ -617,9 +560,7 @@ function util.get_result_count(recipe_name, product)
if not product then product = recipe_name end if not product then product = recipe_name end
local recipe = data.raw.recipe[recipe_name] local recipe = data.raw.recipe[recipe_name]
if recipe then if recipe then
if recipe.normal and recipe.normal.results then if recipe.results then
return #(recipe.normal.results)
elseif recipe.results then
return #(recipe.results) return #(recipe.results)
end end
return 1 return 1
@ -634,8 +575,6 @@ function util.replace_ingredient(recipe_name, old, new, amount, multiply, option
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
me.add_modified(recipe_name) me.add_modified(recipe_name)
replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply) replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply)
replace_ingredient(data.raw.recipe[recipe_name].normal, old, new, amount, multiply)
replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new, amount, multiply)
end end
end end
@ -677,8 +616,6 @@ function util.remove_ingredient(recipe_name, old, options)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
me.add_modified(recipe_name) me.add_modified(recipe_name)
remove_ingredient(data.raw.recipe[recipe_name], old) remove_ingredient(data.raw.recipe[recipe_name], old)
remove_ingredient(data.raw.recipe[recipe_name].normal, old)
remove_ingredient(data.raw.recipe[recipe_name].expensive, old)
end end
end end
@ -704,28 +641,23 @@ function util.replace_some_product(recipe_name, old, old_amount, new, new_amount
if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
me.add_modified(recipe_name) me.add_modified(recipe_name)
replace_some_product(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid) replace_some_product(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid)
replace_some_product(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount, is_fluid)
replace_some_product(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount, is_fluid)
end end
end end
function replace_some_product(recipe, old, old_amount, new, new_amount) function replace_some_product(recipe, old, old_amount, new, new_amount, is_fluid)
if recipe ~= nil then if recipe ~= nil then
if recipe.result == new then return end if recipe.result == new then return end
if recipe.results then if recipe.results then
for i, existing in pairs(recipe.results) do for i, existing in pairs(recipe.results) do
if existing[1] == new or existing.name == new then if existing.name == new then
return return
end end
end end
end end
add_product(recipe, {new, new_amount}) add_product(recipe, {type=is_fluid and "fluid" or "item", name=new, amount=new_amount})
for i, product in pairs(recipe.results) do for i, product in pairs(recipe.results) do
if product.name == old then if product.name == old then
product.amount = math.max(1, product.amount - old_amount) product.amount = math.max(1, product.amount - old_amount)
end
if product[1] == old then
product[2] = math.max(1, product[2] - old_amount)
end end
end end
end end
@ -738,8 +670,6 @@ function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amo
if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
me.add_modified(recipe_name) me.add_modified(recipe_name)
replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid) replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid)
replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount, is_fluid)
replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount, is_fluid)
end end
end end
@ -768,8 +698,6 @@ function util.set_product_amount(recipe_name, product, amount, options)
me.add_modified(recipe_name) me.add_modified(recipe_name)
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)
set_product_amount(data.raw.recipe[recipe_name].normal, product, amount)
set_product_amount(data.raw.recipe[recipe_name].expensive, product, amount)
end end
end end
@ -808,8 +736,6 @@ function util.multiply_recipe(recipe_name, multiple, options)
me.add_modified(recipe_name) me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
multiply_recipe(data.raw.recipe[recipe_name], multiple) multiply_recipe(data.raw.recipe[recipe_name], multiple)
multiply_recipe(data.raw.recipe[recipe_name].normal, multiple)
multiply_recipe(data.raw.recipe[recipe_name].expensive, multiple)
end end
end end
@ -817,8 +743,6 @@ function multiply_recipe(recipe, multiple)
if recipe then if recipe then
if recipe.energy_required then if recipe.energy_required then
recipe.energy_required = recipe.energy_required * multiple recipe.energy_required = recipe.energy_required * multiple
else
recipe.energy_required = 0.5 * multiple -- 0.5 is factorio default
end end
if recipe.result_count then if recipe.result_count then
recipe.result_count = recipe.result_count * multiple recipe.result_count = recipe.result_count * multiple
@ -833,8 +757,11 @@ function multiply_recipe(recipe, multiple)
result.amount_min = result.amount_min * multiple result.amount_min = result.amount_min * multiple
result.amount_max = result.amount_max * multiple result.amount_max = result.amount_max * multiple
end end
if result.catalyst_amount then if result.ignored_by_productivity then
result.catalyst_amount = result.catalyst_amount * multiple result.ignored_by_productivity = result.ignored_by_productivity * multiple
end
if result.ignored_by_stats then
result.ignored_by_stats = result.ignored_by_stats * multiple
end end
end end
if result[1] then if result[1] then
@ -861,9 +788,8 @@ end
-- Returns true if a recipe has an ingredient -- Returns true if a recipe has an ingredient
function util.has_ingredient(recipe_name, ingredient) function util.has_ingredient(recipe_name, ingredient)
return data.raw.recipe[recipe_name] and ( return data.raw.recipe[recipe_name] and
has_ingredient(data.raw.recipe[recipe_name], ingredient) or has_ingredient(data.raw.recipe[recipe_name], ingredient)
has_ingredient(data.raw.recipe[recipe_name].normal, ingredient))
end end
function has_ingredient(recipe, ingredient) function has_ingredient(recipe, ingredient)
@ -883,8 +809,6 @@ function util.remove_product(recipe_name, old, options)
me.add_modified(recipe_name) me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
remove_product(data.raw.recipe[recipe_name], old) remove_product(data.raw.recipe[recipe_name], old)
remove_product(data.raw.recipe[recipe_name].normal, old)
remove_product(data.raw.recipe[recipe_name].expensive, old)
end end
end end
@ -907,8 +831,6 @@ function util.set_main_product(recipe_name, product, options)
if not should_force(options) and bypass(recipe_name) then return end if not should_force(options) and bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
set_main_product(data.raw.recipe[recipe_name], product) set_main_product(data.raw.recipe[recipe_name], product)
set_main_product(data.raw.recipe[recipe_name].normal, product)
set_main_product(data.raw.recipe[recipe_name].expensive, product)
end end
end end
@ -922,13 +844,11 @@ end
function util.replace_product(recipe_name, old, new, options) function util.replace_product(recipe_name, old, new, options)
if not should_force(options) and bypass(recipe_name) then return end if not should_force(options) and bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
replace_product(data.raw.recipe[recipe_name], old, new, options) replace_product(data.raw.recipe[recipe_name], old, new)
replace_product(data.raw.recipe[recipe_name].normal, old, new, options)
replace_product(data.raw.recipe[recipe_name].expensive, old, new, options)
end end
end end
function replace_product(recipe, old, new, options) function replace_product(recipe, old, new)
if recipe then if recipe then
if recipe.main_product == old then if recipe.main_product == old then
recipe.main_product = new recipe.main_product = new
@ -968,8 +888,6 @@ function util.set_recipe_time(recipe_name, time, options)
me.add_modified(recipe_name) me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
set_recipe_time(data.raw.recipe[recipe_name], time) set_recipe_time(data.raw.recipe[recipe_name], time)
set_recipe_time(data.raw.recipe[recipe_name].normal, time)
set_recipe_time(data.raw.recipe[recipe_name].expensive, time)
end end
end end
@ -987,8 +905,6 @@ function util.multiply_time(recipe_name, factor, options)
me.add_modified(recipe_name) me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
multiply_time(data.raw.recipe[recipe_name], factor) multiply_time(data.raw.recipe[recipe_name], factor)
multiply_time(data.raw.recipe[recipe_name].normal, factor)
multiply_time(data.raw.recipe[recipe_name].expensive, factor)
end end
end end
@ -1006,8 +922,6 @@ function util.add_time(recipe_name, amount, options)
me.add_modified(recipe_name) me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
add_time(data.raw.recipe[recipe_name], amount) add_time(data.raw.recipe[recipe_name], amount)
add_time(data.raw.recipe[recipe_name].normal, amount)
add_time(data.raw.recipe[recipe_name].expensive, amount)
end end
end end
@ -1031,7 +945,7 @@ end
-- Set recipe subgroup -- Set recipe subgroup
function util.set_subgroup(recipe_name, subgroup, options) function util.set_subgroup(recipe_name, subgroup, options)
if not should_force(options) and bypass(recipe_name) then return end if not should_force(options) and bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] and data.raw["item-subgroup"][subgroup] then if data.raw.recipe[recipe_name] then
me.add_modified(recipe_name) me.add_modified(recipe_name)
data.raw.recipe[recipe_name].subgroup = subgroup data.raw.recipe[recipe_name].subgroup = subgroup
end end
@ -1050,35 +964,17 @@ function util.add_icon(recipe_name, icon, options)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
me.add_modified(recipe_name) me.add_modified(recipe_name)
if not (data.raw.recipe[recipe_name].icons and #(data.raw.recipe[recipe_name].icons) > 0) then if not (data.raw.recipe[recipe_name].icons and #(data.raw.recipe[recipe_name].icons) > 0) then
data.raw.recipe[recipe_name].icons = {}
if data.raw.recipe[recipe_name].icon then if data.raw.recipe[recipe_name].icon then
data.raw.recipe[recipe_name].icons = {{ data.raw.recipe[recipe_name].icons = {{
icon=data.raw.recipe[recipe_name].icon, icon=data.raw.recipe[recipe_name].icon,
icon_size=data.raw.recipe[recipe_name].icon_size, icon_size=data.raw.recipe[recipe_name].icon_size,
icon_mipmaps=data.raw.recipe[recipe_name].icon_mipmaps, icon_mipmaps=data.raw.recipe[recipe_name].icon_mipmaps,
}} }}
elseif data.raw.item[data.raw.recipe[recipe_name].main_product] then
data.raw.recipe[recipe_name].icons = {{
icon=data.raw.item[data.raw.recipe[recipe_name].main_product].icon,
icon_size=data.raw.item[data.raw.recipe[recipe_name].main_product].icon_size,
icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].main_product].icon_mipmaps,
}}
elseif data.raw.item[data.raw.recipe[recipe_name].result] then
data.raw.recipe[recipe_name].icons = {{
icon=data.raw.item[data.raw.recipe[recipe_name].result].icon,
icon_size=data.raw.item[data.raw.recipe[recipe_name].result].icon_size,
icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].result].icon_mipmaps,
}}
elseif data.raw.recipe[recipe_name].normal and
data.raw.item[data.raw.recipe[recipe_name].normal.result] then
data.raw.recipe[recipe_name].icons = {{
icon=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon,
icon_size=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon_size,
icon_mipmaps=data.raw.item[data.raw.recipe[recipe_name].normal.result].icon_mipmaps,
}}
end
data.raw.recipe[recipe_name].icon = nil data.raw.recipe[recipe_name].icon = nil
data.raw.recipe[recipe_name].icon_size = nil data.raw.recipe[recipe_name].icon_size = nil
end end
end
table.insert(data.raw.recipe[recipe_name].icons, icon) table.insert(data.raw.recipe[recipe_name].icons, icon)
end end
end end
@ -1137,8 +1033,6 @@ function util.add_to_ingredient(recipe, ingredient, amount, options)
if not should_force(options) and bypass(recipe_name) then return end if not should_force(options) and bypass(recipe_name) then return end
if data.raw.recipe[recipe] then if data.raw.recipe[recipe] then
add_to_ingredient(data.raw.recipe[recipe], ingredient, amount) add_to_ingredient(data.raw.recipe[recipe], ingredient, amount)
add_to_ingredient(data.raw.recipe[recipe].normal, ingredient, amount)
add_to_ingredient(data.raw.recipe[recipe].expensive, ingredient, amount)
end end
end end
@ -1161,8 +1055,6 @@ function util.add_to_product(recipe_name, product, amount, options)
if not should_force(options) and bypass(recipe_name) then return end if not should_force(options) and bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
add_to_product(data.raw.recipe[recipe_name], product, amount) add_to_product(data.raw.recipe[recipe_name], product, amount)
add_to_product(data.raw.recipe[recipe_name].normal, product, amount)
add_to_product(data.raw.recipe[recipe_name].expensive, product, amount)
end end
end end
@ -1285,14 +1177,12 @@ function remove_prior_unlocks(tech, recipe)
util.remove_recipe_effect(tech, recipe) util.remove_recipe_effect(tech, recipe)
if technology.prerequisites then if technology.prerequisites then
for i, prerequisite in pairs(technology.prerequisites) do for i, prerequisite in pairs(technology.prerequisites) do
if string.sub(prerequisite, 1, 3) ~= 'ei_' then -- log("BZZZ removing prior unlocks for " .. tech ..", checking " .. prerequisite) -- Handy Debug :|
-- log("BZZZ removing prior unlocks for " .. recipe .. " from " .. tech ..", checking " .. prerequisite) -- Handy Debug :|
remove_prior_unlocks(prerequisite, recipe) remove_prior_unlocks(prerequisite, recipe)
end end
end end
end end
end end
end
function util.replace_ingredients_prior_to(tech, old, new, multiplier) function util.replace_ingredients_prior_to(tech, old, new, multiplier)
if not data.raw.technology[tech] then if not data.raw.technology[tech] then
@ -1330,13 +1220,11 @@ function replace_ingredients_prior_to(tech, old, new, multiplier)
if technology.prerequisites then if technology.prerequisites then
for i, prerequisite in pairs(technology.prerequisites) do for i, prerequisite in pairs(technology.prerequisites) do
-- log("BZZZ checking " .. prerequisite) -- Handy Debug :| -- log("BZZZ checking " .. prerequisite) -- Handy Debug :|
if string.sub(prerequisite, 1, 3) ~= 'ei_' then
replace_ingredients_prior_to(prerequisite, old, new, multiplier) replace_ingredients_prior_to(prerequisite, old, new, multiplier)
end end
end end
end end
end end
end
function util.remove_all_recipe_effects(recipe_name) function util.remove_all_recipe_effects(recipe_name)
for name, _ in pairs(data.raw.technology) do for name, _ in pairs(data.raw.technology) do

View file

@ -1,27 +1,27 @@
{ {
"name": "bzchlorine", "name": "bzchlorine",
"version": "0.1.5", "version": "2.0.0",
"factorio_version": "1.1", "factorio_version": "2.0",
"title": "Salt & Chlorine", "title": "Salt & Chlorine",
"author": "Brevven", "author": "Brevven",
"contact": "", "contact": "",
"homepage": "", "homepage": "",
"dependencies": [ "dependencies": [
"base >= 1.1.0", "base >= 2.0.0",
"? bzfoundry >= 0.2.1", "? bzfoundry >= 2.0.0",
"? bztitanium >= 1.2.0", "? bztitanium >= 2.0.26",
"? bzlead >= 1.2.0", "? bzlead >= 2.0.28",
"? bzzirconium >= 0.6.0", "? bzzirconium >= 2.1.13",
"? bztungsten >= 0.6.0", "? bztungsten >= 0.6.0",
"? bzcarbon >= 0.5.5", "? bzcarbon >= 2.0.21",
"? bztin >= 0.1.8", "? bztin >= 2.1.15",
"? bzgas", "? bzgas >= 2.0.0",
"? space-exploration >= 0.5.100", "? space-exploration >= 0.7.34",
"? aai-industry", "? aai-industry >= 0.6.13",
"(?) aai-loaders", "(?) aai-loaders >= 0.2.7",
"? Krastorio2", "? Krastorio2 >= 2.0.8",
"? bobelectronics", "? bobelectronics",
"? MDbobelectronics", "? MDbobelectronics2",
"? deadlock-beltboxes-loaders", "? deadlock-beltboxes-loaders",
"? DeadlockCrating" "? DeadlockCrating"
], ],

View file

@ -1,15 +1,12 @@
-- Matter recipes for Krastorio2 -- Matter recipes for Krastorio2
if mods["Krastorio2"] then if mods["Krastorio2"] then
local util = require("data-util"); local matter = require("__Krastorio2__/prototypes/libraries/matter");
local salt_matter = {
util.k2matter({ material = { type = "item", name = "salt", amount = 1 },
k2matter = { matter_count = 2,
item_name = "salt",
matter_value = 2,
energy_required = 1, energy_required = 1,
need_stabilizer = false, need_stabilizer = false,
unlocked_by_technology = "salt-matter-processing", unlocked_by_technology = "salt-matter-processing",
}, }
icon = {icon = "__bzchlorine__/graphics/icons/salt.png", icon_size = 128, scale = 1} matter.make_recipes(salt_matter)
})
end end

View file

@ -1,16 +1,7 @@
-- Enable prod modules for some recipes local util = require("data-util");
local util = require("data-util")
for i, recipe in pairs(util.me.recipes) do for i, recipe in pairs(util.me.recipes) do
if data.raw.recipe[recipe] then if data.raw.recipe[recipe] then
for j, module in pairs(data.raw.module) do data.raw.recipe[recipe].allow_productivity = true
if module.effect then
for effect_name, effect in pairs(module.effect) do
if effect_name == "productivity" and effect.bonus > 0 and module.limitation and #module.limitation > 0 then
table.insert(module.limitation, recipe)
end
end
end
end
end end
end end

View file

@ -6,26 +6,15 @@ if util.me.early_assemblers() then
data.raw["assembling-machine"]["assembling-machine-1"].fluid_boxes = futil.table.deepcopy(data.raw["assembling-machine"]["assembling-machine-2"].fluid_boxes) data.raw["assembling-machine"]["assembling-machine-1"].fluid_boxes = futil.table.deepcopy(data.raw["assembling-machine"]["assembling-machine-2"].fluid_boxes)
for i, fb in pairs(data.raw["assembling-machine"]["assembling-machine-1"].fluid_boxes) do for i, fb in pairs(data.raw["assembling-machine"]["assembling-machine-1"].fluid_boxes) do
if i ~= "off_when_no_fluid_recipe" and fb.pipe_picture then if i ~= "off_when_no_fluid_recipe" and fb.pipe_picture then
fb.pipe_picture.north.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-N.png" fb.pipe_picture.north.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png"
fb.pipe_picture.south.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-S.png" fb.pipe_picture.south.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png"
fb.pipe_picture.east.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-E.png" fb.pipe_picture.east.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png"
fb.pipe_picture.west.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-W.png" fb.pipe_picture.west.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png"
if fb.pipe_picture.north.hr_version then
fb.pipe_picture.north.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png"
fb.pipe_picture.south.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png"
fb.pipe_picture.east.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png"
fb.pipe_picture.west.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png"
end
if fb.pipe_picture.north.layers and fb.pipe_picture.north.layers[1] then if fb.pipe_picture.north.layers and fb.pipe_picture.north.layers[1] then
fb.pipe_picture.north.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-N.png" fb.pipe_picture.north.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png"
fb.pipe_picture.south.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-S.png" fb.pipe_picture.south.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png"
fb.pipe_picture.east.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-E.png" fb.pipe_picture.east.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png"
fb.pipe_picture.west.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-W.png" fb.pipe_picture.west.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png"
fb.pipe_picture.north.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png"
fb.pipe_picture.south.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png"
fb.pipe_picture.east.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png"
fb.pipe_picture.west.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png"
fb.pipe_picture.north.layers[2] = nil fb.pipe_picture.north.layers[2] = nil
fb.pipe_picture.south.layers[2] = nil fb.pipe_picture.south.layers[2] = nil
fb.pipe_picture.east.layers[2] = nil fb.pipe_picture.east.layers[2] = nil
@ -38,25 +27,15 @@ if util.me.early_assemblers() then
data.raw["assembling-machine"]["burner-assembling-machine"].fluid_boxes = futil.table.deepcopy(data.raw["assembling-machine"]["assembling-machine-2"].fluid_boxes) data.raw["assembling-machine"]["burner-assembling-machine"].fluid_boxes = futil.table.deepcopy(data.raw["assembling-machine"]["assembling-machine-2"].fluid_boxes)
for i, fb in pairs(data.raw["assembling-machine"]["burner-assembling-machine"].fluid_boxes) do for i, fb in pairs(data.raw["assembling-machine"]["burner-assembling-machine"].fluid_boxes) do
if i ~= "off_when_no_fluid_recipe" and fb.pipe_picture then if i ~= "off_when_no_fluid_recipe" and fb.pipe_picture then
fb.pipe_picture.north.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-N.png" fb.pipe_picture.north.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png"
fb.pipe_picture.south.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-S.png" fb.pipe_picture.south.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png"
fb.pipe_picture.east.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-E.png" fb.pipe_picture.east.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png"
fb.pipe_picture.west.filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-W.png" fb.pipe_picture.west.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png"
if fb.pipe_picture.north.hr_version then
fb.pipe_picture.north.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png"
fb.pipe_picture.south.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png"
fb.pipe_picture.east.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png"
fb.pipe_picture.west.hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png"
end
if fb.pipe_picture.north.layers and fb.pipe_picture.north.layers[1] then if fb.pipe_picture.north.layers and fb.pipe_picture.north.layers[1] then
fb.pipe_picture.north.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-N.png" fb.pipe_picture.north.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png"
fb.pipe_picture.south.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-S.png" fb.pipe_picture.south.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png"
fb.pipe_picture.east.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-E.png" fb.pipe_picture.east.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png"
fb.pipe_picture.west.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/assembling-machine-2-pipe-W.png" fb.pipe_picture.west.layers[1].filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png"
fb.pipe_picture.north.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-N.png"
fb.pipe_picture.south.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-S.png"
fb.pipe_picture.east.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-E.png"
fb.pipe_picture.west.layers[1].hr_version.filename = "__bzchlorine__/graphics/entity/assembler/hr-assembling-machine-2-pipe-W.png"
fb.pipe_picture.north.layers[2] = nil fb.pipe_picture.north.layers[2] = nil
fb.pipe_picture.south.layers[2] = nil fb.pipe_picture.south.layers[2] = nil
fb.pipe_picture.east.layers[2] = nil fb.pipe_picture.east.layers[2] = nil

View file

@ -1,12 +1,16 @@
local util = require("data-util"); local util = require("data-util");
local cl_name = mods.Krastorio2 and "kr-chlorine" or "chlorine"
local hcl_name = mods.Krastorio2 and "kr-hydrogen-chloride" or "hydrogen-chloride"
if not mods.Krastorio2 then if not mods.Krastorio2 then
data:extend({ data:extend({
{ {
type = "fluid", type = "fluid",
name = "chlorine", name = cl_name,
default_temperature = 25, default_temperature = 25,
heat_capacity = "0.1KJ", heat_capacity = "0.1kJ",
base_color = {r=0.60, g=0.90, b=0.50}, base_color = {r=0.60, g=0.90, b=0.50},
flow_color = {r=0.60, g=1.00, b=0.50}, flow_color = {r=0.60, g=1.00, b=0.50},
icon = "__bzchlorine__/graphics/icons/chlorine.png", icon = "__bzchlorine__/graphics/icons/chlorine.png",
@ -15,9 +19,9 @@ data:extend({
}, },
{ {
type = "fluid", type = "fluid",
name = "hydrogen-chloride", name = hcl_name,
default_temperature = 25, default_temperature = 25,
heat_capacity = "0.1KJ", heat_capacity = "0.1kJ",
base_color = {r=0.80, g=0.90, b=0.70}, base_color = {r=0.80, g=0.90, b=0.70},
flow_color = {r=0.80, g=1.00, b=0.70}, flow_color = {r=0.80, g=1.00, b=0.70},
icon = "__bzchlorine__/graphics/icons/hcl.png", icon = "__bzchlorine__/graphics/icons/hcl.png",
@ -36,13 +40,13 @@ data:extend({
icon_size = 64, icon_mipmaps = 4, icon_size = 64, icon_mipmaps = 4,
subgroup = "raw-material", subgroup = "raw-material",
order = "b[chlorine-fe]", order = "b[chlorine-fe]",
stack_size = util.get_stack_size(100), stack_size = 100,
}, },
{ {
type = "fluid", type = "fluid",
name = "vinyl-chloride", name = "vinyl-chloride",
default_temperature = 25, default_temperature = 25,
heat_capacity = "0.1KJ", heat_capacity = "0.1kJ",
base_color = {r=0.90, g=0.90, b=0.75}, base_color = {r=0.90, g=0.90, b=0.75},
flow_color = {r=0.90, g=1.00, b=0.75}, flow_color = {r=0.90, g=1.00, b=0.75},
icon = "__bzchlorine__/graphics/icons/vinyl-chloride.png", icon = "__bzchlorine__/graphics/icons/vinyl-chloride.png",
@ -56,9 +60,9 @@ if not mods.Krastorio2 then
data:extend({ data:extend({
{ {
type = "recipe", type = "recipe",
name = "chlorine", name = cl_name,
results = {{type="fluid", name="chlorine", amount=10}}, results = {{type="fluid", name=cl_name, amount=10}},
ingredients = {{"salt", 2}}, ingredients = {{type="item", name="salt", amount=2}},
enabled = false, enabled = false,
category = "chemistry", category = "chemistry",
subgroup = "fluid-recipes", subgroup = "fluid-recipes",
@ -67,10 +71,10 @@ data:extend({
{ {
type = "recipe", type = "recipe",
name = "hydrogen-chloride-pure", name = "hydrogen-chloride-pure",
results = {{type="fluid", name="hydrogen-chloride", amount=20}}, results = {{type="fluid", name=hcl_name, amount=20}},
ingredients = { ingredients = {
{type="fluid", name="water", amount=10}, {type="fluid", name="water", amount=10},
{type="fluid", name="chlorine", amount=10}, {type="fluid", name=cl_name, amount=10},
}, },
enabled = false, enabled = false,
category = "chemistry", category = "chemistry",
@ -79,7 +83,7 @@ data:extend({
}, },
}) })
else else
util.replace_ingredient("kr-water-electrolysis", "sand", "salt", 2) util.replace_ingredient("kr-water-electrolysis", "kr-sand", "salt", 2)
if util.se6() then if util.se6() then
util.multiply_time("kr-water-electrolysis", 5.0/28) util.multiply_time("kr-water-electrolysis", 5.0/28)
else else
@ -90,9 +94,9 @@ data:extend({
{ {
type = "recipe", type = "recipe",
name = "hydrogen-chloride-salt", name = "hydrogen-chloride-salt",
results = {{type="fluid", name="hydrogen-chloride", amount=10}}, results = {{type="fluid", name=hcl_name, amount=10}},
ingredients = { ingredients = {
{"salt", 1}, {type="item", name="salt", amount=1},
{type="fluid", name="water", amount=5}, {type="fluid", name="water", amount=5},
{type="fluid", name="sulfuric-acid", amount=5}, {type="fluid", name="sulfuric-acid", amount=5},
}, },
@ -108,10 +112,10 @@ data:extend({
{ {
type = "recipe", type = "recipe",
name = "ferric-chloride", name = "ferric-chloride",
results = {{"ferric-chloride", 2}}, results = {{type="item", name="ferric-chloride", amount=2}},
ingredients = { ingredients = {
{"iron-plate", 2}, {type="item", name="iron-plate", amount=2},
{type="fluid", name="chlorine", amount=30}, {type="fluid", name=cl_name, amount=30},
}, },
enabled = false, enabled = false,
category = "chemistry", category = "chemistry",
@ -120,14 +124,14 @@ data:extend({
{ {
type = "recipe", type = "recipe",
name = "ferric-chloride-hcl", name = "ferric-chloride-hcl",
results = {{"ferric-chloride", 4}}, results = {{type="item", name="ferric-chloride", amount=4}},
icons = { icons = {
{icon = "__bzchlorine__/graphics/icons/ferric-chloride.png", icon_size=64, scale=1}, {icon = "__bzchlorine__/graphics/icons/ferric-chloride.png", icon_size=64, scale=1},
{icon = "__bzchlorine__/graphics/icons/hcl.png", icon_size=128, scale=0.25, shift={8,-8}}, {icon = "__bzchlorine__/graphics/icons/hcl.png", icon_size=128, scale=0.25, shift={8,-8}},
}, },
ingredients = { ingredients = {
{"iron-ore", 1}, {type="item", name="iron-ore", amount=1},
{type="fluid", name="hydrogen-chloride", amount=120}, {type="fluid", name=hcl_name, amount=120},
}, },
enabled = false, enabled = false,
category = "chemistry", category = "chemistry",
@ -138,7 +142,7 @@ data:extend({
name = "vinyl-chloride", name = "vinyl-chloride",
results = {{type="fluid", name="vinyl-chloride", amount=20}}, results = {{type="fluid", name="vinyl-chloride", amount=20}},
ingredients = { ingredients = {
{type="fluid", name="chlorine", amount=10}, {type="fluid", name=cl_name, amount=10},
{type="fluid", name="petroleum-gas", amount=20}, {type="fluid", name="petroleum-gas", amount=20},
}, },
enabled = false, enabled = false,
@ -159,7 +163,7 @@ data:extend({
{icon = "__bzchlorine__/graphics/technology/salt-tech.png", icon_size = 256, tint={a=.75,r=1,b=1,g=1} }, {icon = "__bzchlorine__/graphics/technology/salt-tech.png", icon_size = 256, tint={a=.75,r=1,b=1,g=1} },
}, },
effects = { effects = {
{ type = "unlock-recipe", recipe = "chlorine" }, { type = "unlock-recipe", recipe = cl_name },
{ type = "unlock-recipe", recipe = "hydrogen-chloride-salt" }, { type = "unlock-recipe", recipe = "hydrogen-chloride-salt" },
{ type = "unlock-recipe", recipe = "hydrogen-chloride-pure" }, { type = "unlock-recipe", recipe = "hydrogen-chloride-pure" },
}, },
@ -185,11 +189,12 @@ if mods.bzgas then
{ {
type="recipe", type="recipe",
name="bakelite-hcl", name="bakelite-hcl",
results = {{"bakelite", 3}}, localised_name = { "item-name.bakelite" },
results = {{type="item", name="bakelite", amount=3}},
ingredients = { ingredients = {
{data.raw.item["phenol"] and "phenol" or "coal", 1}, {type="item", name=data.raw.item["phenol"] and "phenol" or "coal", amount=1},
{type="fluid", name="formaldehyde", amount=10}, {type="fluid", name="formaldehyde", amount=10},
{type="fluid", name="hydrogen-chloride", amount=5}, {type="fluid", name=hcl_name, amount=5},
}, },
icons = { icons = {
{icon = "__bzgas__/graphics/icons/bakelite.png", icon_size=128}, {icon = "__bzgas__/graphics/icons/bakelite.png", icon_size=128},

View file

@ -1,11 +1,13 @@
local util = require("data-util"); local util = require("data-util");
local cl_name = mods.Krastorio2 and "kr-chlorine" or cl_name
data:extend({ data:extend({
{ {
type = "fluid", type = "fluid",
name = "epoxy", name = "epoxy",
default_temperature = 25, default_temperature = 25,
heat_capacity = "0.1KJ", heat_capacity = "0.1kJ",
base_color = {r=0.90, g=0.95, b=0.90}, base_color = {r=0.90, g=0.95, b=0.90},
flow_color = {r=0.90, g=1.00, b=0.90}, flow_color = {r=0.90, g=1.00, b=0.90},
icon = "__bzchlorine__/graphics/icons/epoxy.png", icon = "__bzchlorine__/graphics/icons/epoxy.png",
@ -20,11 +22,11 @@ data:extend({
name = "epoxy", name = "epoxy",
results = { results = {
{type="fluid", name="epoxy", amount=10}, {type="fluid", name="epoxy", amount=10},
{"salt", 1}, {type="item", name="salt", amount=1},
}, },
main_product = "epoxy", main_product = "epoxy",
ingredients = { ingredients = {
{type="fluid", name="chlorine", amount=10}, {type="fluid", name=cl_name, amount=10},
{type="fluid", name="petroleum-gas", amount=10}, {type="fluid", name="petroleum-gas", amount=10},
}, },
enabled = false, enabled = false,

View file

@ -1,5 +1,7 @@
local util = require("data-util"); local util = require("data-util");
local hcl_name = mods.Krastorio2 and "kr-hydrogen-chloride" or hcl_name
data:extend({ data:extend({
{ {
type = "item", type = "item",
@ -8,10 +10,10 @@ data:extend({
icon_size = 128, icon_size = 128,
subgroup = "intermediate-product", subgroup = "intermediate-product",
order = "f[advanced-circuit][pcb-substrate]", order = "f[advanced-circuit][pcb-substrate]",
stack_size = util.get_stack_size(200), stack_size = 200,
}, },
}) })
if (not mods.bobelectronics and not mods.MDbobelectronics) then if not (mods.bobelectronics or mods.MDbobelectronics or mods.MDbobelectronics2) then
data:extend({ data:extend({
{ {
type = "item", type = "item",
@ -20,7 +22,7 @@ data:extend({
icon_size = 128, icon_size = 128,
subgroup = "intermediate-product", subgroup = "intermediate-product",
order = "f[advanced-circuit][pcb]", order = "f[advanced-circuit][pcb]",
stack_size = util.get_stack_size(200), stack_size = 200,
}, },
}) })
@ -31,44 +33,44 @@ data:extend({
type = "recipe", type = "recipe",
name = "pcb-substrate", name = "pcb-substrate",
results = { results = {
{"pcb-substrate", 12}, {type="item", name="pcb-substrate", amount=12},
}, },
ingredients = { ingredients = {
{type="fluid", name="epoxy", amount=30}, {type="fluid", name="epoxy", amount=30},
{"plastic-bar", 3}, {type="item", name="plastic-bar", amount=3},
}, },
enabled = false, enabled = false,
category = "chemistry", category = "chemistry",
energy_required = 6, energy_required = 6,
}, },
}) })
util.add_unlock("advanced-electronics", "pcb-substrate") util.add_unlock("advanced-circuit", "pcb-substrate")
-- These updates should be in data phase -- These updates should be in data phase
util.replace_some_ingredient("pcb-substrate", "plastic-bar", 1, "silica", 3, {force=true}) util.replace_some_ingredient("pcb-substrate", "plastic-bar", 1, "silica", 3, {force=true})
if (not mods.bobelectronics and not mods.MDbobelectronics) then if not (mods.bobelectronics or mods.MDbobelectronics or mods.MDbobelectronics2) then
data:extend({ data:extend({
{ {
type = "recipe", type = "recipe",
name = "pcb", name = "pcb",
results = { results = {
{"pcb", 4}, {type="item", name="pcb", amount=4},
}, },
ingredients = util.me.more() and { ingredients = util.me.more() and {
{"pcb-substrate", 4}, {type="item", name="pcb-substrate", amount=4},
{"copper-plate", 1}, {type="item", name="copper-plate", amount=1},
{"ferric-chloride", 2}, {type="item", name="ferric-chloride", amount=2},
{type="fluid", name="water", amount=20}, {type="fluid", name="water", amount=20},
} or { } or {
{"pcb-substrate", 4}, {type="item", name="pcb-substrate", amount=4},
{"copper-plate", 1}, {type="item", name="copper-plate", amount=1},
{type="fluid", name="hydrogen-chloride", amount=30} {type="fluid", name=hcl_name, amount=30}
}, },
enabled = false, enabled = false,
category = "crafting-with-fluid", category = "crafting-with-fluid",
energy_required = 8, energy_required = 8,
}, },
}) })
util.add_unlock("advanced-electronics", "pcb") util.add_unlock("advanced-circuit", "pcb")
end end

View file

@ -1,5 +1,4 @@
local resource_autoplace = require('resource-autoplace'); local resource_autoplace = require('resource-autoplace');
local noise = require('noise');
local futil = require("util"); local futil = require("util");
local util = require("data-util"); local util = require("data-util");
@ -13,7 +12,6 @@ particle.name = "salt-particle"
for i, picture in ipairs(particle.pictures) do for i, picture in ipairs(particle.pictures) do
local tint = {r=1, g=1, b=1, a=0} local tint = {r=1, g=1, b=1, a=0}
picture.tint = tint picture.tint = tint
picture.hr_version.tint = tint
end end
data:extend({particle}) data:extend({particle})
@ -27,10 +25,6 @@ data:extend({
order = "b-e" order = "b-e"
}, },
{ {
type = "noise-layer",
name = "salt"
},
{
type = "resource", type = "resource",
icon_size = 128, icon_size = 128,
name = "salt", name = "salt",
@ -64,13 +58,6 @@ data:extend({
{ {
sheet = sheet =
{ {
filename = "__bzchlorine__/graphics/entity/ores/salt.png",
priority = "extra-high",
size = 64,
frame_count = 8,
variation_count = 8,
hr_version =
{
filename = "__bzchlorine__/graphics/entity/ores/hr-salt.png", filename = "__bzchlorine__/graphics/entity/ores/hr-salt.png",
priority = "extra-high", priority = "extra-high",
size = 128, size = 128,
@ -78,7 +65,6 @@ data:extend({
variation_count = 8, variation_count = 8,
scale = 0.5 scale = 0.5
} }
}
}, },
}, },
}) })
@ -86,24 +72,24 @@ data:extend({
local richness = data.raw.resource["salt"].autoplace.richness_expression local richness = data.raw.resource["salt"].autoplace.richness_expression
local probability = data.raw.resource["salt"].autoplace.probability_expression local probability = data.raw.resource["salt"].autoplace.probability_expression
if not util.me.starting_patch() then --if not util.me.starting_patch() then
-- Modify salt autoplace richness: -- -- Modify salt autoplace richness:
-- After 500 tiles it's standard -- -- After 500 tiles it's standard
-- After 250 tiles it scales up -- -- After 250 tiles it scales up
data.raw.resource["salt"].autoplace.richness_expression = -- data.raw.resource["salt"].autoplace.richness_expression =
richness * noise.if_else_chain( -- richness * noise.if_else_chain(
noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(500)), -- noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(500)),
(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")) - 275)/475, -- (noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")) - 275)/475,
1) -- 1)
--
data.raw.resource["salt"].autoplace.probability_expression = -- data.raw.resource["salt"].autoplace.probability_expression =
probability * noise.if_else_chain( -- probability * noise.if_else_chain(
noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(249)), -- noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(249)),
0, -- 0,
noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(250)), -- noise.less_than(noise.distance_from(noise.var("x"), noise.var("y"), noise.var("starting_positions")), noise.to_noise_expression(250)),
0.3, -- 0.3,
1) -- 1)
end --end
end end
data:extend({ data:extend({
@ -113,20 +99,20 @@ data:extend({
icon_size = 128, icon_size = 128,
icon = "__bzchlorine__/graphics/icons/salt.png", icon = "__bzchlorine__/graphics/icons/salt.png",
pictures = { pictures = {
{filename="__bzchlorine__/graphics/icons/salt.png", size=128, scale=0.125}, {filename="__bzchlorine__/graphics/icons/salt.png", size=128, scale=0.25},
{filename="__bzchlorine__/graphics/icons/salt-1.png", size=128, scale=0.125}, {filename="__bzchlorine__/graphics/icons/salt-1.png", size=128, scale=0.25},
{filename="__bzchlorine__/graphics/icons/salt-2.png", size=128, scale=0.125}, {filename="__bzchlorine__/graphics/icons/salt-2.png", size=128, scale=0.25},
{filename="__bzchlorine__/graphics/icons/salt-3.png", size=128, scale=0.125}, {filename="__bzchlorine__/graphics/icons/salt-3.png", size=128, scale=0.25},
{filename="__bzchlorine__/graphics/icons/salt-4.png", size=128, scale=0.125}, {filename="__bzchlorine__/graphics/icons/salt-4.png", size=128, scale=0.25},
}, },
subgroup = "raw-resource", subgroup = "raw-resource",
order = "t-c-a", order = "t-c-a",
stack_size = util.get_stack_size(50) stack_size = 50
}, },
{ {
type = "recipe", type = "recipe",
name = "salt", name = "salt",
result = "salt", results = {{type="item", name="salt", amount=1}},
ingredients = {{type="fluid", name="water", amount=100}}, ingredients = {{type="fluid", name="water", amount=100}},
enabled = not not mods["aai-industry"], enabled = not not mods["aai-industry"],
category = "crafting-with-fluid", category = "crafting-with-fluid",
@ -138,10 +124,10 @@ if mods.Krastorio2 then
{ {
type = "recipe", type = "recipe",
name = "salt-filtration", name = "salt-filtration",
result = "salt", results = {{type="item", name="salt", amount=1}},
ingredients = {{type="fluid", name="water", amount=100}}, ingredients = {{type="fluid", name="water", amount=100}},
enabled = false, enabled = false,
category = mods.Krastorio2 and "fluid-filtration", category = mods.Krastorio2 and "kr-fluid-filtration",
energy_required = 0.4, energy_required = 0.4,
}, },
}) })

View file

@ -23,7 +23,7 @@ util.add_ingredient("uranium-processing", "salt", 1)
if mods.Krastorio2 or util.is_foundry() then if mods.Krastorio2 or util.is_foundry() then
util.replace_some_ingredient("steel-plate", "iron-plate", 1, "salt", 1) util.replace_some_ingredient("steel-plate", "iron-plate", 1, "salt", 1)
end end
util.add_ingredient("kr-biomass-growing", "salt", 1) util.add_ingredient("kr-biomass", "salt", 1)
util.add_ingredient("kr-energy-storage", "ferric-chloride", 10) util.add_ingredient("kr-energy-storage", "ferric-chloride", 10)
-- Space Exploration -- Space Exploration
@ -39,16 +39,16 @@ if not mods.Krastorio2 then
util.add_product("se-iridium-powder", {type="fluid", name="chlorine", amount=19, catalyst_amount=19}) util.add_product("se-iridium-powder", {type="fluid", name="chlorine", amount=19, catalyst_amount=19})
end end
util.replace_some_ingredient("se-vitamelange-bloom", "sand", 10, "salt", 1) util.replace_some_ingredient("se-vitamelange-bloom", mods["Krastorio2"] and "kr-sand" or "sand", 10, "salt", 1)
util.add_ingredient("se-nutrient-gel", "salt", 1) util.add_ingredient("se-nutrient-gel", "salt", 1)
util.add_ingredient("se-vitalic-epoxy", "epoxy", 16) util.add_ingredient("se-vitalic-epoxy", "epoxy", 16)
util.multiply_recipe("se-space-water", 10) util.multiply_recipe("se-space-water", 10)
util.replace_some_ingredient("se-space-water", "water", 10, "salt", 1) util.replace_some_ingredient("se-space-water", "water", 10, "salt", 1)
util.add_ingredient("se-bio-sludge-decontamination", "chlorine", 1) util.add_ingredient("se-bio-sludge-decontamination", mods.Krastorio2 and "kr-chloring" or "chlorine", 1)
util.add_ingredient("se-bio-electrics-data", "salt", 1) util.add_ingredient("se-bio-electrics-data", "salt", 1)
util.add_ingredient("se-holmium-chloride", "hydrogen-chloride", 2) util.add_ingredient("se-holmium-chloride", mods["Krastorio2"] and "kr-hydrogen-chloride" or "hydrogen-chloride", 2)
util.replace_some_ingredient("se-space-coolant", "copper-plate", 1, "salt", 1) util.replace_some_ingredient("se-space-coolant", "copper-plate", 1, "salt", 1)
util.replace_some_ingredient("se-space-coolant-cryonite", "copper-plate", 1, "salt", 1) util.replace_some_ingredient("se-space-coolant-cryonite", "copper-plate", 1, "salt", 1)