updates, working well

This commit is contained in:
Brevven 2022-08-08 19:47:00 -07:00
parent 473206ff01
commit 2d59a511b0
24 changed files with 796 additions and 67 deletions

View file

@ -1,5 +1,6 @@
local util = require("data-util");
if not mods.Krastorio2 then
data:extend({
{
type = "fluid",
@ -23,17 +24,35 @@ data:extend({
icon_size = 128,
order = "a[fluid]-f[chlorine-h]",
},
})
end
if util.me.more() then
data:extend({
{
type = "item",
name = "ferric-chloride",
icon = "__bztin__/graphics/icons/solder.png", -- FIX
icon_size = 128,
icon = "__bzchlorine__/graphics/icons/ferric-chloride.png",
icon_size = 64, icon_mipmaps = 4,
subgroup = "raw-material",
order = "b[chlorine-fe]",
stack_size = util.get_stack_size(100),
},
{
type = "fluid",
name = "vinyl-chloride",
default_temperature = 25,
heat_capacity = "0.1KJ",
base_color = {r=0.90, g=0.90, b=0.75},
flow_color = {r=0.90, g=1.00, b=0.75},
icon = "__bzchlorine__/graphics/icons/vinyl-chloride.png",
icon_size = 128,
order = "a[fluid]-f[chlorine-v]",
},
})
end
if not mods.Krastorio2 then
data:extend({
{
type = "recipe",
@ -42,20 +61,7 @@ data:extend({
ingredients = {{"salt", 2}},
enabled = false,
category = "chemistry",
energy_requires = 3,
},
{
type = "recipe",
name = "hydrogen-chloride",
results = {{type="fluid", name="hydrogen-chloride", amount=10}},
ingredients = {
{"salt", 1},
{type="fluid", name="water", amount=5},
{type="fluid", name="sulfuric-acid", amount=5},
},
enabled = false,
category = "chemistry",
energy_requires = 1,
energy_required = 0.5,
},
{
type = "recipe",
@ -67,8 +73,30 @@ data:extend({
},
enabled = false,
category = "chemistry",
energy_requires = 10,
energy_required = 10,
},
})
else
util.replace_ingredient("kr-water-electrolysis", "sand", "salt", 2)
end
data:extend({
{
type = "recipe",
name = "hydrogen-chloride-salt",
results = {{type="fluid", name="hydrogen-chloride", amount=10}},
ingredients = {
{"salt", 1},
{type="fluid", name="water", amount=5},
{type="fluid", name="sulfuric-acid", amount=5},
},
enabled = false,
category = "chemistry",
energy_required = 1,
},
})
if util.me.more() then
data:extend({
{
type = "recipe",
name = "ferric-chloride",
@ -79,10 +107,25 @@ data:extend({
},
enabled = false,
category = "chemistry",
energy_requires = 3,
energy_required = 3,
},
{
type = "recipe",
name = "vinyl-chloride",
results = {{type="fluid", name="vinyl-chloride", amount=20}},
ingredients = {
{type="fluid", name="chlorine", amount=10},
{type="fluid", name="petroleum-gas", amount=20},
},
enabled = false,
category = "chemistry",
energy_required = 3,
},
})
end
util.add_unlock("plastics", "vinyl-chloride")
if not mods.Krastorio2 then
data:extend({
{
type="technology",
@ -91,10 +134,8 @@ data:extend({
icon_size = 128,
effects = {
{ type = "unlock-recipe", recipe = "chlorine" },
{ type = "unlock-recipe", recipe = "hydrogen-chloride" },
{ type = "unlock-recipe", recipe = "hydrogen-chloride-salt" },
{ type = "unlock-recipe", recipe = "hydrogen-chloride-pure" },
{ type = "unlock-recipe", recipe = "ferric-chloride" },
{ type = "unlock-recipe", recipe = "chemical-plant" },
},
unit = {
count = 70, time = 30,
@ -103,3 +144,38 @@ data:extend({
prerequisites = {"fluid-handling"},
},
})
util.add_unlock("salt-processing", "ferric-chloride")
util.add_unlock("fluid-handling", "chemical-plant")
util.remove_recipe_effect("oil-processing", "chemical-plant")
else
util.add_unlock("fluids-chemistry", "ferric-chloride")
util.add_unlock("fluids-chemistry", "hydrogen-chloride-salt")
end
if mods.bzgas then
data:extend({
{
type="recipe",
name="bakelite-hcl",
results = {{"bakelite", 3}},
ingredients = {
{"phenol", 1},
{type="fluid", name="formaldehyde", amount=10},
{type="fluid", name="hydrogen-chloride", amount=5},
},
icons = {
{icon = "__bzgas__/graphics/icons/bakelite.png", icon_size=128},
{icon = "__bzchlorine__/graphics/icons/hcl.png", icon_size=128, scale=0.125, shift={-8,-8}},
},
enabled = false,
category = "chemistry",
energy_required = 3,
}
})
if mods.Krastorio2 then
util.add_unlock("advanced-chemistry", "bakelite-hcl")
else
util.add_unlock("salt-processing", "bakelite-hcl")
end
end

View file

@ -5,5 +5,9 @@
local util = require("data-util");
local pg_amt = util.get_ingredient_amount("plastic-bar", "petroleum-gas")
util.replace_ingredient("plastic-bar", "petroleum-gas", "vinyl-chloride", pg_amt*2/3)
-- Must be last
util.create_list()

View file

@ -23,6 +23,27 @@ else
util.titanium_processing = "titanium-processing"
end
function get_setting(name)
if settings.startup[name] == nil then
return nil
end
return settings.startup[name].value
end
allbypass = {}
if get_setting("bz-recipe-bypass") then
for recipe in string.gmatch(me.get_setting("bz-recipe-bypass"), '[^",%s]+') do
allbypass[recipe] = true
end
end
function bypass(recipe_name)
if me.bypass[recipe_name] then return true end
if allbypass[recipe_name] then return true end
if get_setting("bz-tabula-rasa") then return true end
end
function util.fe_plus(sub)
if mods["FactorioExtended-Plus-"..sub] then
return true
@ -159,7 +180,7 @@ end
-- Add a given quantity of ingredient to a given recipe
function util.add_or_add_to_ingredient(recipe_name, ingredient, quantity)
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
me.add_modified(recipe_name)
add_or_add_to_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
@ -182,7 +203,7 @@ end
-- Add a given quantity of ingredient to a given recipe
function util.add_ingredient(recipe_name, ingredient, quantity)
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
local is_fluid = not not data.raw.fluid[ingredient]
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then
me.add_modified(recipe_name)
@ -209,7 +230,7 @@ end
-- Add a given ingredient prototype to a given recipe
function util.add_ingredient_raw(recipe_name, ingredient)
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient.name] or data.raw.item[ingredient[1]]) then
me.add_modified(recipe_name)
add_ingredient_raw(data.raw.recipe[recipe_name], ingredient)
@ -234,7 +255,7 @@ end
-- Set an ingredient to a given quantity
function util.set_ingredient(recipe_name, ingredient, quantity)
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
me.add_modified(recipe_name)
set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
@ -262,6 +283,7 @@ end
-- Add a given quantity of product to a given recipe.
-- Only works for recipes with multiple products
function util.add_product(recipe_name, product)
if bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] and (data.raw.item[product[1]] or data.raw.item[product.name]) then
add_product(data.raw.recipe[recipe_name], product)
add_product(data.raw.recipe[recipe_name].normal, product)
@ -282,6 +304,26 @@ function add_product(recipe, product)
end
end
-- Get the amount of the ingredient, will check base/normal not expensive
function util.get_ingredient_amount(recipe_name, ingredient_name)
local recipe = data.raw.recipe[recipe_name]
if recipe then
if recipe.normal and recipe.normal.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
if ingredient[1] == ingredient_name then return ingredient[2] end
if ingredient.name == ingredient_name then return ingredient.amount end
end
end
return 1
end
return 0
end
-- Get the amount of the result, will check base/normal not expensive
function util.get_amount(recipe_name, product)
if not product then product = recipe_name end
@ -308,17 +350,18 @@ function util.get_amount(recipe_name, product)
end
-- Replace one ingredient with another in a recipe
function util.replace_ingredient(recipe_name, old, new, amount)
if me.bypass[recipe_name] then return end
-- 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)
if bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then
me.add_modified(recipe_name)
replace_ingredient(data.raw.recipe[recipe_name], old, new, amount)
replace_ingredient(data.raw.recipe[recipe_name].normal, old, new, amount)
replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new, amount)
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
function replace_ingredient(recipe, old, new, amount)
function replace_ingredient(recipe, old, new, amount, multiply)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing[1] == new or existing.name == new then
@ -328,11 +371,23 @@ function replace_ingredient(recipe, old, new, amount)
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == old then
ingredient.name = new
if amount then ingredient.amount = amount end
if amount then
if multiply then
ingredient.amount = amount * ingredient.amount
else
ingredient.amount = amount
end
end
end
if ingredient[1] == old then
ingredient[1] = new
if amount then ingredient[2] = amount end
if amount then
if multiply then
ingredient[2] = amount * ingredient[2]
else
ingredient[2] = amount
end
end
end
end
end
@ -340,7 +395,7 @@ end
-- Remove an ingredient from a recipe
function util.remove_ingredient(recipe_name, old)
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] then
me.add_modified(recipe_name)
remove_ingredient(data.raw.recipe[recipe_name], old)
@ -366,7 +421,7 @@ end
-- Replace an amount of an ingredient in a recipe. Keep at least 1 of old.
function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amount)
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
local is_fluid = not not data.raw.fluid[new]
if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
me.add_modified(recipe_name)
@ -395,11 +450,51 @@ function replace_some_ingredient(recipe, old, old_amount, new, new_amount, is_fl
end
end
-- set the amount of a product.
function util.set_product_amount(recipe_name, product, amount)
me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then
if bypass(recipe_name) then return end
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
function set_product_amount(recipe, product, amount)
if recipe then
if recipe.result_count then
recipe.result_count = amount
end
if recipe.results then
for i, result in pairs(recipe.results) do
if result.name == product then
if result.amount then
result.amount = amount
end
if result.amount_min ~= nil then
result.amount_min = nil
result.amount_max = nil
result.amount = amount
end
end
if result[1] == product then
result[2] = amount
end
end
end
if not recipe.results and not recipe.result_count then
-- implicit one item result
recipe.result_count = amount
end
end
end
-- multiply the cost, energy, and results of a recipe by a multiple
function util.multiply_recipe(recipe_name, multiple)
me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
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)
@ -472,7 +567,7 @@ end
function util.remove_product(recipe_name, old)
me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
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)
@ -495,6 +590,7 @@ function remove_product(recipe, old)
end
function util.set_main_product(recipe_name, product)
if bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] then
set_main_product(data.raw.recipe[recipe_name], product)
set_main_product(data.raw.recipe[recipe_name].normal, product)
@ -510,6 +606,7 @@ end
-- Replace one product with another in a recipe
function util.replace_product(recipe_name, old, new)
if bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] then
replace_product(data.raw.recipe[recipe_name], old, new)
replace_product(data.raw.recipe[recipe_name].normal, old, new)
@ -551,11 +648,30 @@ function util.remove_raw(t, name)
end
end
-- Set energy required
function util.set_recipe_time(recipe_name, time)
me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then
if bypass(recipe_name) then return end
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
function set_recipe_time(recipe, time)
if recipe then
if recipe.energy_required then
recipe.energy_required = time
end
end
end
-- Multiply energy required
function util.multiply_time(recipe_name, factor)
me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
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)
@ -574,7 +690,7 @@ end
function util.add_time(recipe_name, amount)
me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
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)
@ -591,7 +707,7 @@ end
-- Set recipe category
function util.set_category(recipe_name, category)
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] and data.raw["recipe-category"][category] then
me.add_modified(recipe_name)
data.raw.recipe[recipe_name].category = category
@ -600,7 +716,7 @@ end
-- Set recipe subgroup
function util.set_subgroup(recipe_name, subgroup)
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] then
me.add_modified(recipe_name)
data.raw.recipe[recipe_name].subgroup = subgroup
@ -609,7 +725,7 @@ end
-- Set item subgroup
function util.set_item_subgroup(item, subgroup)
if me.bypass[item] then return end
if bypass(item) then return end
if data.raw.item[item] and data.raw["item-subgroup"][subgroup] then
data.raw.item[item].subgroup = subgroup
end
@ -617,7 +733,7 @@ end
-- Set recipe icons
function util.set_icons(recipe_name, icons)
if me.bypass[recipe_name] then return end
if bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] then
me.add_modified(recipe_name)
data.raw.recipe[recipe_name].icons = icons
@ -676,6 +792,7 @@ function add_to_ingredient(recipe, it, amount)
end
function util.add_to_product(recipe, product, amount)
if bypass(recipe) then return end
if data.raw.recipe[recipe] then
add_to_product(data.raw.recipe[recipe], product, amount)
add_to_product(data.raw.recipe[recipe].normal, product, amount)
@ -788,4 +905,64 @@ function util.create_list()
end
end
function util.remove_prior_unlocks(tech, recipe)
if data.raw.technology[tech].prerequisites then
for i, prerequisite in pairs(data.raw.technology[tech].prerequisites) do
remove_prior_unlocks(prerequisite, recipe)
end
end
end
function remove_prior_unlocks(tech, recipe)
local technology = data.raw.technology[tech]
if technology then
util.remove_recipe_effect(tech, recipe)
if technology.prerequisites then
for i, prerequisite in pairs(technology.prerequisites) do
-- log("BZZZ removing prior unlocks, checking " .. prerequisite)
remove_prior_unlocks(prerequisite, recipe)
end
end
end
end
function util.replace_ingredients_prior_to(tech, old, new, multiplier)
if not data.raw.technology[tech] then
log("Not replacing ingredient "..old.." with "..new.." because tech "..tech.." was not found")
return
end
util.remove_prior_unlocks(tech, old)
for i, recipe in pairs(data.raw.recipe) do
if recipe.enabled and recipe.enabled ~= 'false' then
util.replace_ingredient(recipe.name, old, new, multiplier, true)
end
end
if data.raw.technology[tech].prerequisites then
for i, prerequisite in pairs(data.raw.technology[tech].prerequisites) do
replace_ingredients_prior_to(prerequisite, old, new, multiplier)
end
end
end
function replace_ingredients_prior_to(tech, old, new, multiplier)
local technology = data.raw.technology[tech]
if technology then
if technology.effects then
for i, effect in pairs(technology.effects) do
if effect.type == "unlock-recipe" then
-- log("BZZZ replacing " .. old .. " with " .. new .." in " .. effect.recipe)
util.replace_ingredient(effect.recipe, old, new, multiplier, true)
end
end
end
if technology.prerequisites then
for i, prerequisite in pairs(technology.prerequisites) do
-- log("BZZZ checking " .. prerequisite)
replace_ingredients_prior_to(prerequisite, old, new, multiplier)
end
end
end
end
return util

