diff --git a/data-final-fixes.lua b/data-final-fixes.lua index 0a81f25..7095892 100644 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -8,7 +8,7 @@ util.add_product("jellynut-processing", util.item("jellyskin", 1, .25)) -- in c 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, 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) diff --git a/data-util.lua b/data-util.lua index c4144a0..87a0816 100644 --- a/data-util.lua +++ b/data-util.lua @@ -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) @@ -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 @@ -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" @@ -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}, } } @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/tin-recipe-se.lua b/tin-recipe-se.lua index 4f7ce37..401d5a5 100644 --- a/tin-recipe-se.lua +++ b/tin-recipe-se.lua @@ -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({ { @@ -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, @@ -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}, @@ -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, @@ -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