diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..bbf3e21 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*] +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/README.md b/README.md index a28a2f5..1faf65d 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ See changelog.txt - [snouz](https://github.com/snouz) (logo inspiration, ore graphics templates) - FreeSVG/OpenClipart for spark plug: https://freesvg.org/spark-plug-vector-image - Krastorio2 team for automation-core icons (Licensed under GNU LGPL v3.0) +- [cackling fiend](https://mods.factorio.com/user/cackling.fiend) (Update to 2.0) ### Compatibility - [U.N.Owen](https://mods.factorio.com/user/U.N.Owen) diff --git a/aluminum-burner-phase.lua b/aluminum-burner-phase.lua index 1ff2c96..00a4a50 100644 --- a/aluminum-burner-phase.lua +++ b/aluminum-burner-phase.lua @@ -28,25 +28,25 @@ util.replace_ingredient("lab", "copper-cable", "aluminum-cable") util.replace_ingredient("lab", "basic-circuit-board", "aluminum-cable") -- Bob's if mods.Krastorio2 then - util.replace_ingredient("automation-core", "copper-plate", "aluminum-plate") + util.replace_ingredient("kr-automation-core", "copper-plate", "aluminum-plate") util.replace_ingredient("kr-wind-turbine", "copper-cable", "aluminum-cable") util.replace_ingredient("kr-crusher", "copper-cable", "aluminum-cable") util.replace_ingredient("kr-sentinel", "copper-cable", "aluminum-cable") util.replace_ingredient("repair-pack", "copper-plate", "aluminum-plate") - util.remove_ingredient("basic-tech-card", "copper-cable") - util.add_ingredient("basic-tech-card", "aluminum-cable", 1) + util.remove_ingredient("kr-basic-tech-card", "copper-cable") + util.add_ingredient("kr-basic-tech-card", "aluminum-cable", 1) util.add_prerequisite("automation-science-pack", "copper-processing") if mods.bobassembly then util.set_prerequisite("basic-automation", {"kr-automation-core"}) - util.set_tech_recipe("basic-automation", {{"basic-tech-card", 1}}) + util.set_tech_recipe("basic-automation", {{"kr-basic-tech-card", 1}}) end util.remove_prerequisite("automation", "smelting") -- Bitumen mod -- For warptorio2 expansion with K2 util.remove_prerequisite("laboratory", "automation-science-pack") - util.set_tech_recipe("laboratory", {{"basic-tech-card", 1}}) + util.set_tech_recipe("laboratory", {{"kr-basic-tech-card", 1}}) end @@ -74,11 +74,11 @@ if mods["aai-industry"] and mods.Krastorio2 then util.remove_prerequisite("fuel-processing", "automation-science-pack") util.remove_prerequisite("electricity", "automation-science-pack") util.remove_prerequisite("kr-sentinel", "automation-science-pack") - util.set_tech_recipe("logistics", {{"basic-tech-card", 1}}) - util.set_tech_recipe("fuel-processing", {{"basic-tech-card", 1}}) - util.set_tech_recipe("electricity", {{"basic-tech-card", 1}}) - util.set_tech_recipe("kr-sentinel", {{"basic-tech-card", 1}}) - util.set_tech_recipe("kr-basic-fluid-handling", {{"basic-tech-card", 1}}) + util.set_tech_recipe("logistics", {{"kr-basic-tech-card", 1}}) + util.set_tech_recipe("fuel-processing", {{"kr-basic-tech-card", 1}}) + util.set_tech_recipe("electricity", {{"kr-basic-tech-card", 1}}) + util.set_tech_recipe("kr-sentinel", {{"kr-basic-tech-card", 1}}) + util.set_tech_recipe("kr-basic-fluid-handling", {{"kr-basic-tech-card", 1}}) util.add_prerequisite("deadlock-stacking-1", "automation-science-pack") util.add_prerequisite("kr-radar", "automation-science-pack") @@ -122,9 +122,10 @@ require("compatibility/textplates") -- All customizations or custom unlocks prior to this block util.add_unlock_force("electronics", "electronic-circuit") -util.replace_ingredients_prior_to("electronics", "electronic-circuit", "aluminum-cable") -util.replace_ingredients_prior_to("copper-processing", "copper-cable", "aluminum-cable") -util.replace_ingredients_prior_to("copper-processing", "copper-plate", "aluminum-plate") +-- Disabled for now because replace_ingredients_prior_to has an infinite recursion +--util.replace_ingredients_prior_to("electronics", "electronic-circuit", "aluminum-cable") +--util.replace_ingredients_prior_to("copper-processing", "copper-cable", "aluminum-cable") +--util.replace_ingredients_prior_to("copper-processing", "copper-plate", "aluminum-plate") -- Any post-fixes (eg aluminum back to copper) after this block util.remove_prerequisite("copper-processing", "automation") diff --git a/aluminum-enriched.lua b/aluminum-enriched.lua index a9783db..d28a834 100644 --- a/aluminum-enriched.lua +++ b/aluminum-enriched.lua @@ -10,14 +10,14 @@ data:extend( icon_size = 128, icon = "__bzaluminum__/graphics/icons/enriched-aluminum.png", pictures = { - {filename="__bzaluminum__/graphics/icons/enriched-aluminum.png", size=128, scale=0.125}, - {filename="__bzaluminum__/graphics/icons/enriched-aluminum-1.png", size=128, scale=0.125}, - {filename="__bzaluminum__/graphics/icons/enriched-aluminum-2.png", size=128, scale=0.125}, - {filename="__bzaluminum__/graphics/icons/enriched-aluminum-3.png", size=128, scale=0.125}, + {filename="__bzaluminum__/graphics/icons/enriched-aluminum.png", size=128, scale=0.25}, + {filename="__bzaluminum__/graphics/icons/enriched-aluminum-1.png", size=128, scale=0.25}, + {filename="__bzaluminum__/graphics/icons/enriched-aluminum-2.png", size=128, scale=0.25}, + {filename="__bzaluminum__/graphics/icons/enriched-aluminum-3.png", size=128, scale=0.25}, }, subgroup = "raw-material", order = "e05-a[enriched-ores]-a1[enriched-aluminum]", - stack_size = util.get_stack_size(100) + stack_size = 100 }, { type = "recipe", @@ -41,7 +41,7 @@ data:extend( results = { {type = "item", name = "enriched-aluminum", amount = 6}, - {type = "fluid", name = "dirty-water", amount = 25, catalyst_amount = 25} + {type = "fluid", name = "kr-dirty-water", amount = 25, catalyst_amount = 25} }, crafting_machine_tint = { @@ -66,28 +66,28 @@ data:extend( always_show_made_in = true, always_show_products = true, allow_productivity = true, - ingredients = { {"enriched-aluminum", 5} }, - results = { {"alumina", 5} }, + ingredients = { {type="item", name="enriched-aluminum", amount=5} }, + results = { {type="item", name="alumina", amount=5} }, order = "b[alumina]-b[enriched-alumina]", }, { type = "recipe", name = "dirty-water-filtration-aluminum", - category = "fluid-filtration", + category = "kr-fluid-filtration", icons = { { - icon = data.raw.fluid["dirty-water"].icon, - icon_size = data.raw.fluid["dirty-water"].icon_size + icon = data.raw.fluid["kr-dirty-water"].icon, + icon_size = data.raw.fluid["kr-dirty-water"].icon_size }, { icon = data.raw.item["aluminum-ore"].icon, icon_size = data.raw.item["aluminum-ore"].icon_size, - scale = 0.20 * (data.raw.fluid["dirty-water"].icon_size/data.raw.item["aluminum-ore"].icon_size), + scale = 0.20, shift = {0, 4} } }, - icon_size = data.raw.fluid["dirty-water"].icon_size, + icon_size = data.raw.fluid["kr-dirty-water"].icon_size, energy_required = 2, enabled = false, allow_as_intermediate = false, @@ -95,7 +95,7 @@ data:extend( always_show_products = true, ingredients = { - {type = "fluid", name = "dirty-water", amount = 100, catalyst_amount = 100}, + {type = "fluid", name = "kr-dirty-water", amount = 100, catalyst_amount = 100}, }, results = { diff --git a/aluminum-matter.lua b/aluminum-matter.lua index 9e04457..f04cb2e 100644 --- a/aluminum-matter.lua +++ b/aluminum-matter.lua @@ -1,7 +1,7 @@ -- Matter recipes for Krastorio2 if mods["Krastorio2"] then local util = require("data-util"); -local matter = require("__Krastorio2__/lib/public/data-stages/matter-util") +local matter = require("__Krastorio2__/prototypes/libraries/matter") data:extend( { @@ -28,44 +28,41 @@ data:extend( { {"production-science-pack", 1}, {"utility-science-pack", 1}, - {"matter-tech-card", 1} + {"kr-matter-tech-card", 1} }, time = 45 } }, }) -local flake_graphite_matter = +local aluminum_ore_matter = { - item_name = "aluminum-ore", - minimum_conversion_quantity = 10, - matter_value = 5, + material = { type = "item", name = "aluminum-ore", amount = 10 }, + matter_count = 5, energy_required = 1, need_stabilizer = false, unlocked_by_technology = "aluminum-matter-processing" } -matter.createMatterRecipe(flake_graphite_matter) +matter.make_recipes(aluminum_ore_matter) -local graphite_matter = +local alumina_matter = { - item_name = "alumina", - minimum_conversion_quantity = 10, - matter_value = 7.5, + material = { type = "item", name = "alumina", amount = 10 }, + matter_count = 7.5, energy_required = 2, only_deconversion = true, need_stabilizer = true, unlocked_by_technology = "aluminum-matter-processing" } -matter.createMatterRecipe(graphite_matter) -local graphite_matter = +matter.make_recipes(alumina_matter) +local aluminum_plate_matter = { - item_name = "aluminum-plate", - minimum_conversion_quantity = 10, - matter_value = 10, + material = { type = "item", name = "aluminum-plate", amount = 10 }, + matter_count = 10, energy_required = 3, only_deconversion = true, need_stabilizer = true, unlocked_by_technology = "aluminum-matter-processing" } -matter.createMatterRecipe(graphite_matter) +matter.make_recipes(aluminum_plate_matter) end diff --git a/aluminum-ore.lua b/aluminum-ore.lua index b1fbd8a..a988470 100644 --- a/aluminum-ore.lua +++ b/aluminum-ore.lua @@ -1,8 +1,11 @@ local resource_autoplace = require('resource-autoplace'); -local noise = require('noise'); local util = require("data-util"); +data.raw.planet.nauvis.map_gen_settings.autoplace_controls["aluminum-ore"] = {} +data.raw.planet.nauvis.map_gen_settings.autoplace_settings.entity.settings["aluminum-ore"] = {} +resource_autoplace.initialize_patch_set("aluminum-ore", true) + data:extend({ { type = "autoplace-control", @@ -12,10 +15,6 @@ data:extend({ order = "b-e" }, { - type = "noise-layer", - name = "aluminum-ore" - }, - { type = "resource", icon_size = 64, icon_mipmaps = 3, name = "aluminum-ore", @@ -73,13 +72,13 @@ data:extend({ icon_size = 64, icon_mipmaps = 3, icon = "__bzaluminum__/graphics/icons/aluminum-ore.png", pictures = { - {filename="__bzaluminum__/graphics/icons/aluminum-ore.png", size=64, scale=0.25}, - {filename="__bzaluminum__/graphics/icons/aluminum-ore-2.png", size=64, scale=0.25}, - {filename="__bzaluminum__/graphics/icons/aluminum-ore-3.png", size=64, scale=0.25}, - {filename="__bzaluminum__/graphics/icons/aluminum-ore-4.png", size=64, scale=0.25}, + {filename="__bzaluminum__/graphics/icons/aluminum-ore.png", size=64, scale=0.5}, + {filename="__bzaluminum__/graphics/icons/aluminum-ore-2.png", size=64, scale=0.5}, + {filename="__bzaluminum__/graphics/icons/aluminum-ore-3.png", size=64, scale=0.5}, + {filename="__bzaluminum__/graphics/icons/aluminum-ore-4.png", size=64, scale=0.5}, }, subgroup = "raw-resource", order = "t-c-a", - stack_size = util.get_stack_size(50) + stack_size = 50 }, }) diff --git a/aluminum-recipe-modules.lua b/aluminum-recipe-modules.lua index f0d670d..83eb619 100644 --- a/aluminum-recipe-modules.lua +++ b/aluminum-recipe-modules.lua @@ -1,15 +1,9 @@ +-- Enable prod modules for some recipes +-- Recipes with very specific ratios are deliberately excluded local util = require("data-util") for i, recipe in pairs(util.me.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 + data.raw.recipe[recipe].allow_productivity = true end -end +end \ No newline at end of file diff --git a/aluminum-recipe-se.lua b/aluminum-recipe-se.lua index bbf5f85..f558bd8 100644 --- a/aluminum-recipe-se.lua +++ b/aluminum-recipe-se.lua @@ -24,7 +24,6 @@ if mods["space-exploration"] then starting_rq_factor_multiplier = 1.5, } -if string.sub(mods["space-exploration"], 1, 3) == "0.6" then util.se_matter({ore="aluminum-ore", energy_required=1, quant_out=10, stream_out=60}) data:extend({ { @@ -71,7 +70,7 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then }, energy_required = 60, ingredients = { - {name = "alumina", amount = 24}, + { type = "item", name = "alumina", amount = 24}, {type = "fluid", name = "se-pyroflux", amount = 10}, }, enabled = false, @@ -83,7 +82,7 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then type = "recipe", name = "aluminum-ingot", category = "casting", - results = {{"aluminum-ingot", 1}}, + results = {{type="item", name="aluminum-ingot", amount=1}}, energy_required = 25, ingredients = { {type = "fluid", name = "molten-aluminum", amount = 250}, @@ -102,11 +101,11 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then {icon = "__bzaluminum__/graphics/icons/aluminum-ingot.png", icon_size = 128, scale = 0.125, shift = {-8, -8}}, }, results = { - {name = "aluminum-plate", amount = 10}, + { type = "item", name = "aluminum-plate", amount = 10}, }, energy_required = 5, ingredients = { - {name = "aluminum-ingot", amount = 1} + { type = "item", name = "aluminum-ingot", amount = 1} }, enabled = false, always_show_made_in = true, @@ -126,101 +125,4 @@ if string.sub(mods["space-exploration"], 1, 3) == "0.6" then end se_delivery_cannon_recipes["aluminum-ingot"] = {name= "aluminum-ingot"} -else - -- Organization - data.raw.item["aluminum-plate"].subgroup = "plates" - data.raw.recipe["aluminum-plate"].subgroup = "plates" - - if mods["Krastorio2"] then - data:extend({ - { - type = "recipe", - name = "enriched-alumina-smelting-vulcanite", - category = "smelting", - order = "d[alumina]", - energy_required = 24, - enabled = false, - always_show_made_in = true, - allow_as_intermediate = false, - ingredients = { - {name = "enriched-aluminum", amount = 8}, - {name = "se-vulcanite-block", amount = 1}, - }, - results = { - {name = "alumina", amount = 12}, - }, - icons = - { - { icon = "__bzaluminum__/graphics/icons/alumina.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-alumina-smelting-vulcanite"}) - data.raw.recipe["enriched-alumina"].order= "d[alumina]" - se_delivery_cannon_recipes["enriched-aluminum"] = {name= "enriched-aluminum"} - else - data:extend({ - { - type = "recipe", - name = "alumina-smelting-vulcanite", - category = "smelting", - subgroup = "plates", - order = "d[alumina]", - energy_required = 24, - enabled = false, - always_show_made_in = true, - allow_as_intermediate = false, - ingredients = { - {name = "aluminum-ore", amount = 8}, - {name = "se-vulcanite-block", amount = 1}, - }, - results = { - {name = "alumina", amount = util.me.byproduct() and 10 or 12}, - }, - icons = - { - { icon = "__bzaluminum__/graphics/icons/alumina.png", icon_size = 128}, - { icon = "__space-exploration-graphics__/graphics/icons/vulcanite-block.png", icon_size = 64, icon_mipmaps = 3, scale=0.25, shift= {-10, -10}}, - }, - - - }, - }) - if util.me.byproduct() then util.add_product("alumina-smelting-vulcanite", {"silica", 2}, {force=true}) end - table.insert(data.raw.technology["se-processing-vulcanite"].effects, - {type = "unlock-recipe", recipe= "alumina-smelting-vulcanite"}) - end - data:extend({ - { - type = "recipe", - name = "aluminum-plate-smelting-vulcanite", - category = "smelting", - subgroup = "plates", - order = "d[aluminum-plate]", - energy_required = 24, - enabled = false, - always_show_made_in = true, - allow_as_intermediate = false, - ingredients = { - {name = "alumina", amount = 8}, - {name = "se-vulcanite-block", amount = 1}, - }, - results = { - {name = "aluminum-plate", amount = 12}, - }, - icons = - { - { icon = "__bzaluminum__/graphics/icons/aluminum-plate.png", icon_size = 128}, - { icon = "__space-exploration-graphics__/graphics/icons/vulcanite-block.png", icon_size = 64, icon_mipmaps = 3, scale=0.25, shift= {-10, -10}}, - }, - - - }, - }) - table.insert(data.raw.technology["se-processing-vulcanite"].effects, - {type = "unlock-recipe", recipe= "aluminum-plate-smelting-vulcanite"}) -end end diff --git a/aluminum-recipe-updates-power.lua b/aluminum-recipe-updates-power.lua index 3a1db1b..bb43d8e 100644 --- a/aluminum-recipe-updates-power.lua +++ b/aluminum-recipe-updates-power.lua @@ -29,12 +29,12 @@ if mods["space-exploration"] then util.remove_product("se-recycle-large-electric-pole", "copper-cable") util.remove_product("se-recycle-substation", "copper-cable") - util.add_product("se-recycle-small-iron-electric-pole", {"aluminum-cable", 1}) - util.add_product("se-recycle-small-electric-pole", {"aluminum-cable", 1}) - util.add_product("se-recycle-medium-electric-pole", {"acsr-cable", 1}) - util.add_product("se-recycle-big-electric-pole", {"acsr-cable", 2}) - util.add_product("se-recycle-large-electric-pole", {"acsr-cable", 4}) - util.add_product("se-recycle-substation", {"acsr-cable", 4}) + util.add_product("se-recycle-small-iron-electric-pole", {type="item", name="aluminum-cable", amount=1}) + util.add_product("se-recycle-small-electric-pole", {type="item", name="aluminum-cable", amount=1}) + util.add_product("se-recycle-medium-electric-pole", {type="item", name="acsr-cable", amount=1}) + util.add_product("se-recycle-big-electric-pole", {type="item", name="acsr-cable", amount=2}) + util.add_product("se-recycle-large-electric-pole", {type="item", name="acsr-cable", amount=4}) + util.add_product("se-recycle-substation", {type="item", name="acsr-cable", amount=4}) end -- final amounts apply to all mod loadouts diff --git a/aluminum-recipe-updates.lua b/aluminum-recipe-updates.lua index aae00e7..946484f 100644 --- a/aluminum-recipe-updates.lua +++ b/aluminum-recipe-updates.lua @@ -77,15 +77,18 @@ end util.replace_ingredient("kr-shelter", "copper-cable", "aluminum-cable") +local glass = mods["Krastorio2"] and "kr-glass" or "glass" +local sand = mods["Krastorio2"] and "kr-sand" or "sand" + -- Glass -- k2 -util.replace_some_ingredient("glass", "sand", 3, "alumina", 1) +util.replace_some_ingredient(glass, sand, 3, "alumina", 1) -- aai util.multiply_recipe("glass-from-sand", 4) -util.replace_some_ingredient("glass-from-sand", "sand", 3, "alumina", 1) +util.replace_some_ingredient("glass-from-sand", sand, 3, "alumina", 1) util.set_category("glass-from-sand", "basic-founding") -- se -util.replace_some_ingredient("se-glass-vulcanite", "sand", 3, "alumina", 1) +util.replace_some_ingredient("se-glass-vulcanite", sand, 3, "alumina", 1) -- sand-and-glass util.multiply_recipe("sng-glass-plate", 4) @@ -107,10 +110,9 @@ end -- k2 if mods.Krastorio2 then - util.replace_some_ingredient("inserter-parts", "iron-stick", 2, "aluminum-plate", 1) + util.replace_some_ingredient("kr-inserter-parts", "iron-stick", 2, "aluminum-plate", 1) util.add_ingredient("inserter", "iron-stick", 1) -- nice symmetry util.replace_ingredient("fast-inserter", "steel-plate", "aluminum-plate") - util.replace_ingredient("filter-inserter", "steel-plate", "aluminum-plate") util.replace_ingredient("kr-wind-turbine", "iron-plate", "aluminum-plate") util.replace_ingredient("battery-equipment", "iron-plate", "aluminum-plate") @@ -118,8 +120,8 @@ if mods.Krastorio2 then util.replace_ingredient("big-battery-equipment", "iron-plate", "aluminum-plate") util.replace_ingredient("personal-submachine-laser-defense-mk1-equipment", "iron-plate", "aluminum-plate") - util.replace_ingredient("additional-engine", "steel-plate", "aluminum-6061") - util.replace_ingredient("advanced-additional-engine", "steel-plate", "aluminum-6061") + util.replace_ingredient("kr-additional-engine-equipment", "steel-plate", "aluminum-6061") + util.replace_ingredient("kr-advanced-additional-engine-equipment", "steel-plate", "aluminum-6061") util.replace_ingredient("vehicle-roboport", "steel-plate", "aluminum-6061") @@ -172,9 +174,7 @@ util.replace_ingredient("Schall-fast-inserter-R4", "iron-plate", "aluminum-plate util.replace_ingredient("Schall-fast-inserter-R5", "iron-plate", "aluminum-plate") util.replace_ingredient("very-long-handed-inserter", "iron-plate", "aluminum-plate") util.replace_ingredient("FastLongInserters_fast-inserter", "iron-plate", "aluminum-plate") -util.replace_ingredient("FastLongInserters_filter-inserter", "iron-plate", "aluminum-plate") util.replace_ingredient("FastLongInserters_stack-inserter", "iron-plate", "aluminum-plate") -util.replace_ingredient("FastLongInserters_stack-filter-inserter", "iron-plate", "aluminum-plate") -- Robocharger util.add_ingredient("robocharger", "aluminum-6061", 35) @@ -195,7 +195,7 @@ util.replace_some_ingredient("Teslacharge-pack", "steel-plate", 4, "aluminum-pla if mods.leighzerscrapyards then util.add_to_product("scrap-processing", "iron-plate", -1) util.add_to_product("scrap-processing", "copper-plate", -1) - util.add_product("scrap-processing", {"aluminum-plate", 2}) + util.add_product("scrap-processing", {type="item", name="aluminum-plate", amount=2}) end diff --git a/aluminum-recipe.lua b/aluminum-recipe.lua index 594ad74..ce39235 100644 --- a/aluminum-recipe.lua +++ b/aluminum-recipe.lua @@ -43,7 +43,7 @@ data:extend({ ), enabled = true, energy_required = mods.Krastorio2 and 16 or 3.2, - ingredients = {{"aluminum-ore", mods.Krastorio2 and 10 or 1}}, + ingredients = {{type = "item", name = "aluminum-ore", amount = mods.Krastorio2 and 10 or 1}}, subgroup = "raw-material", results = alumina_results, }, @@ -60,33 +60,13 @@ data:extend({ } or { { icon = "__bzaluminum__/graphics/icons/aluminum-plate.png", icon_size = 128}, } -), - normal = (mods["Krastorio2"] and - { - enabled = true, - energy_required = 16, - ingredients = {{"alumina", 10}}, - results = { - {type="item", name = "aluminum-plate", amount=10} - } - } or - { - enabled = true, - energy_required = 3.2, - ingredients = {{"alumina", 1}}, - results = { - {type="item", name = "aluminum-plate", amount=1} - } - }), - expensive = - { - enabled = true, - energy_required = 3.2, - ingredients = {{"alumina", 2}}, - results = { - {type="item", name = "aluminum-plate", amount=1}, - } - } + ), + enabled = true, + energy_required = mods["Krastorio2"] and 16 or 3.2, + ingredients = {{type="item", name="alumina", amount=mods["Krastorio2"] and 10 or 1}}, + results = { + {type="item", name = "aluminum-plate", amount=mods["Krastorio2"] and 10 or 1} + }, }, { type = "item", @@ -94,14 +74,14 @@ data:extend({ icon = "__bzaluminum__/graphics/icons/alumina.png", icon_size = 128, pictures = { - {filename="__bzaluminum__/graphics/icons/alumina.png", size=128, scale=0.125}, - {filename="__bzaluminum__/graphics/icons/alumina-1.png", size=128, scale=0.125}, - {filename="__bzaluminum__/graphics/icons/alumina-2.png", size=128, scale=0.125}, - {filename="__bzaluminum__/graphics/icons/alumina-3.png", size=128, scale=0.125}, + {filename="__bzaluminum__/graphics/icons/alumina.png", size=128, scale=0.25}, + {filename="__bzaluminum__/graphics/icons/alumina-1.png", size=128, scale=0.25}, + {filename="__bzaluminum__/graphics/icons/alumina-2.png", size=128, scale=0.25}, + {filename="__bzaluminum__/graphics/icons/alumina-3.png", size=128, scale=0.25}, }, subgroup = "raw-material", order = "b[alumina]", - stack_size = util.get_stack_size(100) + stack_size = 100 }, { type = "item", @@ -110,7 +90,7 @@ data:extend({ icon_size = 128, subgroup = "raw-material", order = "b[aluminum-plate]", - stack_size = util.get_stack_size(100) + stack_size = 100 }, }) @@ -150,7 +130,7 @@ data:extend({ unit = { count = 10, time = 15, ingredients = mods.Krastorio2 and - {{"basic-tech-card", 1}} or {{"automation-science-pack", 1}}, + {{"kr-basic-tech-card", 1}} or {{"automation-science-pack", 1}}, }, prerequisites = {}, ignore_tech_cost_multiplier = true, @@ -190,7 +170,7 @@ data:extend({ icon_size = 64, icon_mipmaps = 4, subgroup = util.cablesg, order = "b[aaac-cable]", - stack_size = util.get_stack_size(100), + stack_size = 100, }, { type = "recipe", @@ -199,8 +179,8 @@ data:extend({ order = "d[aaac-cable]", enabled = true, energy_required = 0.5, - ingredients = {{"aluminum-plate", 2}}, - results = {{"aluminum-cable", 1}}, + ingredients = {{type="item", name="aluminum-plate", amount=2}}, + results = {{type="item", name="aluminum-cable", amount=1}}, }, { type = "item", @@ -218,8 +198,8 @@ data:extend({ order = "d[acsr-cable]", enabled = false, energy_required = 0.5, - ingredients = {{"aluminum-cable", 6}, {"steel-plate", 1}}, - results = {{"acsr-cable", 3}}, + ingredients = {{type="item", name="aluminum-cable", amount=6}, {type="item", name="steel-plate", amount=1}}, + results = {{type="item", name="acsr-cable", amount=3}}, } }) @@ -228,14 +208,14 @@ if mods.Krastorio2 then { type = "recipe", name = "aluminum-cable-s-c", - category = "smelting-crafting", - subgroup = "smelting-crafting", + category = "kr-smelting-crafting", + subgroup = "kr-smelting-crafting", order = "d[aaac-cable]", enabled = false, energy_required = 0.5, hide_from_player_crafting = true, - ingredients = {{"aluminum-ore", 4}}, - results = {{"aluminum-cable", 1}}, + ingredients = {{type="item", name="aluminum-ore", amount=4}}, + results = {{type="item", name="aluminum-cable", amount=1}}, icons = { {icon = "__bzaluminum__/graphics/icons/aluminum-cable.png", icon_size = 64, icon_mipmaps = 4}, {icon = "__bzaluminum__/graphics/icons/aluminum-ore.png", icon_size = 64, icon_mipmaps = 3, scale=0.25, shift= {-8, -8}}, @@ -244,14 +224,14 @@ if mods.Krastorio2 then { type = "recipe", name = "aluminum-cable-enriched-s-c", - category = "smelting-crafting", - subgroup = "smelting-crafting", + category = "kr-smelting-crafting", + subgroup = "kr-smelting-crafting", order = "d[aaac-cable]", enabled = false, energy_required = 0.5, hide_from_player_crafting = true, - ingredients = {{"enriched-aluminum", 2}}, - results = {{"aluminum-cable", 1}}, + ingredients = {{type="item", name="enriched-aluminum", amount=2}}, + results = {{type="item", name="aluminum-cable", amount=1}}, icons = { {icon = "__bzaluminum__/graphics/icons/aluminum-cable.png", icon_size = 64, icon_mipmaps = 4}, {icon = "__bzaluminum__/graphics/icons/enriched-aluminum.png", icon_size = 128, scale=0.125, shift= {-8, -8}}, @@ -263,12 +243,12 @@ if mods.Krastorio2 then end local plug = { - {"alumina", 1}, - {"copper-plate", 1}, - {"iron-plate", 1}, -- replace with tungsten plate later + {type="item", name="alumina", amount=1}, + {type="item", name="copper-plate", amount=1}, + {type="item", name="iron-plate", amount=1}, -- replace with tungsten plate later } if mods.bzzirconium then - table.insert(plug, {"zirconia", 1}) + table.insert(plug, {type="item", name="zirconia", amount=1}) end data:extend({ { @@ -288,7 +268,7 @@ data:extend({ enabled = false, energy_required = 2, ingredients = plug, - results = {{"spark-plug", #plug}}, + results = {{type = "item", name = "spark-plug", amount = #plug}}, } }) util.add_effect("engine", { type = "unlock-recipe", recipe = "spark-plug" }) @@ -303,11 +283,11 @@ aluminum_6061["aluminum-plate"] = 18 aluminum_6061["copper-plate"] = 1 aluminum_6061["iron-plate"] = 1 if mods.bzsilicon or mods.Krastorio2 then - aluminum_6061["silicon"] = 1 + aluminum_6061[mods.Krastorio2 and "kr-silicon" or "silicon"] = 1 aluminum_6061["aluminum-plate"] = aluminum_6061["aluminum-plate"] - 1 end if mods.Krastorio2 then - aluminum_6061["rare-metals"] = 1 + aluminum_6061["kr-rare-metals"] = 1 aluminum_6061["aluminum-plate"] = aluminum_6061["aluminum-plate"] - 1 end data:extend({ @@ -329,7 +309,7 @@ data:extend({ enabled = false, energy_required = 100, ingredients = {}, - results = {{"aluminum-6061", 20}}, + results = {{type="item", name="aluminum-6061", amount=20}}, }, { type = "technology", @@ -366,7 +346,7 @@ if mods.bzzirconium then aluminum_2219["aluminum-plate"] = aluminum_2219["aluminum-plate"] - 1 end if mods.Krastorio2 then - aluminum_2219["rare-metals"] = 1 + aluminum_2219["kr-rare-metals"] = 1 aluminum_2219["aluminum-plate"] = aluminum_2219["aluminum-plate"] - 1 end data:extend({ @@ -388,7 +368,7 @@ data:extend({ enabled = false, energy_required = 100, ingredients = {}, - results = {{"aluminum-2219", 20}}, + results = {{type="item", name="aluminum-2219", amount=20}}, }, { type = "technology", @@ -434,11 +414,11 @@ if mods.bztitanium then enabled = false, energy_required = 10, ingredients = { - {"alumina", 10}, - {util.titanium_plate, 1}, - {type="fluid", name=mods.Krastorio2 and "ammonia" or "sulfuric-acid", amount=5}, + {type="item", name="alumina", amount=10}, + {type="item", name=util.titanium_plate, amount=1}, + {type="fluid", name=mods.Krastorio2 and "kr-ammonia" or "sulfuric-acid", amount=5}, }, - results = {{"ti-sapphire", 1}}, + results = {{type="item", name="ti-sapphire", amount=1}}, }, }) util.add_effect("laser", {type="unlock-recipe", recipe="ti-sapphire"}) @@ -457,8 +437,8 @@ data:extend({ category = "double-smelting", enabled = false, energy_required = 3.2, - ingredients = {{"aluminum-ore", 1}}, - results = {{"aluminum-plate", 1}}, + ingredients = {{type="item", name="aluminum-ore", amount=1}}, + results = {{type="item", name="aluminum-plate", amount=1}}, } }) util.add_effect("double-smelting-tech-steel", {type = "unlock-recipe", recipe = "double-aluminum"}) diff --git a/compatibility/248k-recipes.lua b/compatibility/248k-recipes.lua index 7852c92..1b49d4e 100644 --- a/compatibility/248k-recipes.lua +++ b/compatibility/248k-recipes.lua @@ -1,5 +1,5 @@ -if mods["248k"] then +if mods["248k-Redux"] then data:extend({ { @@ -20,7 +20,7 @@ data:extend({ always_show_made_in = true, icons = { { - icon = "__248k__/ressources/fluids/el_dirty_water.png", icon_size = 64, + icon = "__248k-Redux-graphics__/ressources/fluids/el_dirty_water.png", icon_size = 64, }, { icon = "__bzaluminum__/graphics/icons/aluminum-ore.png", icon_size = 64, icon_mipmaps = 3, scale=0.25, shift= {-8, -8} diff --git a/data-final-fixes.lua b/data-final-fixes.lua index 4bf158b..9b205c1 100644 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -10,7 +10,7 @@ end local util = require("data-util"); -if mods["space-exploration"] then +if mods["space-exploration"] then -- Must be in final fixes util.replace_ingredient("rocket-control-unit", "iron-plate", "aluminum-plate") diff --git a/data-updates.lua b/data-updates.lua index c1b4a3c..6cd5b8c 100644 --- a/data-updates.lua +++ b/data-updates.lua @@ -14,12 +14,11 @@ require("compatibility/rsc") require("compatibility/crafting-efficiency") local util = require("data-util") -if data.raw.resource["copper-ore"] then +if data.raw.resource["copper-ore"] and not mods["bzgold"] then if mods["space-exploration"] then - local noise = require('noise'); -- decrease richness of copper a bit - data.raw.resource["copper-ore"].autoplace.richness_expression = - data.raw.resource["copper-ore"].autoplace.richness_expression * noise.to_noise_expression(3/4) + data.raw.resource["copper-ore"].autoplace.richness_expression = + data.raw.resource["copper-ore"].autoplace.richness_expression .. "*(3/4)" else log("Replacing vanilla copper-ore autoplace") local resource_autoplace = require('resource-autoplace'); diff --git a/data-util.lua b/data-util.lua index 0c58ecd..99b575a 100644 --- a/data-util.lua +++ b/data-util.lua @@ -64,17 +64,7 @@ function util.fe_plus(sub) 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 return "__Krastorio2Assets__" end @@ -111,8 +101,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) @@ -123,7 +113,7 @@ end -- k2 matter -- params: {k2matter}, k2baseicon , {icon} 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 params.k2matter.need_stabilizer = true end @@ -169,15 +159,15 @@ function util.k2matter(params) { {"production-science-pack", 1}, {"utility-science-pack", 1}, - {"matter-tech-card", 1} + {"kr-matter-tech-card", 1} }, 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 - matter.createMatterRecipe(params.k2matter) + matter.make_recipes(params.k2matter) end @@ -211,16 +201,16 @@ 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="fluid", name="se-space-coolant-hot", amount=25, catalyst_amount=25}, + {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_productivity=25, ignored_by_stats=25}, } } }) @@ -250,14 +240,14 @@ 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="fluid", name="se-particle-stream", amount=params.stream_out, catalyst_amount=50}, + {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_productivity=50, ignored_by_stats=50}, } } }) @@ -284,7 +274,7 @@ 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}, } @@ -298,18 +288,6 @@ function util.se_matter(params) 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 function util.set_prerequisite(technology_name, prerequisites) local technology = data.raw.technology[technology_name] @@ -376,7 +354,7 @@ function util.add_unlock(technology_name, recipe) end -- 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] if technology and technology.effects then for i, effect in pairs(technology.effects) do @@ -421,17 +399,13 @@ end function util.set_enabled(recipe_name, enabled) if data.raw.recipe[recipe_name] then - if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.enabled = enabled end - 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 + data.raw.recipe[recipe_name].enabled = enabled end end function util.set_hidden(recipe_name) if data.raw.recipe[recipe_name] then - if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.hidden = true end - 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 + data.raw.recipe[recipe_name].hidden = true 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 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].normal, ingredient, quantity) - add_or_add_to_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity) 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 me.add_modified(recipe_name) 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 @@ -480,7 +450,7 @@ function add_ingredient(recipe, ingredient, quantity, is_fluid) if is_fluid then table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity}) else - table.insert(recipe.ingredients, {ingredient, quantity}) + table.insert(recipe.ingredients, {type="item", name=ingredient, amount=quantity}) 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 me.add_modified(recipe_name) 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 @@ -514,56 +482,45 @@ end function util.set_ingredient(recipe_name, ingredient, quantity, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then + local is_fluid = not not data.raw.fluid[ingredient] me.add_modified(recipe_name) - 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) + set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid) end end -function set_ingredient(recipe, ingredient, quantity) +function set_ingredient(recipe, ingredient, quantity, is_fluid) if recipe ~= nil and recipe.ingredients ~= nil then for i, existing in pairs(recipe.ingredients) do - if existing[1] == ingredient then - existing[2] = quantity - return - elseif existing.name == ingredient then + if existing.name == ingredient then existing.amount = quantity existing.amount_min = nil existing.amount_max = nil return end end - table.insert(recipe.ingredients, {ingredient, quantity}) + if is_fluid then + table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity}) + else + table.insert(recipe.ingredients, {type="item", name=ingredient, amount=quantity}) + end end 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, options) if not should_force(options) and bypass(recipe_name) then return end - if data.raw.recipe[recipe_name] and - (data.raw.item[product[1]] or data.raw.item[product.name] or - data.raw.fluid[product[1]] or data.raw.fluid[product.name] - ) then + if data.raw.recipe[recipe_name] and + (data.raw.item[product.name] or data.raw.fluid[product.name]) then 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 function add_product(recipe, product) 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 - recipe.results = {{recipe.result, recipe.result_count and recipe.result_count or 1}} - end - recipe.result = nil - recipe.result_count = nil - table.insert(recipe.results, product) + if recipe.results == nil then + recipe.results = {} end - end + table.insert(recipe.results, product) end end @@ -571,18 +528,13 @@ end 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 + if 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 0 + return 1 end return 0 end @@ -592,14 +544,7 @@ function util.get_amount(recipe_name, product) if not product then product = recipe_name end local recipe = data.raw.recipe[recipe_name] if recipe then - if recipe.normal and recipe.normal.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 + if recipe.results then for i, result in pairs(recipe.results) do if result[1] == product then return result[2] end if result.name == product then return result.amount end @@ -617,9 +562,7 @@ function util.get_result_count(recipe_name, product) if not product then product = recipe_name end local recipe = data.raw.recipe[recipe_name] if recipe then - if recipe.normal and recipe.normal.results then - return #(recipe.normal.results) - elseif recipe.results then + if recipe.results then return #(recipe.results) end return 1 @@ -634,8 +577,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 me.add_modified(recipe_name) 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 @@ -677,8 +618,6 @@ function util.remove_ingredient(recipe_name, old, options) if data.raw.recipe[recipe_name] then me.add_modified(recipe_name) 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 @@ -704,28 +643,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 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].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 -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.result == new then return end if recipe.results then for i, existing in pairs(recipe.results) do - if existing[1] == new or existing.name == new then + if existing.name == new then return 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 if product.name == old then 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 @@ -738,8 +672,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 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].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 @@ -768,8 +700,6 @@ function util.set_product_amount(recipe_name, product, amount, options) me.add_modified(recipe_name) 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].normal, product, amount) - set_product_amount(data.raw.recipe[recipe_name].expensive, product, amount) end end @@ -808,8 +738,6 @@ function util.multiply_recipe(recipe_name, multiple, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then 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 @@ -817,8 +745,6 @@ function multiply_recipe(recipe, multiple) if recipe then if recipe.energy_required then recipe.energy_required = recipe.energy_required * multiple - else - recipe.energy_required = 0.5 * multiple -- 0.5 is factorio default end if recipe.result_count then recipe.result_count = recipe.result_count * multiple @@ -833,8 +759,11 @@ function multiply_recipe(recipe, multiple) result.amount_min = result.amount_min * multiple result.amount_max = result.amount_max * multiple end - if result.catalyst_amount then - result.catalyst_amount = result.catalyst_amount * multiple + if result.ignored_by_productivity then + 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 if result[1] then @@ -861,9 +790,8 @@ end -- Returns true if a recipe has an ingredient function util.has_ingredient(recipe_name, ingredient) - return data.raw.recipe[recipe_name] and ( - has_ingredient(data.raw.recipe[recipe_name], ingredient) or - has_ingredient(data.raw.recipe[recipe_name].normal, ingredient)) + return data.raw.recipe[recipe_name] and + has_ingredient(data.raw.recipe[recipe_name], ingredient) end function has_ingredient(recipe, ingredient) @@ -883,8 +811,6 @@ function util.remove_product(recipe_name, old, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then 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 @@ -907,8 +833,6 @@ function util.set_main_product(recipe_name, product, options) if not should_force(options) and 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) - set_main_product(data.raw.recipe[recipe_name].expensive, product) end end @@ -922,25 +846,18 @@ end function util.replace_product(recipe_name, old, new, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe_name] then - replace_product(data.raw.recipe[recipe_name], old, new, options) - replace_product(data.raw.recipe[recipe_name].normal, old, new, options) - replace_product(data.raw.recipe[recipe_name].expensive, old, new, options) + replace_product(data.raw.recipe[recipe_name], old, new) end end -function replace_product(recipe, old, new, options) +function replace_product(recipe, old, new) if recipe then 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 - if result[1] == old then result[1] = new end end end end @@ -968,8 +885,6 @@ function util.set_recipe_time(recipe_name, time, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then 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 @@ -987,8 +902,6 @@ function util.multiply_time(recipe_name, factor, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then 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 @@ -1006,8 +919,6 @@ function util.add_time(recipe_name, amount, options) me.add_modified(recipe_name) if data.raw.recipe[recipe_name] then 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 @@ -1031,7 +942,7 @@ end -- Set recipe subgroup function util.set_subgroup(recipe_name, subgroup, options) 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) data.raw.recipe[recipe_name].subgroup = subgroup end @@ -1050,34 +961,16 @@ function util.add_icon(recipe_name, icon, options) if data.raw.recipe[recipe_name] then me.add_modified(recipe_name) if not (data.raw.recipe[recipe_name].icons and #(data.raw.recipe[recipe_name].icons) > 0) then - if data.raw.recipe[recipe_name].icon then - data.raw.recipe[recipe_name].icons = {{ - icon=data.raw.recipe[recipe_name].icon, - icon_size=data.raw.recipe[recipe_name].icon_size, - 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_size = nil + data.raw.recipe[recipe_name].icons = {} + if data.raw.recipe[recipe_name].icon then + data.raw.recipe[recipe_name].icons = {{ + icon=data.raw.recipe[recipe_name].icon, + icon_size=data.raw.recipe[recipe_name].icon_size, + icon_mipmaps=data.raw.recipe[recipe_name].icon_mipmaps, + }} + data.raw.recipe[recipe_name].icon = nil + data.raw.recipe[recipe_name].icon_size = nil + end end table.insert(data.raw.recipe[recipe_name].icons, icon) end @@ -1137,8 +1030,6 @@ function util.add_to_ingredient(recipe, ingredient, amount, options) if not should_force(options) and bypass(recipe_name) then return end if data.raw.recipe[recipe] then 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 @@ -1161,8 +1052,6 @@ function util.add_to_product(recipe_name, product, amount, options) if not should_force(options) and bypass(recipe_name) then return end 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].normal, product, amount) - add_to_product(data.raw.recipe[recipe_name].expensive, product, amount) end end @@ -1285,10 +1174,8 @@ function remove_prior_unlocks(tech, recipe) util.remove_recipe_effect(tech, recipe) if technology.prerequisites then for i, prerequisite in pairs(technology.prerequisites) do - if string.sub(prerequisite, 1, 3) ~= 'ei_' then - -- log("BZZZ removing prior unlocks for " .. recipe .. " from " .. tech ..", checking " .. prerequisite) -- Handy Debug :| - remove_prior_unlocks(prerequisite, recipe) - end + -- log("BZZZ removing prior unlocks for " .. tech ..", checking " .. prerequisite) -- Handy Debug :| + remove_prior_unlocks(prerequisite, recipe) end end end @@ -1330,9 +1217,7 @@ function replace_ingredients_prior_to(tech, old, new, multiplier) if technology.prerequisites then for i, prerequisite in pairs(technology.prerequisites) do -- log("BZZZ checking " .. prerequisite) -- Handy Debug :| - if string.sub(prerequisite, 1, 3) ~= 'ei_' then - replace_ingredients_prior_to(prerequisite, old, new, multiplier) - end + replace_ingredients_prior_to(prerequisite, old, new, multiplier) end end end diff --git a/data.lua b/data.lua index 4f6e69c..0f18495 100644 --- a/data.lua +++ b/data.lua @@ -9,8 +9,8 @@ local util = require("data-util"); if mods.Krastorio2 then - if data.raw.item["automation-core"] then - data.raw.item["automation-core"].icon = "__bzaluminum__/graphics/icons/automation-core.png" + if data.raw.item["kr-automation-core"] then + data.raw.item["kr-automation-core"].icon = "__bzaluminum__/graphics/icons/automation-core.png" end if data.raw.technology["kr-automation-core"] then data.raw.technology["kr-automation-core"].icon = "__bzaluminum__/graphics/technology/automation-core.png" diff --git a/info.json b/info.json index 014581f..8b1e2a7 100644 --- a/info.json +++ b/info.json @@ -1,25 +1,25 @@ { "name": "bzaluminum", - "version": "0.4.28", - "factorio_version": "1.1", + "version": "2.0.0", + "factorio_version": "2.0", "title": "Aluminum", "author": "Brevven", "contact": "", "homepage": "", "dependencies": [ - "base >= 1.1.0", - "bzfoundry >= 0.2.1", + "base >= 2.0.0", + "bzfoundry >= 2.0.0", "~ bz-dsr-bridge", - "? bztitanium >= 1.0.3", - "? bzlead", - "? bzzirconium >= 0.5.4", + "? bztitanium >= 2.0.26", + "? bzlead >= 2.0.28", + "? bzzirconium >= 2.1.13", "? bztungsten >= 0.5.4", - "? bzcarbon >= 0.1.2", - "? space-exploration", - "? aai-industry", - "? Krastorio2", + "? bzcarbon >= 2.0.21", + "? space-exploration >= 0.7.34", + "? aai-industry >= 0.6.13", + "? Krastorio2 >= 2.0.8", "? sand-and-glass", - "? 248k", + "? 248k-Redux", "? deadlock-beltboxes-loaders", "? DeadlockCrating", "(?) bobtech", diff --git a/strange-matter.lua b/strange-matter.lua index 50f04c0..00bf2ee 100644 --- a/strange-matter.lua +++ b/strange-matter.lua @@ -15,7 +15,7 @@ data:extend({ enabled = false, energy_required = 1, ingredients = {{type="fluid", name="strange-matter", amount = 2}}, - result = ore, + results = {{type="item", name=ore, amount=1}}, category = "crafting-with-fluid", subgroup = "synthesis", },