View file

@ -29,7 +29,7 @@ data:extend({
},
enabled = false,
category = "chemistry",
energy_requires = 3,
energy_required = 3,
},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

View file

@ -1,6 +1,6 @@
{
"name": "bzchlorine",
"version": "0.1.0",
"version": "0.0.1",
"factorio_version": "1.1",
"title": "Salt & Chlorine",
"author": "Brevven",
@ -18,7 +18,6 @@
"? space-exploration >= 0.5.100",
"? aai-industry",
"? Krastorio2",
"? sand-and-glass",
"? deadlock-beltboxes-loaders",
"? DeadlockCrating"
],

View file

@ -15,8 +15,9 @@ pcb=Printed circuit board
[fluid-name]
chlorine=Chlorine
hydrogen-chloride=Hydrogen chloride
epoxy=Epoxy
hydrogen-chloride=Hydrogen chloride
vinyl-chloride=Vinyl chloride
[technology-name]
salt-processing=Salt processing
@ -30,11 +31,15 @@ salt-processing=Salt processing
# Settings
[mod-setting-name]
bztin-recipe-bypass=Bypass recipes
bztin-list=Make a list of modified recipes
bztin-more-intermediates=Enable more intermediates
bzchlorine-recipe-bypass=Bypass recipes
bzchlorine-list=Make a list of modified recipes
bzchlorine-salt=Generate mineable salt patches
bzchlorine-more-intermediates=Enable more chloride intermediates
[mod-setting-description]
bztin-recipe-bypass=Skip modifying these recipes (comma-separated list).
bztin-list=If enabled, the text command [color=orange]BZList[/color] will dump a file to the script-output directory with a full list of recipes modified.\nRecommended to turn this off after you are done configuring your other settings.
bzchlorine-recipe-bypass=Skip modifying these recipes (comma-separated list).
bzchlorine-list=If enabled, the text command [color=orange]BZList[/color] will dump a file to the script-output directory with a full list of recipes modified.\nRecommended to turn this off after you are done configuring your other settings.
[string-mod-setting]
bzchlorine-more-intermediates-no=No
bzchlorine-more-intermediates-yes=Yes: Ferric chloride & vinyl chloride

