Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
2 changes: 1 addition & 1 deletion compatibility/248k.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local util = require("data-util");

if mods["248k"] then
if mods["248k-Redux"] then
util.add_ingredient("gr_circuit_recipe", "solder", 2)

-- glass
Expand Down
4 changes: 2 additions & 2 deletions data-final-fixes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ local util = require("data-util");

util.add_product("jellynut-processing", util.item("jellyskin", 1, .25)) -- in case of clobbering

util.replace_some_ingredient("se-glass-vulcanite", "sand", 1, "tin-plate", 1)
util.replace_some_ingredient("se-glass-vulcanite", mods["Krastorio2"] and "kr-sand" or "sand", 1, "tin-plate", 1)
util.add_product("se-glass-vulcanite", {type="item", name="tin-plate", amount=1, catalyst_amount=1, probability=0.8})
util.set_main_product("se-glass-vulcanite", "glass")
util.set_main_product("se-glass-vulcanite", mods["Krastorio2"] and "kr-glass" or "glass")

-- core mining balancing
util.add_to_product("se-core-fragment-omni", "tin-ore", -4)
Expand Down
62 changes: 24 additions & 38 deletions data-util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@ function util.se_landfill(params)
category = "hard-recycling",
order = "z-b-"..params.ore,
subgroup = "terrain",
result = "landfill",
ingredients = {{params.ore, 50}},
results = {{type="item", name="landfill", amount=1}},
ingredients = {{type="item", name=params.ore, amount=50}},
}
})
util.add_unlock("se-recycling-facility", lname)
Expand Down Expand Up @@ -584,7 +584,6 @@ end
-- se matter
-- params: ore, energy_required, quant_out, quant_in, icon_size, stream_out
function util.se_matter(params)
if mods["space-exploration"] > "0.6" then
if not params.quant_in then params.quant_in = params.quant_out end
if not params.icon_size then params.icon_size = 64 end
local fname = "matter-fusion-"..params.ore
Expand All @@ -611,20 +610,20 @@ function util.se_matter(params)
energy_required = params.energy_required,
enabled = false,
ingredients = {
{sedata, 1},
{type="item", name=sedata, amount=1},
{type="fluid", name="se-particle-stream", amount=50},
{type="fluid", name="se-space-coolant-supercooled", amount=25},
},
results = {
{params.ore, params.quant_out},
{"se-contaminated-scrap", 1},
{type=item, name=sedata, amount=1, probability=.99},
{type=item, name=sejunk, amount=1, probability=.01},
{type="item", name=params.ore, amount=params.quant_out},
{type="item", name="se-contaminated-scrap", amount=1},
{type="item", name=sedata, amount=1, probability=.99},
{type="item", name=sejunk, amount=1, probability=.01},
{type="fluid", name="se-space-coolant-hot", amount=25, ignored_by_stats=25, ignored_by_productivity=25},
}
}
})
util.add_unlock("se-space-matter-fusion", fname)
util.add_unlock("se-space-matter-fusion", fname)

if util.k2() then
local lname = params.ore.."-to-particle-stream"
Expand All @@ -650,13 +649,13 @@ function util.se_matter(params)
energy_required = 30,
enabled = false,
ingredients = {
{"se-kr-matter-liberation-data", 1},
{params.ore, params.quant_in},
{type="item", name="se-kr-matter-liberation-data", amount=1},
{type="item", name=params.ore, amount=params.quant_in},
{type="fluid", name="se-particle-stream", amount=50},
},
results = {
{type=item, name="se-kr-matter-liberation-data", amount=1, probability=.99},
{type=item, name=sejunk, amount=1, probability=.01},
{type="item", name="se-kr-matter-liberation-data", amount=1, probability=.99},
{type="item", name=sejunk, amount=1, probability=.01},
{type="fluid", name="se-particle-stream", amount=params.stream_out, ignored_by_stats=50, ignored_by_productivity=50},
}
}
Expand Down Expand Up @@ -684,19 +683,18 @@ function util.se_matter(params)
{"se-astronomic-science-pack-4", 1},
{"se-energy-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},
}

},
prerequisites = {"se-kr-advanced-stream-production"},
},
})
end
util.add_unlock("bz-advanced-stream-production", lname)
util.add_unlock("bz-advanced-stream-production", lname)
end
end
end

