Many improvements and an attempt to rebalance chem output.

This commit is contained in:
Adamo 2020-09-17 17:55:51 -04:00
parent 17e794c844
commit 8246d6ee0c
3 changed files with 173 additions and 149 deletions

View File

@ -1,4 +1,36 @@
---------------------------------------------------------------------------------------------------
Version: 0.3.0
Date: 2020-09-12
Recipes:
- Upgraded geological calculations to a more robust system.
- Rederived all chemical ratios.
---------------------------------------------------------------------------------------------------
Version: 0.2.1
Date: 2020-07-17
Technology:
- Moved hydrofluoric acid-based Chemical science pack recipe to
Fluorine processing tech.
Recipes:
- Changed Chemical science pack to use hydrofluoric acid instead
of fluorite, to improve balance with gypsum/calcite.
Changes:
- More code improvements.
---------------------------------------------------------------------------------------------------
Version: 0.2.0
Date: 2020-07-16
Recipes:
- Reduced mineral counts from flux recipes by 1/2 for better balance.
Changes:
- Began code overhaul with some non-game-changing code improvements.
---------------------------------------------------------------------------------------------------
Version: 0.1.12
Date: 2020-07-15

View File

@ -231,106 +231,74 @@ function chemical_category(
end
-- Calcination smelting should give back some resources.
-- at time_norm 5 and 150kW, ~10-25 ore_norm is the range
-- at time_mult 5 and 150kW, ~10-25 ore_mult is the range
-- between stone and steel furnace power use
local ore_norm = 10
local time_norm = 4
local ore_mult = 1/adamo.geo.ore.impurity_ratio
local time_mult = ore_mult/5
local flux_name = "adamo-chemical-calcite"
local clinker_name = "adamo-chemical-clinker"
local fluxxing_category = "adamo-chemical-firing"
local fluxxing_subgroup = fluxxing_category
local calcinate_recipe = function(recipe,mult)
local recipe = recipe_or_bust(recipe)
if not recipe then return nil end
if type(mult) ~= "number"
or mult <= 0 then mult = ore_norm end
local calcined_recipe = util.table.deepcopy(recipe)
calcined_recipe.name = calcined_recipe.name.."-calcined"
mult_recipe_energy(
calcined_recipe,mult*time_norm/ore_norm
)
mult_recipe_io(calcined_recipe,mult)
calcined_recipe.category = "adamo-chemical-firing"
calcined_recipe.subgroup = "adamo-chemical-firing"
if uses_ingredient(recipe,"iron-plate") then
replace_in_recipe_io(
calcined_recipe,
"iron-plate",
"iron-ore"
)
or mult <= 0 then mult = ore_mult end
local count_minerals = function(ore_count)
return math.ceil(ore_count * adamo.geo.ore.impurity_ratio)
end
if uses_ingredient(recipe,"copper-plate") then
replace_in_recipe_io(
calcined_recipe,
"copper-plate",
"copper-ore"
)
local flux_recipe = util.table.deepcopy(recipe)
flux_recipe.name = flux_recipe.name.."-calcined"
mult_recipe_energy(flux_recipe,time_mult/ore_mult*mult)
mult_in_recipe(flux_recipe,mult)
flux_recipe.category = fluxxing_category
flux_recipe.subgroup = fluxxing_subgroup
local ore_count = 0
for ore,plate in pairs(adamo.chem.fluxables) do
if uses_ingredient(flux_recipe,plate) then
io_manip(flux_recipe,plate,ore)
end
local x,this_ore_count,x =
get_ingredient(flux_recipe,ore)
ore_count = ore_count + (this_ore_count or 0)
-- broken
--if this_ore_count > 0 then
-- add_ingredient(
-- flux_recipe,
-- ore,
-- 1
-- )
--end
end
local toss,iron_ore_count,toss =
get_ingredient(calcined_recipe,"iron-ore")
local toss,copper_ore_count,toss =
get_ingredient(calcined_recipe,"copper-ore")
local ore_count = (iron_ore_count or 0) + (copper_ore_count or 0)
if ore_count == 0 then
toss,stone_count,toss =
get_ingredient(calcined_recipe,"stone")
if stone_count > 0 then
replace_in_recipe_io(
calcined_recipe,
"stone",
"adamo-chemical-clinker",
1/2
)
add_ingredient(
calcined_recipe,"adamo-chemical-calcite",
math.ceil(stone_count/2)
)
return calcined_recipe
if uses_ingredient(flux_recipe,"stone") then
x,stone_count,x = get_ingredient(flux_recipe,"stone")
io_manip(flux_recipe,"stone",clinker_name,1/2)
local flux_count = math.ceil(stone_count/2)
add_ingredient(flux_recipe,flux_name,flux_count)
return flux_recipe
else
return nil
end
end
local mineral_count = ore_count/20
local flux_input = math.ceil(mineral_count*2)
local clinker_ratio = 1/3 -- to match gypsum
local clinker_output = clinker_ratio*flux_input
local clinker_count = clinker_ratio*flux_input
local clinker_prob = nil
if clinker_output > 1 then
clinker_count = math.ceil(clinker_output)
clinker_prob = clinker_count/clinker_output
local flux_count = math.ceil(ore_count/ore_mult)
local clinker_count = flux_count
local mineral_count = flux_count
local clinker_prob = 1/adamo.chem.ratio.lime_per_clinker
local mineral_prob = 1 - clinker_prob
add_ingredient(flux_recipe,flux_name,flux_count)
add_result(flux_recipe,clinker_name,clinker_count,clinker_prob)
for chemical,abundance in pairs(adamo.geo.ore.mineral_results) do
if data.raw.item[chemical] then
add_result(
flux_recipe,
chemical,
mineral_count,
abundance*mineral_prob
)
end
end
add_ingredient(
calcined_recipe,"adamo-chemical-calcite",
flux_input
)
add_result(
calcined_recipe,"adamo-chemical-fluorite",
mineral_count,
(fluorite_ratio)
)
if data.raw.item["SiSi-quartz"] then
add_result(
calcined_recipe,"SiSi-quartz",
mineral_count,
quartz_ratio
)
end
if data.raw.item["adamo-chemical-quartz"] then
add_result(
calcined_recipe,"adamo-chemical-quartz",
mineral_count,
quartz_ratio
)
end
add_result(
calcined_recipe,"sulfur",
mineral_count,
(1 - fluorite_ratio - quartz_ratio)
)
add_result(
calcined_recipe,"adamo-chemical-clinker",
clinker_count,
clinker_prob
)
return calcined_recipe
return flux_recipe
end
-- Generate chemical engineering recipes.
@ -381,25 +349,28 @@ fluoride_battery_recipe.expensive.ingredients = {{
local fluorite_science_pack = util.table.deepcopy(
data.raw.recipe["chemical-science-pack"]
)
fluorite_science_pack
.name = "chemical-science-pack-from-fluorite"
fluorite_science_pack.name = "chemical-science-pack-from-fluorite"
fluorite_science_pack.category = "advanced-crafting"
fluorite_science_pack.category = "crafting-with-fluid"
fluorite_science_pack.category = "chemistry"
mult_recipe_energy(fluorite_science_pack,1/2)
replace_recipe_io(
replace_in_recipe(
fluorite_science_pack,
"sulfur",
"adamo-chemical-fluorite",
1
"adamo-chemical-hydrofluoric-acid",
10
)
mult_recipe_io(
mult_in_recipe(
fluorite_science_pack,
1.5,
"chemical-science-pack"
)
mult_recipe_io(
mult_in_recipe(
fluorite_science_pack,
1.5,
"engine-unit"
)
adamo.recipe.tint.apply(fluorite_science_pack)
data:extend({
processing_unit_from_hf_recipe,
fluoride_battery_recipe,
@ -409,13 +380,12 @@ add_recipe_to_tech(
"advanced-electronics-2",
processing_unit_from_hf_recipe.name
)
add_recipe_to_tech(
add_recipes_to_tech(
"adamo-chemical-fluorine-processing",
fluoride_battery_recipe.name
)
add_recipe_to_tech(
"chemical-science-pack",
fluorite_science_pack.name
{
fluoride_battery_recipe.name,
fluorite_science_pack.name
}
)
set_productivity_recipes({
@ -556,15 +526,15 @@ for _,recipe in pairs(data.raw.recipe) do
new_recipe.subgroup = new_category
if new_category == "adamo-chemical-binding" then
mult_recipe_energy(new_recipe,binding_time_mult)
mult_recipe_io(new_recipe,binding_prod_mult)
mult_in_recipe(new_recipe,binding_prod_mult)
elseif new_category == "adamo-chemical-separation" then
mult_recipe_energy(new_recipe,separation_time_mult)
mult_recipe_io(new_recipe,separation_prod_mult)
mult_in_recipe(new_recipe,separation_prod_mult)
elseif new_category == "adamo-chemical-vaporworks" then
mult_recipe_energy(new_recipe,vapor_time_mult)
mult_recipe_io(new_recipe,vapor_prod_mult)
mult_in_recipe(new_recipe,vapor_prod_mult)
end
fill_recipe_tint(new_recipe)
adamo.recipe.tint.apply(new_recipe)
new_recipe.always_show_products = true
new_recipe.show_amount_in_title = true
data:extend({new_recipe})
@ -593,12 +563,12 @@ if data.raw["recipe-category"]["screening"] then
for _,ingred_name in pairs(
get_io_names(screen_recipe)
) do
mult_recipe_io(
mult_in_recipe(
screen_recipe,
1/screening_efficiency,
ingred_name
)
mult_recipe_io(
mult_in_recipe(
screen_recipe,
separation_time_mult
)

108
data.lua
View File

@ -399,10 +399,10 @@ local clinker_recipe_with_fluorite = {
enabled = false,
energy_required = 25.6,
ingredients = {
{"adamo-chemical-calcite",44},
{"adamo-chemical-calcite",40},
{"adamo-chemical-fluorite",1},
{"adamo-chemical-gypsum",5},
{"stone",50},
{"adamo-chemical-gypsum",1},
{"stone",60},
},
results = {
{"adamo-chemical-clinker",100}
@ -472,8 +472,12 @@ local refined_concrete_recipe = {
{"refined-concrete",50}
}
}
local stone_input = 40
local basic_loss = 3/4
local stone_input_count = 50
local water_input_count = stone_input_count*10
local landfill_output_count = math.ceil(stone_input_count/50)
local mineral_output_count = stone_input_count
- 20*landfill_output_count
local basic_loss = 4/5
local basic_froth_flotation_recipe = {
type = "recipe",
name = "adamo-chemical-basic-mineral-processing",
@ -490,11 +494,11 @@ local basic_froth_flotation_recipe = {
ingredients = {{
type = "item",
name = "stone",
amount = stone_input*basic_loss,
amount = stone_input_count,
},{
type = "fluid",
name = "water",
amount = stone_input
amount = water_input_count
}},
crafting_machine_tint = {
primary = colors.softgreen,
@ -519,11 +523,11 @@ local advanced_froth_flotation_recipe = {
ingredients = {{
type = "item",
name = "stone",
amount = stone_input,
amount = stone_input_count,
},{
type = "fluid",
name = "water",
amount = stone_input
amount = water_input_count
}},
crafting_machine_tint = {
primary = colors.softgreen,
@ -536,95 +540,113 @@ if found_sisiquartz then
basic_froth_flotation_recipe.results = {{
type = "item",
name = "SiSi-quartz",
probability = quartz_ratio,
amount = stone_input/2.5*basic_loss
probability = adamo.geo.abundance.quartz,
amount = mineral_output_count*basic_loss
},{
type = "item",
name = "adamo-chemical-calcite",
probability = calcite_ratio,
amount = stone_input/2.5*basic_loss
probability = adamo.geo.abundance.calcite,
amount = mineral_output_count*basic_loss
},{
type = "item",
name = "adamo-chemical-gypsum",
probability = gypsum_ratio,
amount = stone_input/2.5*basic_loss
probability = adamo.geo.abundance.gypsum,
amount = mineral_output_count*basic_loss
},{
type = "item",
name = "sulfur",
probability = adamo.geo.abundance.sulfur,
amount = mineral_output_count*basic_loss
},{
type = "item",
name = "landfill",
probability = 0.5,
amount = math.ceil(stone_input/50)
amount = landfill_output_count
}}
advanced_froth_flotation_recipe.results = {{
type = "item",
name = "SiSi-quartz",
probability = quartz_ratio,
amount = stone_input/2.5
probability = adamo.geo.abundance.quartz,
amount = mineral_output_count
},{
type = "item",
name = "adamo-chemical-fluorite",
probability = fluorite_ratio,
amount = stone_input/2.5
probability = adamo.geo.abundance.fluorite,
amount = mineral_output_count
},{
type = "item",
name = "adamo-chemical-calcite",
probability = calcite_ratio,
amount = stone_input/2.5
probability = adamo.geo.abundance.calcite,
amount = mineral_output_count
},{
type = "item",
name = "adamo-chemical-gypsum",
probability = gypsum_ratio,
amount = stone_input/2.5
probability = adamo.geo.abundance.gypsum,
amount = mineral_output_count
},{
type = "item",
name = "sulfur",
probability = adamo.geo.abundance.sulfur,
amount = mineral_output_count
},{
type = "item",
name = "landfill",
amount = math.ceil(stone_input/50)
amount = landfill_output_count
}}
else
basic_froth_flotation_recipe.results = {{
type = "item",
name = "adamo-chemical-quartz",
probability = quartz_ratio,
amount = stone_input/2.5*basic_loss
probability = adamo.geo.abundance.quartz,
amount = mineral_output_count*basic_loss
},{
type = "item",
name = "adamo-chemical-calcite",
probability = calcite_ratio,
amount = stone_input/2.5*basic_loss
probability = adamo.geo.abundance.calcite,
amount = mineral_output_count*basic_loss
},{
type = "item",
name = "adamo-chemical-gypsum",
probability = gypsum_ratio,
amount = stone_input/2.5*basic_loss
probability = adamo.geo.abundance.gypsum,
amount = mineral_output_count*basic_loss
},{
type = "item",
name = "sulfur",
probability = adamo.geo.abundance.sulfur,
amount = mineral_output_count*basic_loss
},{
type = "item",
name = "landfill",
probability = 0.5,
amount = math.ceil(stone_input/50)
amount = landfill_output_count
}}
advanced_froth_flotation_recipe.results = {{
type = "item",
name = "adamo-chemical-quartz",
probability = quartz_ratio,
amount = stone_input/2.5
probability = adamo.geo.abundance.quartz,
amount = mineral_output_count
},{
type = "item",
name = "adamo-chemical-fluorite",
probability = fluorite_ratio,
amount = stone_input/2.5
probability = adamo.geo.abundance.fluorite,
amount = mineral_output_count
},{
type = "item",
name = "adamo-chemical-calcite",
probability = calcite_ratio,
amount = stone_input/2.5
probability = adamo.geo.abundance.calcite,
amount = mineral_output_count
},{
type = "item",
name = "adamo-chemical-gypsum",
probability = gypsum_ratio,
amount = stone_input/2.5
probability = adamo.geo.abundance.gypsum,
amount = mineral_output_count
},{
type = "item",
name = "sulfur",
probability = adamo.geo.abundance.sulfur,
amount = mineral_output_count
},{
type = "item",
name = "landfill",
amount = math.ceil(stone_input/50)
amount = landfill_output_count
}}
end
data:extend({