5
me.lua
View file

@ -3,6 +3,11 @@ local me = {}
me.name = "bzchlorine"
me.list = {}
function me.more()
if me.get_setting("bz-all-intermediates") then return true end
return me.get_setting("bzchlorine-more-intermediates") == "yes"
end
function me.salt()
return me.get_setting("bzchlorine-salt")
end

20
modules.lua Normal file
View file

@ -0,0 +1,20 @@
-- Enable prod modules for some recipes
-- Recipes with very specific ratios are deliberately excluded
recipes = {"chlorine", "epoxy", "pcb-substrate", "vinyl-chloride", "bakelite-hcl"}
if mods["Krastorio2"] then
end
for i, recipe in pairs(recipes) do
if data.raw.recipe[recipe] then
for j, module in pairs(data.raw.module) do
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

20
pcb.lua
View file

@ -21,35 +21,38 @@ data:extend({
},
})
local amount = mods.Krastorio2 and 2 or 1
data:extend({
{
type = "recipe",
name = "pcb-substrate",
results = {
{"pcb-substrate", 1},
{"pcb-substrate", 6},
},
ingredients = {
{type="fluid", name="epoxy", amount=10},
{type="fluid", name="epoxy", amount=30},
{"plastic-bar", 3},
},
enabled = false,
category = "chemistry",
energy_requires = 3,
energy_required = 6,
},
{
type = "recipe",
name = "pcb",
results = {
{"pcb", 1},
{"pcb", amount},
},
ingredients = {
{"pcb-substrate", 1},
{"pcb-substrate", amount},
{"copper-plate", 1},
{"ferric-chloride", 1},
util.me.more() and {"ferric-chloride", 1} or {type="fluid", name="hydrogen-chloride", amount=10},
{type="fluid", name="water", amount=10},
},
enabled = false,
category = "chemistry",
energy_requires = 3,
category = "crafting-with-fluid",
energy_required = amount,
},
})
@ -59,4 +62,3 @@ util.add_unlock("advanced-electronics", "pcb")
-- These updates should be in data phase
util.replace_some_ingredient("pcb-substrate", "plastic-bar", 1, "silica", 3)
util.replace_some_ingredient("pcb-substrate", "plastic-bar", 1, "bakelite", 1)
util.replace_ingredient("advanced-circuit", "plastic-bar", "pcb", 1)