-- deprecated
-- Get the normal prototype for a recipe -- either .normal or the recipe itself
Expand Down Expand Up @@ -1119,7 +1117,6 @@ end

function replace_some_product(recipe, old, old_amount, new, new_amount)
if recipe ~= nil then
if recipe.result == new then return end
if recipe.results then
for i, existing in pairs(recipe.results) do
if existing.name == new then
Expand Down Expand Up @@ -1211,10 +1208,6 @@ function set_product_amount(recipe, product, 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

Expand Down Expand Up @@ -1348,10 +1341,6 @@ function replace_product(recipe, old, new, options)
if recipe.main_product == old then
recipe.main_product = new
end
if recipe.result == old then
recipe.result = new
return
end
if recipe.results then
for i, result in pairs(recipe.results) do
if result.name == old then result.name = new end
Expand Down Expand Up @@ -1611,10 +1600,6 @@ end

function add_to_product(recipe, product, amount)
if recipe ~= nil and recipe.results ~= nil then
if recipe.result == product then
recipe.result_count = recipe.result_count + amount
return
end
for i, result in pairs(recipe.results) do
if result.name == product then
result.amount = result.amount + amount
Expand Down Expand Up @@ -1818,12 +1803,11 @@ function util.add_unlock_force(technology_name, recipe)
util.add_unlock(technology_name, recipe)
end

-- sum the products of a recipe
-- sum the products of a recipe
function util.sum_products(recipe_name)
-- this is going to end up approximate in some cases, integer division is probs fine
if data.raw.recipe[recipe_name] then
local recipe = data.raw.recipe[recipe_name]
if not recipe.results then return recipe.result_count end
local sum = 0
for i, result in pairs(recipe.results) do
local amt = 0
Expand Down Expand Up @@ -1896,12 +1880,14 @@ function util.redo_recycling()
-- Find all recycling recipes that result in armor and make sure not to output more than 1
for _, recipe in pairs(data.raw.recipe) do
if recipe.name:find("recycling") then
for _, product in pairs(recipe.results) do
if data.raw.armor[product.name] then
if product.amount then
if product.amount > .99 then
product.amount = 1
product.extra_count_fraction = nil
if recipe.results then
for _, product in pairs(recipe.results) do
if data.raw.armor[product.name] then
if product.amount then
if product.amount > .99 then
product.amount = 1
product.extra_count_fraction = nil
end
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions tin-enriched.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ data:extend(
icon_size = 128,
icon = "__bztin__/graphics/icons/enriched-tin.png",
pictures = {
{filename="__bztin__/graphics/icons/enriched-tin.png", size=128, scale=0.125},
{filename="__bztin__/graphics/icons/enriched-tin-1.png", size=128, scale=0.125},
{filename="__bztin__/graphics/icons/enriched-tin-2.png", size=128, scale=0.125},
{filename="__bztin__/graphics/icons/enriched-tin-3.png", size=128, scale=0.125},
{filename="__bztin__/graphics/icons/enriched-tin.png", size=128, scale=0.25},
{filename="__bztin__/graphics/icons/enriched-tin-1.png", size=128, scale=0.25},
{filename="__bztin__/graphics/icons/enriched-tin-2.png", size=128, scale=0.25},
{filename="__bztin__/graphics/icons/enriched-tin-3.png", size=128, scale=0.25},
},
subgroup = "raw-material",
order = "e05-a[enriched-ores]-a1[enriched-tin]",
Expand Down
70 changes: 4 additions & 66 deletions tin-recipe-se.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if mods["space-exploration"] then
se_delivery_cannon_recipes["tin-plate"] = {name= "tin-plate"}
util.se_landfill({ore="tin-ore"})

if string.sub(mods["space-exploration"], 1, 3) == "0.6" then
util.se_matter({ore="tin-ore", energy_required=1, quant_out=10, stream_out=60})
data:extend({
{
Expand Down Expand Up @@ -50,7 +49,7 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then
},
energy_required = 45,
ingredients = {
{name = mods.Krastorio2 and "enriched-tin" or "tin-ore", amount = 24},
{type = "item", name = mods.Krastorio2 and "enriched-tin" or "tin-ore", amount = 24},
{type = "fluid", name = "se-pyroflux", amount = 10},
},
enabled = false,
Expand All @@ -62,7 +61,7 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then
type = "recipe",
name = "tin-ingot",
category = "casting",
results = {{"tin-ingot", 1}},
results = {{type = "item", name = "tin-ingot", amount = 1}},
energy_required = 18.75,
ingredients = {
{type = "fluid", name = "molten-tin", amount = 250},
Expand All @@ -81,11 +80,11 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then
{icon = "__bztin__/graphics/icons/tin-ingot.png", icon_size = 128, scale = 0.125, shift = {-8, -8}},
},
results = {
{name = "tin-plate", amount = 10},
{type = "item", name = "tin-plate", amount = 10},
},
energy_required = 3.75,
ingredients = {
{name = "tin-ingot", amount = 1}
{type = "item", name = "tin-ingot", amount = 1}
},
enabled = false,
always_show_made_in = true,
Expand All @@ -106,65 +105,4 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then
end
se_delivery_cannon_recipes["tin-ingot"] = {name= "tin-ingot"}

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
19 changes: 3 additions & 16 deletions tin-recipe-updates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,11 @@ util.add_ingredient("se-pylon-substation", "solder", 2)
util.add_ingredient("se-pylon", "solder", 2)
util.add_ingredient("se-holmium-solenoid", "solder", 2)

-- -- Elecrontics circuit recipes are updated in final fixes:
-- util.multiply_recipe("electronic-circuit", 2)
-- util.replace_some_ingredient("electronic-circuit", "copper-cable", 1, "solder", 1)
-- util.multiply_recipe("electronic-circuit-stone", 2)
-- util.replace_some_ingredient("electronic-circuit-stone", "copper-cable", 1, "solder", 1)

-- glass
if mods.Krastorio2 then
util.replace_some_ingredient("glass", "sand", 1, "tin-plate", 1)
util.add_product("glass", {type="item", name="tin-plate", amount=1, catalyst_amount=1, probability=0.8})
util.set_main_product("glass", "glass")
util.replace_some_ingredient("kr-glass", "kr-sand", 1, "tin-plate", 1)
util.add_product("kr-glass", {type="item", name="tin-plate", amount=1, catalyst_amount=1, probability=0.8})
util.set_main_product("kr-glass", "kr-glass")
else
if mods.bzfoundry then
if not mods.bzaluminum then
Expand All @@ -86,12 +80,6 @@ else
util.set_category("sng-glass-plate", "basic-founding")
end
end
-- -- NOTE: K2 seems to reset this recipe, so moved to final fixes:
-- util.replace_some_ingredient("se-glass-vulcanite", "sand", 1, "tin-plate", 1)
-- util.add_product("se-glass-vulcanite", {type="item", name="tin-plate", amount=1, probability=0.8})
-- util.set_main_product("se-glass-vulcanite", "glass")
--
-- 248k in /compatibility dir
-- end glass

util.add_ingredient("kr-fuel-refinery", "solder", 5)
Expand Down Expand Up @@ -180,7 +168,6 @@ if util.me.use_bronze() then
local fast_i = mods.bzaluminum and "aluminum-plate" or "iron-plate"
util.replace_some_ingredient("fast-inserter", fast_i, 1, "bronze-plate", 1)
if mods.Krastorio2 then
util.replace_some_ingredient("filter-inserter", fast_i, 1, "bronze-plate", 1)
util.replace_ingredient("kr-steel-pump", "steel-beam", "bronze-plate", 4)
end

Expand Down