View file

@ -1,5 +1,44 @@
local util = require("data-util");
if mods.Krastorio2 then
local amt = util.get_amount("electronic-components")
util.add_ingredient("electronic-components", "pcb", amt)
util.remove_ingredient("electronic-components", "plastic-bar")
local amt_ac = util.get_amount("advanced-circuit")
util.set_ingredient("advanced-circuit", "copper-cable", amt_ac)
else
local amt = util.get_amount("advanced-circuit")
util.add_ingredient("advanced-circuit", "pcb", amt)
util.remove_ingredient("advanced-circuit", "plastic-bar")
util.set_ingredient("advanced-circuit", "copper-cable", amt*2)
end
local amt = util.get_amount("advanced-circuit")
util.set_recipe_time("advanced-circuit", amt*2) -- more steps, so speed up final step
if util.me.more() then
util.add_ingredient("accumulator", "ferric-chloride", 2)
util.set_product_amount("accumulator", "accumulator", 2)
util.set_ingredient("accumulator", "battery", 8)
end
util.add_ingredient("pumpjack", "salt", 10)
util.add_ingredient("kr-mineral-water-pumpjack", "salt", 10)
util.add_ingredient("uranium-processing", "salt", 1)
-- if foundry or K2, salt for steel
-- TODO if foundry or K2, salt for steel
if mods.Krastorio2 or data.raw.item["foundry"] then
util.replace_some_ingredient("steel", "iron-plate", 1, "salt", 1)
end
util.add_ingredient("kr-biomass-growing", "salt", 1)
util.add_ingredient("kr-energy-storage", "ferric-chloride", 10)
-- Space Exploration
util.add_ingredient("aluminum-ingot", "salt", 2) -- bzaluminum
util.add_ingredient("se-steel-ingot", "salt", 2)
util.replace_some_ingredient("se-vitamelange-bloom", "sand", 10, "salt", 2)
util.add_ingredient("se-nutrient-gel", "salt", 1)
util.add_ingredient("se-vitalic-epoxy", "epoxy", 16)
-- TODO decontamintaion (chlorine or ferric chloride or what)

View file

@ -109,10 +109,14 @@ data:extend({
type = "recipe",
name = "salt",
result = "salt",
ingredients = {{type="fluid", name="water", amount=10}},
ingredients = {{type="fluid", name="water", amount=100}},
enabled = false,
category = "crafting-with-fluid",
energy_requires = 2,
category = mods.Krastorio2 and "fluid-filtration" or "crafting-with-fluid",
energy_required = mods.Krastorio2 and 1 or 2,
},
})
util.add_unlock("fluid-handling", "salt")
if mods.Krastorio2 then
util.add_unlock("kr-fluids-chemistry", "salt")
else
util.add_unlock("fluid-handling", "salt")
end

View file

@ -16,7 +16,7 @@ data:extend({
type = "bool-setting",
name = "bzchlorine-salt",
setting_type = "startup",
default_value = false,
default_value = true,
},
{
type = "string-setting",

BIN
thumbnail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
thumbnail.xcf Normal file

Binary file not shown.

181
tin-recipe-se.lua Normal file
View file

@ -0,0 +1,181 @@
-- Additional recipes if Space Exploration mod is enabled
local util = require("data-util");
if mods["space-exploration"] then
se_delivery_cannon_recipes["tin-ore"] = {name= "tin-ore"}
se_delivery_cannon_recipes["tin-plate"] = {name= "tin-plate"}
data:extend({
{
type = "recipe",
icons = {
{ icon = "__base__/graphics/icons/landfill.png", icon_size = 64, icon_mipmaps = 3 },
{ icon = "__bztin__/graphics/icons/tin-ore.png", icon_size = 64, scale = 0.25},
},
name = "landfill-tin-ore",
category = "hard-recycling",
order = "z-b-tin",
subgroup = "terrain",
result = "landfill",
ingredients = {{"tin-ore", 50}},
}
})
if string.sub(mods["space-exploration"], 1, 3) == "0.6" then
data:extend({
{
type = "item-subgroup",
name = "tin",
group = "resources",
order = "a-h-z-a",
}
})
util.set_item_subgroup("tin-plate", "tin")
data:extend({
{
type = "item",
name = "tin-ingot",
icons = {{icon = "__bztin__/graphics/icons/tin-ingot.png", icon_size = 128}},
order = "b-b",
stack_size = 50,
subgroup = "tin",
},
{
type = "fluid",
name = "molten-tin",
default_temperature = 232,
max_temperature = 232,
base_color = {r=191, g=219, b=233},
flow_color = {r=191, g=219, b=233},
icons = {{icon = "__bztin__/graphics/icons/molten-tin.png", icon_size = 128}},
order = "a[molten]-a",
pressure_to_speed_ratio = 0.4,
flow_to_energy_ratio = 0.59,
auto_barrel = false,
subgroup = "fluid",
},
{
type = "recipe",
category = "smelting",
name = "molten-tin",
subgroup = "tin",
results = {
{type = "fluid", name = "molten-tin", amount = mods.Krastorio2 and 750 or 900},
},
energy_required = 45,
ingredients = {
{name = mods.Krastorio2 and "enriched-tin" or "tin-ore", amount = 24},
{type = "fluid", name = "se-pyroflux", amount = 10},
},
enabled = false,
always_show_made_in = true,
allow_as_intermediate = false,
order = "a-a"
},
{
type = "recipe",
name = "tin-ingot",
category = "casting",
results = {{"tin-ingot", 1}},
energy_required = 18.75,
ingredients = {
{type = "fluid", name = "molten-tin", amount = 250},
},
enabled = false,
always_show_made_in = true,
allow_as_intermediate = false,
},
{
type = "recipe",
category = "crafting",
name = "tin-ingot-to-plate",
icons = {
{icon = "__bztin__/graphics/icons/tin-plate.png", icon_size = 128},
{icon = "__bztin__/graphics/icons/tin-ingot.png", icon_size = 128, scale = 0.125, shift = {-8, -8}},
},
results = {
{name = "tin-plate", amount = 10},
},
energy_required = 3.75,
ingredients = {
{name = "tin-ingot", amount = 1}
},
enabled = false,
always_show_made_in = true,
allow_decomposition = false,
order = "a-c-b"
},
})
util.add_effect("se-pyroflux-smelting", {type = "unlock-recipe", recipe= "molten-tin"})
util.add_effect("se-pyroflux-smelting", {type = "unlock-recipe", recipe= "tin-ingot"})
util.add_effect("se-pyroflux-smelting", {type = "unlock-recipe", recipe= "tin-ingot-to-plate"})
util.add_effect("se-vulcanite-smelting", {type = "unlock-recipe", recipe= "molten-tin"})
util.add_effect("se-vulcanite-smelting", {type = "unlock-recipe", recipe= "tin-ingot"})
util.add_effect("se-vulcanite-smelting", {type = "unlock-recipe", recipe= "tin-ingot-to-plate"})
if mods["Krastorio2"] then
util.set_item_subgroup("enriched-tin", "tin")
data.raw.recipe["enriched-tin-plate"].order= "d[tin-plate]"
se_delivery_cannon_recipes["enriched-tin"] = {name= "enriched-tin"}
end
else
data.raw.item["tin-plate"].subgroup = "plates"
if mods["Krastorio2"] then
data:extend({
{
type = "recipe",
name = "enriched-tin-smelting-vulcanite",
category = "smelting",
order = "d[tin-plate]",
energy_required = 18,
enabled = false,
always_show_made_in = true,
allow_as_intermediate = false,
ingredients = {
{name = "enriched-tin", amount = 8},
{name = "se-vulcanite-block", amount = 1},
},
results = {
{name = "tin-plate", amount = 12},
},
icons =
{
{ icon = "__bztin__/graphics/icons/tin-plate.png", icon_size = 128},
{ icon = "__space-exploration-graphics__/graphics/icons/vulcanite-block.png", icon_size = 64, scale=0.25, shift= {-10, -10}},
},
},
})
table.insert(data.raw.technology["se-processing-vulcanite"].effects,
{type = "unlock-recipe", recipe= "enriched-tin-smelting-vulcanite"})
data.raw.recipe["enriched-tin-plate"].order= "d[tin-plate]"
se_delivery_cannon_recipes["enriched-tin"] = {name= "enriched-tin"}
else
data:extend({
{
type = "recipe",
name = "tin-smelting-vulcanite",
category = "smelting",
order = "d[tin-plate]",
energy_required = 18,
enabled = false,
always_show_made_in = true,
allow_as_intermediate = false,
ingredients = {
{name = "tin-ore", amount = 8},
{name = "se-vulcanite-block", amount = 1},
},
results = {
{name = "tin-plate", amount = 12},
},
icons =
{
{ icon = "__bztin__/graphics/icons/tin-plate.png", icon_size = 128},
{ icon = "__space-exploration-graphics__/graphics/icons/vulcanite-block.png", icon_size = 64, scale=0.25, shift= {-10, -10}},
},
},
})
table.insert(data.raw.technology["se-processing-vulcanite"].effects,
{type = "unlock-recipe", recipe= "tin-smelting-vulcanite"})
end
end
end

217
tin-recipe.lua Normal file
View file

@ -0,0 +1,217 @@
-- Aluminum smelting
local util = require("data-util");
local futil = require("util");
if (not mods["pyrawores"] and not mods["bobplates"] and not mods["angelssmelting"] ) then
data:extend({
{
type = "recipe",
name = "tin-plate",
category = "smelting",
order = "d[tin-plate]",
icons = (mods["Krastorio2"] and
{
{ icon = "__bztin__/graphics/icons/tin-plate.png", icon_size = 128},
{ icon = "__bztin__/graphics/icons/tin-ore.png", icon_size = 64, scale=0.125, shift= {-8, -8}},
} or {
{ icon = "__bztin__/graphics/icons/tin-plate.png", icon_size = 128},
}
),
normal = (mods["Krastorio2"] and
{
main_product = "tin-plate",
enabled = true,
energy_required = 12,
ingredients = {{"tin-ore", 10}},
results = {
{type="item", name = "tin-plate", amount=5}
}
} or
{
main_product = "tin-plate",
enabled = true,
energy_required = 2.4,
ingredients = {{"tin-ore", 1}},
results = {
{type="item", name = "tin-plate", amount=1}
}
}),
expensive =
{
main_product = "tin-plate",
enabled = true,
energy_required = 4.8,
ingredients = {{"tin-ore", 1}},
results = {
{type="item", name = "tin-plate", amount=1},
}
}
},
{
type = "item",
name = "tin-plate",
icon = "__bztin__/graphics/icons/tin-plate.png",
icon_size = 128,
subgroup = "raw-material",
order = "b[tin-plate]",
stack_size = util.get_stack_size(100)
},
})
local solder_ingredients = {{"tin-plate", 4}, {"copper-plate", 1}}
if mods.bzlead then
solder_ingredients = {{"tin-plate", 3}, {"lead-plate", 2}}
end
data:extend({
{
type = "item",
name = "solder",
icon = "__bztin__/graphics/icons/solder.png",
icon_size = 128,
subgroup = "intermediate-product",
order = "b[solder]",
stack_size = util.get_stack_size(100),
},
{
type = "recipe",
name = "solder",
category = "crafting",
order = "d[solder]",
enabled = true,
energy_required = 1,
ingredients = solder_ingredients,
results = {{"solder", 4}},
}
})
data:extend({
{
type = "fluid",
name = "organotins",
default_temperature = 25,
heat_capacity = "0.1KJ",
base_color = {r=0.75, g=0.65, b=0.1},
flow_color = {r=0.7, g=1, b=0.1},
icon = "__bztin__/graphics/icons/organotins.png",
icon_size = 64,
order = "a[fluid]-f[organotins]"
},
{
type = "recipe",
name = "organotins",
category = "chemistry",
subgroup = "fluid-recipes",
order = "h[organotins]",
enabled = false,
energy_required = 5,
ingredients = {{"tin-plate", 3}, {type="fluid", name="petroleum-gas", amount=20}},
results = {{type="fluid", name="organotins", amount=50}},
crafting_machine_tint = {
primary = {r = 1.000, g = 0.995, b = 0.089, a = 1.000},
secondary = {r = 1.000, g = 0.975, b = 0.890, a = 1.000},
tertiary = {r = 0.825, g = 0.740, b = 0.810, a = 1.000},
quaternary = {r = 0.950, g = 1.000, b = 0.350, a = 1.000},
}
},
{
type = "technology",
name = "organotin-chemistry",
icon = "__bztin__/graphics/technology/organotins.png",
icon_size = 256,
effects = {
{ type = "unlock-recipe", recipe = "organotins" },
},
unit = {
count = 50, time = 30,
ingredients = {{"automation-science-pack", 1}, {"logistic-science-pack", 1}},
},
prerequisites = {"oil-processing"},
order = "b-b",
},
})
util.add_prerequisite("plastics", "organotin-chemistry")
if util.me.use_cable() then
data:extend({
{
type = "item",
name = "tinned-cable",
icon = "__bztin__/graphics/icons/tinned-cable.png",
icon_size = 64, icon_mipmaps = 4,
subgroup = "intermediate-product",
order = "b[tinned-cable]",
stack_size = util.get_stack_size(100),
},
{
type = "recipe",
name = "tinned-cable",
category = "crafting",
order = "d[tinned-cable]",
enabled = false,
energy_required = 1.5,
ingredients = {{"tin-plate", 1}, {"copper-cable", 8}},
results = {{"tinned-cable", 8}},
},
{
type = "technology",
name = "tinned-cable",
icon = "__bztin__/graphics/icons/tinned-cable.png",
icon_size = 64, icon_mipmaps = 4,
effects = {
{ type = "unlock-recipe", recipe = "tinned-cable" },
},
unit = {
count = 50, time = 15,
ingredients = {{"automation-science-pack", 1}, {"logistic-science-pack", 1}},
},
prerequisites = {"logistic-science-pack"},
order = "b-b",
},
})
util.add_prerequisite("tinned-cable", "copper-processing")
end
if util.me.use_bronze() then
local bronze_i = {}
bronze_i["copper-plate"] = 17
bronze_i["tin-plate"] = 3
if mods.bzaluminum then
bronze_i["copper-plate"] = bronze_i["copper-plate"] - 1
bronze_i["aluminum-plate"] = 1
end
data:extend({
{
type = "item",
name = "bronze-plate",
icon = "__bztin__/graphics/icons/bronze-plate.png",
icon_size = 128,
subgroup = "intermediate-product",
order = "b[bronze-plate]",
stack_size = util.get_stack_size(100),
},
{
type = "recipe",
name = "bronze-plate",
category = "advanced-crafting",
order = "d[bronze-plate]",
enabled = false,
energy_required = 60,
ingredients = {},
results = {{"bronze-plate", 20}},
},
})
for item, count in pairs(bronze_i) do
util.add_ingredient("bronze-plate", item, count)
end
if mods.bzfoundry and data.raw.item["foundry"] then
util.add_effect("foundry", { type = "unlock-recipe", recipe = "bronze-plate" })
util.add_prerequisite("fast-inserter", "foundry")
util.set_to_founding("bronze-plate")
else
util.add_effect("automation", { type = "unlock-recipe", recipe = "bronze-plate" })
end
end
end