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..85e49ae --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +*.zip \ No newline at end of file diff --git a/IntermediatesForYou2/LICENSE.md b/IntermediatesForYou2/LICENSE.md new file mode 100644 index 0000000..ee22ee9 --- /dev/null +++ b/IntermediatesForYou2/LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2023 Timeken + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/IntermediatesForYou2/README.md b/IntermediatesForYou2/README.md new file mode 100644 index 0000000..7db4260 --- /dev/null +++ b/IntermediatesForYou2/README.md @@ -0,0 +1,16 @@ +# MetalsForYou + +## Version History +See changelog.txt + +## Created by + + +## Thanks to + +### Compatibility + + +### Localization + + diff --git a/IntermediatesForYou2/changelog.txt b/IntermediatesForYou2/changelog.txt new file mode 100644 index 0000000..6c51ca7 --- /dev/null +++ b/IntermediatesForYou2/changelog.txt @@ -0,0 +1,66 @@ +--------------------------------------------------------------------------------------------------- +Version: 0.6.1 +Date: 2024-07-30 + Features: + - Increased elementite smelting from 2 -> 4 +--------------------------------------------------------------------------------------------------- +Version: 0.6.0 +Date: 2024-07-16 + Features: + - Added K2 imersite powder recipe if 248k is installed. + - Updated elementite production chain. + - Updated compatibility with Tantalite. + - Fixed missing locale for elementite processing. +--------------------------------------------------------------------------------------------------- +Version: 0.5.0 +Date: 2024-06-29 + Features: + - Added slag from sand if K2 or AAI is installed. + - Added elementite if SE is installed. +--------------------------------------------------------------------------------------------------- +Version: 0.4.2 +Date: 2024-01-21 + Features: + - Removed old unused files. +--------------------------------------------------------------------------------------------------- +Version: 0.4.1 +Date: 2024-01-06 + Features: + - Moved silver pyrometallurgi to ChemistryForYou2 mod. +--------------------------------------------------------------------------------------------------- +Version: 0.4.0 +Date: 2023-12-28 + Features: + - Added SE recycling recipe for long handed inserter. + - Added inserter parts to stack filter inserter. + - Added silver as a byproduct to zinc. (I need more silver) + - Added silver pyrometallurgi recipe to convert zinc and lead ore to silver. (I need even more silver!) + - Added low quality advanced circuit recipe if ThemTharHills is installed. (ThemTharHills needs too much gold when you have many mods and SE) + - Changed stack filter inserter to use filter inserter instead of stack inserter. +--------------------------------------------------------------------------------------------------- +Version: 0.3.1 +Date: 2023-12-24 + Features: + - Changed modules 2 and 3 recipes to be more balanced if SE is installed. +--------------------------------------------------------------------------------------------------- +Version: 0.3.0 +Date: 2023-12-19 + Features: + - Added springs. + - Added shock absorber. +--------------------------------------------------------------------------------------------------- +Version: 0.2.0 +Date: 2023-12-04 + Features: + - Added large turret base. + - Added large turret base to some rampant arsenal and K2 turrets. +--------------------------------------------------------------------------------------------------- +Version: 0.1.1 +Date: 2023-12-04 + Features: + - Fixed startup error when not playing If I Had a Nickel hardmode. +--------------------------------------------------------------------------------------------------- +Version: 0.1.0 +Date: 2023-12-03 + Features: + - Alpha release. \ No newline at end of file diff --git a/IntermediatesForYou2/data-final-fixes.lua b/IntermediatesForYou2/data-final-fixes.lua new file mode 100644 index 0000000..b95c07f --- /dev/null +++ b/IntermediatesForYou2/data-final-fixes.lua @@ -0,0 +1 @@ +local util = require("recipe-final-fix") \ No newline at end of file diff --git a/IntermediatesForYou2/data-updates.lua b/IntermediatesForYou2/data-updates.lua new file mode 100644 index 0000000..09f8c28 --- /dev/null +++ b/IntermediatesForYou2/data-updates.lua @@ -0,0 +1 @@ +require("recipe-modify") \ No newline at end of file diff --git a/IntermediatesForYou2/data-util.lua b/IntermediatesForYou2/data-util.lua new file mode 100644 index 0000000..4b2d096 --- /dev/null +++ b/IntermediatesForYou2/data-util.lua @@ -0,0 +1,930 @@ +local util = {} + +-- se landfill +-- params: ore, icon_size +function util.se_landfill(params) + if mods["space-exploration"] then + if not params.icon_size then params.icon_size = 64 end + local lname="landfill-"..params.ore + data:extend({ + { + type = "recipe", + icons = { + { icon = "__base__/graphics/icons/landfill.png", icon_size = 64, icon_mipmaps = 3 }, + { icon = "__Chromium2__/graphics/icons/"..params.ore..".png", icon_size = params.icon_size, scale = 0.33*64/params.icon_size}, + }, + energy_required = 1, + enabled=false, + name = lname, + category = "hard-recycling", + order = "z-b-"..params.ore, + subgroup = "terrain", + results = {{type="item", name="landfill", amount=1}}, + ingredients = {{type="item", name=params.ore, amount=50}}, + } + }) + util.add_unlock("se-recycling-facility", lname) + end +end + +-- se matter +-- params: ore, energy_required, quant_out, quant_in, icon_size, stream_out +function util.se_matter(params) + 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 + local sedata = mods["Krastorio2"] and "se-kr-matter-synthesis-data" or "se-fusion-test-data" + local sejunk = mods["Krastorio2"] and "se-broken-data" or "se-junk-data" + data:extend({ + { + type = "recipe", + name = fname, + localised_name = {"recipe-name.se-matter-fusion-to", {"item-name."..params.ore}}, + category = "space-materialisation", + subgroup = "materialisation", + order = "a-b-z", + icons = { + {icon = "__space-exploration-graphics__/graphics/blank.png", + icon_size = 64, scale = 0.5}, + {icon = "__space-exploration-graphics__/graphics/icons/fluid/particle-stream.png", + icon_size = 64, scale = 0.33, shift = {8,-8}}, + {icon = "__Chromium2__/graphics/icons/"..params.ore..".png", + icon_size = params.icon_size, scale = 0.33 * 64/params.icon_size, shift={-8, 8}}, + {icon = "__space-exploration-graphics__/graphics/icons/transition-arrow.png", + icon_size = 64, scale = 0.5}, + }, + energy_required = params.energy_required, + enabled = false, + ingredients = { + {type = "item", name = sedata, amount=1}, + {type="fluid", name="se-particle-stream", amount=50}, + {type="fluid", name="se-space-coolant-supercooled", amount=25}, + }, + results = { + {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}, + } + } + }) + util.add_unlock("se-space-matter-fusion", fname) + + if mods["Krastorio2"] then + local lname = params.ore.."-to-particle-stream" + data:extend({ + enabled = false, + { + type = "recipe", + name = lname, + localised_name = {"recipe-name.se-kr-matter-liberation", {"item-name."..params.ore}}, + category = "space-materialisation", + subgroup = "advanced-particle-stream", + order = "a-b-z", + icons = { + {icon = "__space-exploration-graphics__/graphics/blank.png", + icon_size = 64, scale = 0.5}, + {icon = "__space-exploration-graphics__/graphics/icons/fluid/particle-stream.png", + icon_size = 64, scale = 0.33, shift = {-8,8}}, + {icon = "__Chromium2__/graphics/icons/"..params.ore..".png", + icon_size = params.icon_size, scale = 0.33 * 64/params.icon_size, shift={8, -8}}, + {icon = "__space-exploration-graphics__/graphics/icons/transition-arrow.png", + icon_size = 64, scale = 0.5}, + }, + energy_required = 30, + enabled = false, + ingredients = { + {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, ignored_by_productivity = 50, ignored_by_stats = 50}, + } + } + }) + if not data.raw.technology["bz-advanced-stream-production"] then + data:extend({ + { + type = "technology", + name ="bz-advanced-stream-production", + localised_name = {"", {"technology-name.se-kr-advanced-stream-production"}, " 2"}, + icon = "__space-exploration-graphics__/graphics/technology/material-fabricator.png", + icon_size = 128, + effects = {}, + unit = { + count = 100, + time = 15, + ingredients = { + {"automation-science-pack", 1}, + {"logistic-science-pack", 1}, + {"chemical-science-pack", 1}, + {"se-rocket-science-pack", 1}, + {"space-science-pack", 1}, + {"production-science-pack", 1}, + {"utility-science-pack", 1}, + {"se-astronomic-science-pack-4", 1}, + {"se-energy-science-pack-4", 1}, + {"se-material-science-pack-4", 1}, + {"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) + 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.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] + if technology then + technology.prerequisites = {} + for i, prerequisite in pairs(prerequisites) do + if data.raw.technology[prerequisite] then + table.insert(technology.prerequisites, prerequisite) + end + end + end +end + +-- Add a prerequisite to a given technology +function util.add_prerequisite(technology_name, prerequisite) + local technology = data.raw.technology[technology_name] + if technology and data.raw.technology[prerequisite] then + if technology.prerequisites then + for i, pre in pairs(technology.prerequisites) do + if pre == prerequisite then return end + end + table.insert(technology.prerequisites, prerequisite) + else + technology.prerequisites = {prerequisite} + end + end +end + +-- Remove a prerequisite from a given technology +function util.remove_prerequisite(technology_name, prerequisite) + local technology = data.raw.technology[technology_name] + local index = -1 + if technology then + for i, prereq in pairs(technology.prerequisites) do + if prereq == prerequisite then + index = i + break + end + end + if index > -1 then + table.remove(technology.prerequisites, index) + end + end +end + + +-- Add an effect to a given technology +function util.add_effect(technology_name, effect) + local technology = data.raw.technology[technology_name] + if technology then + if not technology.effects then technology.effects = {} end + if effect and effect.type == "unlock-recipe" then + if not data.raw.recipe[effect.recipe] then + return + end + table.insert(technology.effects, effect) + end + end +end + +-- Add an effect to a given technology to unlock recipe +function util.add_unlock(technology_name, recipe) + util.add_effect(technology_name, {type="unlock-recipe", recipe=recipe}) +end + +-- remove recipe unlock effect from a given technology, multiple times if necessary +function util.remove_recipe_effect(technology_name, recipe_name) + local technology = data.raw.technology[technology_name] + local index = -1 + local cnt = 0 + if technology and technology.effects then + for i, effect in pairs(technology.effects) do + if effect.type == "unlock-recipe" and effect.recipe == recipe_name then + index = i + cnt = cnt + 1 + end + end + if index > -1 then + table.remove(technology.effects, index) + if cnt > 1 then -- not over yet, do it again + util.remove_recipe_effect(technology_name, recipe_name) + end + end + end +end + +-- Set technology ingredients +function util.set_tech_recipe(technology_name, ingredients) + local technology = data.raw.technology[technology_name] + if technology then + technology.unit.ingredients = ingredients + end +end + +function util.set_enabled(recipe_name, enabled) + if data.raw.recipe[recipe_name] then + data.raw.recipe[recipe_name].enabled = enabled + end +end + +function util.set_hidden(recipe_name) + if data.raw.recipe[recipe_name] then + data.raw.recipe[recipe_name].hidden = true + end +end + +-- Add a given quantity of ingredient to a given recipe +function util.add_or_add_to_ingredient(recipe_name, ingredient, quantity) + if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then + add_or_add_to_ingredient(data.raw.recipe[recipe_name], ingredient, quantity) + end +end + +function add_or_add_to_ingredient(recipe, ingredient, quantity) + if recipe ~= nil and recipe.ingredients ~= nil then + for i, existing in pairs(recipe.ingredients) do + if existing[1] == ingredient or existing.name == ingredient then + add_to_ingredient(recipe, ingredient, quantity) + return + end + end + table.insert(recipe.ingredients, {ingredient, quantity}) + end +end + +-- Add a given quantity of ingredient to a given recipe +function util.add_ingredient(recipe_name, ingredient, quantity) + local is_fluid = not not data.raw.fluid[ingredient] + if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then + add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid) + end +end + +function add_ingredient(recipe, ingredient, quantity, is_fluid) + if recipe ~= nil and recipe.ingredients ~= nil then + for i, existing in pairs(recipe.ingredients) do + if existing.name == ingredient then + return + end + end + 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 ingredient prototype to a given recipe +function util.add_ingredient_raw(recipe_name, ingredient) + if data.raw.recipe[recipe_name] and (data.raw.item[ingredient.name] or data.raw.item[ingredient[1]]) then + add_ingredient_raw(data.raw.recipe[recipe_name], ingredient) + end +end + +function add_ingredient_raw(recipe, ingredient) + if recipe ~= nil and recipe.ingredients ~= nil then + for i, existing in pairs(recipe.ingredients) do + if (existing.name and existing.name == ingredient.name) then + return + end + end + table.insert(recipe.ingredients, ingredient) + end +end + +-- Set an ingredient to a given quantity +function util.set_ingredient(recipe_name, ingredient, quantity) + if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then + set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity) + end +end + +function set_ingredient(recipe, ingredient, quantity) + if recipe ~= nil and recipe.ingredients ~= nil then + for i, existing in pairs(recipe.ingredients) do + 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}) + 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) + 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) + end +end + +function add_product(recipe, product) + if recipe ~= nil then + if recipe.results == nil then + recipe.results = {} + end + table.insert(recipe.results, product) + end +end + +-- Get the amount of the ingredient, will check base/normal not expensive +function util.get_ingredient_amount(recipe_name, ingredient_name) + local recipe = data.raw.recipe[recipe_name] + if recipe then + if recipe.ingredients then + for i, ingredient in pairs(recipe.ingredients) do + if ingredient.name == ingredient_name then return ingredient.amount end + end + end + return 1 + end + return 0 +end + +-- Get the amount of the result, will check base/normal not expensive +function util.get_amount(recipe_name, product) + if not product then product = recipe_name end + local recipe = data.raw.recipe[recipe_name] + if recipe then + if recipe.results then + for i, result in pairs(recipe.results) do + if result.name == product then return result.amount end + end + end + return 1 + end + return 0 +end + +-- Replace one ingredient with another in a recipe +-- Use amount to set an amount. If that amount is a multiplier instead of an exact amount, set multiply true. +function util.replace_ingredient(recipe_name, old, new, amount, multiply) + if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then + replace_ingredient(data.raw.recipe[recipe_name], old, new, amount or 1, multiply) + end +end + +function replace_ingredient(recipe, old, new, amount, multiply) + if recipe ~= nil and recipe.ingredients ~= nil then + for i, existing in pairs(recipe.ingredients) do + if existing.name == new then + return + end + end + for i, ingredient in pairs(recipe.ingredients) do + if ingredient.name == old then + ingredient.name = new + if multiply then + ingredient.amount = amount * ingredient.amount + else + ingredient.amount = amount + end + end + end + end +end + +-- Remove an ingredient from a recipe +function util.remove_ingredient(recipe_name, old) + if data.raw.recipe[recipe_name] then + remove_ingredient(data.raw.recipe[recipe_name], old) + end +end + +function remove_ingredient(recipe, old) + index = -1 + if recipe ~= nil and recipe.ingredients ~= nil then + for i, ingredient in pairs(recipe.ingredients) do + if ingredient.name == old then + index = i + break + end + end + if index > -1 then + table.remove(recipe.ingredients, index) + end + end +end + +-- Replace an amount of an ingredient in a recipe. Keep at least 1 of old. +function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amount) + local is_fluid = not not data.raw.fluid[new] + if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then + replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid) + end +end + +function replace_some_ingredient(recipe, old, old_amount, new, new_amount, is_fluid) + if recipe ~= nil and recipe.ingredients ~= nil then + for i, existing in pairs(recipe.ingredients) do + if existing.name == new then + return + end + end + for i, ingredient in pairs(recipe.ingredients) do + if ingredient.name == old then + ingredient.amount = math.max(1, ingredient.amount - old_amount) + end + end + add_ingredient(recipe, new, new_amount, is_fluid) + end +end + +-- set the amount of a product. +function util.set_product_amount(recipe_name, product, amount) + if data.raw.recipe[recipe_name] then + set_product_amount(data.raw.recipe[recipe_name], product, amount) + end +end + +function set_product_amount(recipe, product, amount) + if recipe then + if recipe.result_count then + recipe.result_count = amount + end + if recipe.results then + for i, result in pairs(recipe.results) do + if result.name == product then + if result.amount then + result.amount = amount + end + if result.amount_min ~= nil then + result.amount_min = nil + result.amount_max = nil + result.amount = amount + end + end + if result[1] == product then + result[2] = amount + end + end + end + if not recipe.results and not recipe.result_count then + -- implicit one item result + recipe.result_count = amount + end + end +end + +-- multiply the cost, energy, and results of a recipe by a multiple +function util.multiply_recipe(recipe_name, multiple) + if data.raw.recipe[recipe_name] then + multiply_recipe(data.raw.recipe[recipe_name], multiple) + end +end + +function multiply_recipe(recipe, multiple) + if recipe then + if recipe.energy_required then + recipe.energy_required = recipe.energy_required * multiple + end + if recipe.result_count then + recipe.result_count = recipe.result_count * multiple + end + if recipe.results then + for i, result in pairs(recipe.results) do + if result.name then + if result.amount then + result.amount = result.amount * multiple + end + if result.amount_min ~= nil then + 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 + end + end + if result[1] then + result[2] = result[2] * multiple + end + end + end + if not recipe.results and not recipe.result_count then + -- implicit one item result + recipe.result_count = multiple + end + if recipe.ingredients then + for i, ingredient in pairs(recipe.ingredients) do + if ingredient.name then + ingredient.amount = ingredient.amount * multiple + end + if ingredient[1] then + ingredient[2] = ingredient[2] * multiple + end + end + end + end +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) +end + +function has_ingredient(recipe, ingredient) + if recipe ~= nil and recipe.ingredients ~= nil then + for i, existing in pairs(recipe.ingredients) do + if existing[1] == ingredient or existing.name == ingredient then + return true + end + end + end + return false +end + +-- Remove a product from a recipe, WILL NOT remove the only product +function util.remove_product(recipe_name, old) + if data.raw.recipe[recipe_name] then + remove_product(data.raw.recipe[recipe_name], old) + end +end + +function remove_product(recipe, old) + index = -1 + if recipe ~= nil and recipe.results ~= nil then + for i, result in pairs(recipe.results) do + if result.name == old or result[1] == old then + index = i + break + end + end + if index > -1 then + table.remove(recipe.results, index) + end + end +end + +function util.set_main_product(recipe_name, product) + if data.raw.recipe[recipe_name] then + set_main_product(data.raw.recipe[recipe_name], product) + end +end + +function set_main_product(recipe, product) + if recipe then + recipe.main_product = product + end +end + +-- Replace one product with another in a recipe +function util.replace_product(recipe_name, old, new) + if data.raw.recipe[recipe_name] then + replace_product(data.raw.recipe[recipe_name], old, new) + end +end + +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 +end + +-- Remove an element of type t and name from data.raw +function util.remove_raw(t, name) + if not data.raw[t] then + log(t.." not found in data.raw") + return + end + if data.raw[t][name] then + for i, elem in pairs(data.raw[t]) do + if elem.name == name then + data.raw[t][i] = nil + break + end + end + end +end + +-- Set energy required +function util.set_recipe_time(recipe_name, time) + if data.raw.recipe[recipe_name] then + set_recipe_time(data.raw.recipe[recipe_name], time) + end +end + +function set_recipe_time(recipe, time) + if recipe then + if recipe.energy_required then + recipe.energy_required = time + end + end +end + +-- Multiply energy required +function util.multiply_time(recipe_name, factor) + if data.raw.recipe[recipe_name] then + multiply_time(data.raw.recipe[recipe_name], factor) + end +end + +function multiply_time(recipe, factor) + if recipe then + if recipe.energy_required then + recipe.energy_required = recipe.energy_required * factor + end + end +end + +-- Add to energy required +function util.add_time(recipe_name, amount) + if data.raw.recipe[recipe_name] then + add_time(data.raw.recipe[recipe_name], amount) + end +end + +function add_time(recipe, amount) + if recipe then + if recipe.energy_required then + recipe.energy_required = recipe.energy_required + amount + end + end +end + +-- Set recipe category +function util.set_category(recipe_name, category) + if data.raw.recipe[recipe_name] and data.raw["recipe-category"][category] then + data.raw.recipe[recipe_name].category = category + end +end + +-- Set recipe subgroup +function util.set_subgroup(recipe_name, subgroup) + if data.raw.recipe[recipe_name] then + data.raw.recipe[recipe_name].subgroup = subgroup + end +end + +-- Set item subgroup +function util.set_item_subgroup(item, subgroup) + if data.raw.item[item] and data.raw["item-subgroup"][subgroup] then + data.raw.item[item].subgroup = subgroup + end +end + +function util.add_icon(recipe_name, icon) + if data.raw.recipe[recipe_name] then + if not (data.raw.recipe[recipe_name].icons and #(data.raw.recipe[recipe_name].icons) > 0) 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 + table.insert(data.raw.recipe[recipe_name].icons, icon) + end +end + +-- Set recipe icons +function util.set_icons(recipe_name, icons) + if data.raw.recipe[recipe_name] then + data.raw.recipe[recipe_name].icons = icons + data.raw.recipe[recipe_name].icon = nil + data.raw.recipe[recipe_name].icon_size = nil + end +end + +-- Set recipe icons +function util.set_item_icons(item_name, icons) + if data.raw.item[item_name] then + data.raw.item[item_name].icons = icons + data.raw.item[item_name].icon = nil + data.raw.item[item_name].icon_size = nil + end +end + +-- Gets an item or fluid icon +function util.get_item_or_fluid_icon(name) + icon = "" + if data.raw.item[name] then + icon = data.raw.item[name].icon + if not icon then icon = data.raw.item[name].icons[1].icon end + elseif data.raw.fluid[name] then + icon = data.raw.fluid[name].icon + if not icon then icon = data.raw.fluid[name].icons[1].icon end + end + return icon +end + +function util.set_to_founding(recipe) + util.set_category(recipe, "founding") + util.set_subgroup(recipe, "foundry-intermediate") +end + +-- Add crafting category to an entity +function util.add_crafting_category(entity_type, entity, category) + if data.raw[entity_type][entity] and data.raw["recipe-category"][category] then + for i, existing in pairs(data.raw[entity_type][entity].crafting_categories) do + if existing == category then + return + end + end + table.insert(data.raw[entity_type][entity].crafting_categories, category) + end +end + +function util.add_to_ingredient(recipe, ingredient, amount) + if data.raw.recipe[recipe] then + add_to_ingredient(data.raw.recipe[recipe], ingredient, amount) + end +end + +function add_to_ingredient(recipe, it, amount) + if recipe ~= nil and recipe.ingredients ~= nil then + for i, ingredient in pairs(recipe.ingredients) do + if ingredient.name == it then + ingredient.amount = ingredient.amount + amount + return + end + if ingredient[1] == it then + ingredient[2] = ingredient[2] + amount + return + end + end + end +end + +function util.add_to_product(recipe_name, product, amount) + if data.raw.recipe[recipe_name] then + add_to_product(data.raw.recipe[recipe_name], product, amount) + end +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 + return + end + if result[1] == product then + result[2] = result[2] + amount + return + end + end + end +end + +-- Adds a result to a mineable type +function util.add_minable_result(t, name, result) + if data.raw[t] and data.raw[t][name] and data.raw[t][name].minable then + if data.raw[t][name].minable.result and not data.raw[t][name].minable.results then + data.raw[t][name].minable.results = { + {data.raw[t][name].minable.result ,data.raw[t][name].minable.count}} + data.raw[t][name].minable.result = nil + data.raw[t][name].minable.result_count = nil + end + if data.raw[t][name].minable.results then + table.insert(data.raw[t][name].minable.results, result) + end + end +end + +function util.remove_prior_unlocks(tech, recipe) + if data.raw.technology[tech].prerequisites then + for i, prerequisite in pairs(data.raw.technology[tech].prerequisites) do + remove_prior_unlocks(prerequisite, recipe) + end + end +end + +function remove_prior_unlocks(tech, recipe) + local technology = data.raw.technology[tech] + if technology then + util.remove_recipe_effect(tech, recipe) + if technology.prerequisites then + for i, prerequisite in pairs(technology.prerequisites) do + -- log("BZZZ removing prior unlocks for " .. tech ..", checking " .. prerequisite) -- Handy Debug :| + remove_prior_unlocks(prerequisite, recipe) + end + end + end +end + +function util.replace_ingredients_prior_to(tech, old, new, multiplier) + if not data.raw.technology[tech] then + log("Not replacing ingredient "..old.." with "..new.." because tech "..tech.." was not found") + return + end + util.remove_prior_unlocks(tech, old) + for i, recipe in pairs(data.raw.recipe) do + if (recipe.enabled and recipe.enabled ~= 'false') + and (not recipe.hidden or recipe.hidden == 'true') -- probably don't want to change hidden recipes + and string.sub(recipe.name, 1, 3) ~= 'se-' -- have to exlude SE in general :( + then + -- log("BZZZ due to 'enabled' replacing " .. old .. " with " .. new .." in " .. recipe.name) -- Handy Debug :| + util.replace_ingredient(recipe.name, old, new, multiplier, true) + end + end + if data.raw.technology[tech].prerequisites then + for i, prerequisite in pairs(data.raw.technology[tech].prerequisites) do + replace_ingredients_prior_to(prerequisite, old, new, multiplier) + end + end +end + +function replace_ingredients_prior_to(tech, old, new, multiplier) + local technology = data.raw.technology[tech] + if technology then + if technology.effects then + for i, effect in pairs(technology.effects) do + if effect.type == "unlock-recipe" then + -- log("BZZZ replacing " .. old .. " with " .. new .." in " .. effect.recipe) -- Handy Debug :| + util.replace_ingredient(effect.recipe, old, new, multiplier, true) + end + end + end + if technology.prerequisites then + for i, prerequisite in pairs(technology.prerequisites) do + -- log("BZZZ checking " .. prerequisite) -- Handy Debug :| + replace_ingredients_prior_to(prerequisite, old, new, multiplier) + end + end + end +end + +function util.remove_all_recipe_effects(recipe_name) + for name, _ in pairs(data.raw.technology) do + util.remove_recipe_effect(name, recipe_name) + end +end + +function util.add_unlock_force(technology_name, recipe) + util.set_enabled(recipe, false) + util.remove_all_recipe_effects(recipe) + util.add_unlock(technology_name, recipe) +end + +-- 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 + if result[2] then amt = result[2] + elseif result.amount then amt = result.amount + elseif result.amount_min then amt = (result.amount_min + result.amount_max)/2 + end + if result.probability then amt = amt * result.probability end + sum = sum + amt + end + return sum + end + return 0 +end + +function util.add_productivity(recipe) + data.raw.recipe[recipe].allow_productivity = true +end + +return util \ No newline at end of file diff --git a/IntermediatesForYou2/data.lua b/IntermediatesForYou2/data.lua new file mode 100644 index 0000000..973e444 --- /dev/null +++ b/IntermediatesForYou2/data.lua @@ -0,0 +1,3 @@ +require("prototypes.recipes") +require("prototypes.technology") +require("prototypes.se-recycling") \ No newline at end of file diff --git a/IntermediatesForYou2/graphics/icons/advanced-electronic-components.png b/IntermediatesForYou2/graphics/icons/advanced-electronic-components.png new file mode 100644 index 0000000..dc7822d Binary files /dev/null and b/IntermediatesForYou2/graphics/icons/advanced-electronic-components.png differ diff --git a/IntermediatesForYou2/graphics/icons/elementite-dust.png b/IntermediatesForYou2/graphics/icons/elementite-dust.png new file mode 100644 index 0000000..ca39f7b Binary files /dev/null and b/IntermediatesForYou2/graphics/icons/elementite-dust.png differ diff --git a/IntermediatesForYou2/graphics/icons/elementite.png b/IntermediatesForYou2/graphics/icons/elementite.png new file mode 100644 index 0000000..078517f Binary files /dev/null and b/IntermediatesForYou2/graphics/icons/elementite.png differ diff --git a/IntermediatesForYou2/graphics/icons/elementium-plate.png b/IntermediatesForYou2/graphics/icons/elementium-plate.png new file mode 100644 index 0000000..e98014d Binary files /dev/null and b/IntermediatesForYou2/graphics/icons/elementium-plate.png differ diff --git a/IntermediatesForYou2/graphics/icons/satellite-body.png b/IntermediatesForYou2/graphics/icons/satellite-body.png new file mode 100644 index 0000000..e679c4f Binary files /dev/null and b/IntermediatesForYou2/graphics/icons/satellite-body.png differ diff --git a/IntermediatesForYou2/graphics/icons/shock-absorber.png b/IntermediatesForYou2/graphics/icons/shock-absorber.png new file mode 100644 index 0000000..b17a95f Binary files /dev/null and b/IntermediatesForYou2/graphics/icons/shock-absorber.png differ diff --git a/IntermediatesForYou2/graphics/icons/slag.png b/IntermediatesForYou2/graphics/icons/slag.png new file mode 100644 index 0000000..4812e46 Binary files /dev/null and b/IntermediatesForYou2/graphics/icons/slag.png differ diff --git a/IntermediatesForYou2/graphics/icons/spring.png b/IntermediatesForYou2/graphics/icons/spring.png new file mode 100644 index 0000000..db6fa84 Binary files /dev/null and b/IntermediatesForYou2/graphics/icons/spring.png differ diff --git a/IntermediatesForYou2/graphics/icons/trace-rare-ore-extraction.png b/IntermediatesForYou2/graphics/icons/trace-rare-ore-extraction.png new file mode 100644 index 0000000..beb64a4 Binary files /dev/null and b/IntermediatesForYou2/graphics/icons/trace-rare-ore-extraction.png differ diff --git a/IntermediatesForYou2/graphics/icons/turret-base.png b/IntermediatesForYou2/graphics/icons/turret-base.png new file mode 100644 index 0000000..8abf650 Binary files /dev/null and b/IntermediatesForYou2/graphics/icons/turret-base.png differ diff --git a/IntermediatesForYou2/graphics/icons/turret-large-base.png b/IntermediatesForYou2/graphics/icons/turret-large-base.png new file mode 100644 index 0000000..b33978d Binary files /dev/null and b/IntermediatesForYou2/graphics/icons/turret-large-base.png differ diff --git a/IntermediatesForYou2/info.json b/IntermediatesForYou2/info.json new file mode 100644 index 0000000..a25235c --- /dev/null +++ b/IntermediatesForYou2/info.json @@ -0,0 +1,39 @@ +{ + "name": "IntermediatesForYou2", + "version": "2.0.0", + "factorio_version": "2.0", + "title": "IntermediatesForYou", + "author": "Timeken, cackling fiend", + "homepage": "https://discord.gg/ufvFUJtVwk", + "dependencies": [ + "base >= 2.0.0", + "? 248k-Redux", + "? aai-industry", + "? bismuth", + "? Bio_Industries_2", + "? BrassTacks-Updated", + "? bobassembly", + "? BrimStuff-Updated", + "? bzaluminum", + "? bzcarbon", + "? bzchlorine", + "? bzfoundry", + "? bzgas", + "? bzgold", + "? bzlead", + "? bzsilicon", + "? bztin", + "? EndgameCombat", + "? IfNickel-Updated", + "? Nylon2", + "? Krastorio2", + "? Krastorio2Assets", + "? MDbobelectronics2", + "? RampantArsenal", + "? Repair_Turret", + "? space-exploration", + "? ShockTurret", + "? ThemTharHills-Updated" + ], + "description": "This mod adds some intermediates and is intented to be played with my other mods.\n\nThis mod is inspired by Brevven's BZ mods." +} \ No newline at end of file diff --git a/IntermediatesForYou2/locale/en/IntermediatesForYou.cfg b/IntermediatesForYou2/locale/en/IntermediatesForYou.cfg new file mode 100644 index 0000000..b7241ef --- /dev/null +++ b/IntermediatesForYou2/locale/en/IntermediatesForYou.cfg @@ -0,0 +1,66 @@ +[technology-name] +slag-processing=Slag processing +elementite-processing=Elementite processing + +[technology-description] +elementite-processing=Elementium is a heat and cold resistant alloy forged from ice and fire capable of withstanding extreme temperatures. + +[autoplace-control-names] + +[tool-name] + +[item-name] +turret-base=Turret base +turret-large-base=Large turret base + +advanced-electronic-components=Advanced electronic components + +satellite-body=Satellite body + +spring=Spring +shock-absorber=Shock absorber + +aluminium-hydroxide=Aluminium hydroxide +sodium-hydroxide=Sodium hydroxide +sodium-aluminate=Sodium aluminate + +slag=Slag +elementite=Elementite +elementite-dust=Elementite dust +elementium-plate=Elementium plate + +[fluid-name] +hydrogen-peroxide=Hydrogen peroxide +nitrous-oxide=Nitrous oxide + +[entity-name] + +[mod-setting-name] + +[mod-setting-description] + +[recipe-name] +se-recycle-long-handed-inserter=Long handed inserter recycling +low-quality-advanced-circuit=Low quality advanced circuit +rich-water-filtration=Rich water filtration +nuclear-waste-extraction=Nuclear waste extraction +hydrogen-peroxide=Hydrogen peroxide +hydrogen-peroxide-disproportionation=Hydrogen peroxide disproportionation +hydrogen-peroxide-rocket-fuel=Hydrogen peroxide rocket fuel +productivity-science-pack=Productivity science pack +nitrous-oxide-rocket-fuel=Nitrous oxide rocket fuel +saltpeter-sulfuric-acid=Saltpeter sulfuric acid +aluminium-hydroxide-smelting=Aluminium hydroxide smelting +sodium-hydroxide-reaction=Sodium hydroxide reaction +silica-extraction=Silica extraction +sodium-aluminate=Sodium aluminate + +slag=slag +iron-extraction=Iron extraction +trace-rare-ore-extraction=Trace rare ore extraction +elementite=Elementite +elementite-dust=Elementite dust +elementium-plate=Elementium plate + +[recipe-description] +low-quality-advanced-circuit=When resources are scarce you use what you got. \ No newline at end of file diff --git a/IntermediatesForYou2/prototypes/recipes.lua b/IntermediatesForYou2/prototypes/recipes.lua new file mode 100644 index 0000000..a1d27bd --- /dev/null +++ b/IntermediatesForYou2/prototypes/recipes.lua @@ -0,0 +1,399 @@ +local util = require("data-util") + +local turret_base_ingredients = {{type="item", name="iron-plate", amount=10}, {type="item", name="iron-gear-wheel", amount=10}} +if mods["Krastorio2"] and mods["aai-industry"] then + turret_base_ingredients = {{type="item", name="kr-iron-beam", amount=5}, {type="item", name="motor", amount=5}, {type="item", name="iron-gear-wheel", amount=4}} +end + +if mods["Krastorio2"] then + local electronic_ingredients = {{type="item", name="kr-electronic-components", amount=3}} + if mods["bzgold"] then + electronic_ingredients = {{type="item", name="kr-electronic-components", amount=1}, (mods["ThemTharHills-Updated"] and {type="item", name="integrated-circuit", amount=5}) or (mods["MDbobelectronics2"] and {type="item", name="intergrated-electronics", amount=2}), {type="item", name="cpu", amount=1}} + elseif mods["MDbobelectronics2"] then + electronic_ingredients = {{type="item", name="kr-electronic-components", amount=1}, {type="item", name="intergrated-electronics", amount=2}, {type="item", name="processing-electronics", amount=1}} + end +data:extend({ + { + type = "item", + name = "advanced-electronic-components", + icon = "__IntermediatesForYou2__/graphics/icons/advanced-electronic-components.png", + icon_size = 64, + group = "kr-electronic-components", + subgroup = "intermediate-product", + order = "e03", + stack_size = 100, + }, + { + type = "recipe", + name = "advanced-electronic-components", + category = "crafting", + order = "e03", + enabled = false, + energy_required = 4, + ingredients = electronic_ingredients, + results = {{type="item", name="advanced-electronic-components", amount=2}}, + } +}) +if mods["248k-Redux"] then + data:extend({ + { + type = "recipe", + name = "charged-crystal-imersite-powder", + icons = + { + { icon = "__Krastorio2Assets__/icons/items-with-variations/imersite-powder/imersite-powder.png", icon_size = 64}, + { icon = "__248k-Redux__/ressources/fusion/fu_materials/fu_materials_energy_crystal_charged.png", icon_size = 64, scale=0.3, shift= {-8, -8}}, + }, + category = "crushing", + order = "a-a-a-1", + enabled = false, + energy_required = 4, + ingredients = {{type="item", name="fu_materials_energy_charged_crystal", amount=1}}, + results = {{type="item", name="imersite-powder", amount=2}}, + } + }) + util.add_unlock("kr-imersium-processing", "charged-crystal-imersite-powder") +end + +util.add_unlock("processing-unit", "advanced-electronic-components") +end + +local turret_large_base_ingredients = {(data.raw.item["tantalum-titanium-beam"] and {type="item", name="tantalum-titanium-beam", amount=60}) or {type="item", name="steel-plate", amount=60}, {type="item", name="concrete", amount=60}} +if data.raw.item["lead-plate"] then + table.insert(turret_large_base_ingredients, {type="item", name="lead-plate", amount=20}) +end + +local satellite_body_ingredients = {{type="item", name="low-density-structure", amount=50}} +if mods["bismuth"] then + table.insert(satellite_body_ingredients, {type="item", name="bismuth-glass", amount=100}) +end +if mods["bzcarbon"] then + table.insert(satellite_body_ingredients, {type="item", name="graphene", amount=100}) +end +if data.raw.item["gimbaled-thruster"] then + table.insert(satellite_body_ingredients, {type="item", name="gimbaled-thruster", amount=10}) +end +if mods["248k-Redux"] then + table.insert(satellite_body_ingredients, {type="item", name="fu_materials_KFK", amount=10}) +end + +local shock_absorber_ingredients = {{type="item", name="spring", amount=1}, {type="item", name="iron-stick", amount=1}} +if data.raw.item["rubber"] then + table.insert(shock_absorber_ingredients, {type="item", name="rubber", amount=1}) +end + +data:extend({ + { + type = "item", + name = "turret-base", + icon = "__IntermediatesForYou2__/graphics/icons/turret-base.png", + icon_size = 64, + group = "intermediate-product", + subgroup = "intermediate-product", + order = "t", + stack_size = 100, + }, + { + type = "item", + name = "turret-large-base", + icon = "__IntermediatesForYou2__/graphics/icons/turret-large-base.png", + icon_size = 64, + group = "intermediate-product", + subgroup = "intermediate-product", + order = "t", + stack_size = 50, + }, + { + type = "item", + name = "spring", + icon = "__IntermediatesForYou2__/graphics/icons/spring.png", + icon_size = 64, + group = "intermediate-product", + subgroup = "intermediate-product", + order = "a[spring]", + stack_size = 100, + }, + { + type = "item", + name = "satellite-body", + icon = "__IntermediatesForYou2__/graphics/icons/satellite-body.png", + icon_size = 64, + group = "intermediate-product", + subgroup = "intermediate-product", + order = "s", + stack_size = 100, + }, + { + type = "item", + name = "shock-absorber", + icon = "__IntermediatesForYou2__/graphics/icons/shock-absorber.png", + icon_size = 64, + group = "intermediate-product", + subgroup = "intermediate-product", + order = "s", + stack_size = 100, + }, + { + type = "recipe", + name = "turret-base", + category = "crafting", + order = "t", + enabled = false, + energy_required = 8, + ingredients = turret_base_ingredients, + results = {{type="item", name="turret-base", amount=1}}, + }, + { + type = "recipe", + name = "spring", + category = "crafting", + order = "s1[spring]", + enabled = false, + energy_required = 2, + ingredients = {{type="item", name="copper-plate", amount=1}}, + results = {{type="item", name="spring", amount=1}}, + }, + { + type = "recipe", + name = "turret-large-base", + category = "crafting", + order = "t", + enabled = false, + energy_required = 16, + ingredients = turret_large_base_ingredients, + results = {{type="item", name="turret-large-base", amount=1}}, + }, + { + type = "recipe", + name = "satellite-body", + category = "crafting", + order = "s", + enabled = false, + energy_required = 20, + ingredients = satellite_body_ingredients, + results = {{type="item", name="satellite-body", amount=1}}, + }, + { + type = "recipe", + name = "shock-absorber", + category = "crafting", + order = "s", + enabled = false, + energy_required = 4, + ingredients = shock_absorber_ingredients, + results = {{type="item", name="shock-absorber", amount=1}}, + } +}) +util.add_unlock("gun-turret", "turret-base") +util.add_unlock("artillery", "turret-large-base") +util.add_unlock("logistics", "spring") +util.add_unlock("rocket-silo","satellite-body") +util.add_unlock("fast-inserter", "shock-absorber") + +if mods["bzfoundry"] and data.raw.item["bronze-plate"] then +data:extend({ + { + type = "recipe", + name = "bronze-spring", + category = "crafting", + order = "s2[spring]", + enabled = false, + energy_required = 2, + ingredients = {{type="item", name="bronze-plate", amount=1}}, + results = {{type="item", name="spring", amount=2}}, + } +}) + util.add_unlock("foundry", "bronze-spring") +end + +if mods["ThemTharHills-Updated"] then +local low_quality_advanced_circuit_ingredients = {{type="item", name="copper-cable", amount=3}, {type="item", name="electronic-circuit", amount=3}} +if data.raw.item["solder"] then + table.insert(low_quality_advanced_circuit_ingredients, {type="item", name="solder", amount=4}) +end +if data.raw.item["kr-electronic-components"] then + table.insert(low_quality_advanced_circuit_ingredients, {type="item", name="kr-electronic-components", amount=2}) +end +if data.raw.item["circuit-board"] then + table.insert(low_quality_advanced_circuit_ingredients, {type="item", name="circuit-board", amount=1}) +end +local low_quality_advanced_circuit_results = {{name="advanced-circuit", amount=1, probability=0.75}} +if mods["space-exploration"] then + table.insert(low_quality_advanced_circuit_results, {name="se-scrap", amount=1, probability=0.25}) +end + +data:extend({ + { + type = "recipe", + name = "low-quality-advanced-circuit", + category = "crafting", + icons = (mods["Krastorio2"] and + { + { icon = "__base__/graphics/icons/advanced-circuit.png", icon_size = 64}, + { icon = "__base__/graphics/icons/copper-cable.png", icon_size = 64, scale=0.25, shift= {-8, -8}}, + } or { + { icon = "__base__/graphics/icons/advanced-circuit.png", icon_size = 64}, + } + ), + main_product = "advanced-circuit", + order = "f", + enabled = false, + energy_required = 6, + ingredients = low_quality_advanced_circuit_ingredients, + results = low_quality_advanced_circuit_results, + } +}) +util.add_unlock("advanced-circuit", "low-quality-advanced-circuit") +end + +if mods["aai-industry"] or mods["Krastorio2"] then + data:extend({ + { + type = "item", + name = "slag", + icon = "__IntermediatesForYou2__/graphics/icons/slag.png", + icon_size = 128, + group = "resources", + subgroup = "raw-material", + order = "a[slag]", + stack_size = 100, + }, + { + type = "recipe", + name = "slag", + category = "smelting", + order = "s[slag]", + enabled = false, + energy_required = 2, + ingredients = {{type="item", name=mods["Krastorio2"] and "kr-sand" or "sand", amount=10}}, + results = {{type="item", name="slag", amount=1}}, + }, + { + type = "recipe", + name = "iron-extraction", + icons = + { + { icon = "__base__/graphics/icons/iron-ore.png", icon_size = 64}, + { icon = "__IntermediatesForYou2__/graphics/icons/slag.png", icon_size = 128, scale=0.125, shift= {-8, -8}}, + }, + category = "smelting", + order = "s[slag]", + enabled = false, + energy_required = 2, + ingredients = {{type="item", name="slag", amount=5}}, + results = {{type="item", name="iron-ore", amount=1}}, + } + }) +end + +if mods["space-exploration"] then + local trace_rare_ore_extraction_ingredients = {{type="item", name="elementite-dust", amount=5}} + if data.raw.item["cobalt-electromagnet"] then + table.insert(trace_rare_ore_extraction_ingredients, {type="item", name="cobalt-electromagnet", amount=1}) + end + local trace_rare_ore_extraction_results = {{type="item", name="sand", amount=1}, {type="item", name="se-iridium-powder", amount=1, probability=0.1}, {type="item", name="se-holmium-powder", amount=1, probability=0.1}, {type="item", name="se-beryllium-powder", amount=1, probability=0.1}} + if data.raw.item["cobalt-electromagnet"] then + table.insert(trace_rare_ore_extraction_results, {type="item", name="cobalt-electromagnet", amount=1, probability=0.95}) + end + local elementium_heat_shielding_ingredients = {{type="item", name="elementium-plate", amount=1}, {type="item", name="sulfur", amount=1}} + if data.raw.item["cuw"] then + table.insert(elementium_heat_shielding_ingredients, {type="item", name="cuw", amount=1}) + end + if data.raw.item["zirconia"] then + table.insert(elementium_heat_shielding_ingredients, {type="item", name="zirconia", amount=1}) + end + if data.raw.item["niobium-plate"] then + table.insert(elementium_heat_shielding_ingredients, {type="item", name="niobium-plate", amount=1}) + end + data:extend({ + { + type = "item", + name = "elementite", + icon = "__IntermediatesForYou2__/graphics/icons/elementite.png", + icon_size = 128, + group = "resources", + subgroup = "raw-material", + order = "e[elementite]", + stack_size = 50, + }, + { + type = "item", + name = "elementite-dust", + icon = "__IntermediatesForYou2__/graphics/icons/elementite-dust.png", + icon_size = 128, + group = "resources", + subgroup = "raw-material", + order = "e[elementite]", + stack_size = 200, + }, + { + type = "item", + name = "elementium-plate", + icon = "__IntermediatesForYou2__/graphics/icons/elementium-plate.png", + icon_size = 64, + group = "resources", + subgroup = "raw-material", + order = "e[elementite]", + stack_size = 100, + }, + { + type = "recipe", + name = "elementite", + category = "space-thermodynamics", + order = "e[elementite]", + enabled = false, + energy_required = 20, + ingredients = {{type="item", name="se-cryonite-rod", amount=5}, {type="item", name="se-vulcanite-block", amount=5}}, + results = {{type="item", name="elementite", amount=4}}, + }, + { + type = "recipe", + name = "elementium-plate", + category = "space-thermodynamics", + order = "e[elementite]", + enabled = false, + energy_required = 20, + ingredients = {{type="item", name="elementite", amount=5}}, + results = {{type="item", name="elementium-plate", amount=1}}, + }, + { + type = "recipe", + name = "elementite-dust", + category = "pulverising", + order = "e[elementite]", + enabled = false, + energy_required = 2, + ingredients = {{type="item", name="elementite", amount=5}}, + results = {{type="item", name="elementite-dust", amount=5}}, + }, + { + type = "recipe", + name = "trace-rare-ore-extraction", + icon = "__IntermediatesForYou2__/graphics/icons/trace-rare-ore-extraction.png", + icon_size = 128, + category = "space-radiation", + order = "e[elementite]", + group = "resources", + subgroup = "raw-material", + enabled = false, + energy_required = 20, + ingredients = trace_rare_ore_extraction_ingredients, + results = trace_rare_ore_extraction_results, + }, + { + type = "recipe", + name = "elementium-heat-shielding", + icons = + { + { icon = "__space-exploration-graphics__/graphics/icons/heat-shielding.png", icon_size = 64}, + { icon = "__IntermediatesForYou2__/graphics/icons/elementium-plate.png", icon_size = 64, scale=0.3, shift= {-8, -8}}, + }, + category = "crafting", + order = "f", + enabled = false, + energy_required = 10, + ingredients = elementium_heat_shielding_ingredients, + results = {{type="item", name="se-heat-shielding", amount=1}}, + } + }) +end \ No newline at end of file diff --git a/IntermediatesForYou2/prototypes/se-recycling.lua b/IntermediatesForYou2/prototypes/se-recycling.lua new file mode 100644 index 0000000..346168e --- /dev/null +++ b/IntermediatesForYou2/prototypes/se-recycling.lua @@ -0,0 +1,47 @@ +local util = require("data-util") +if mods["space-exploration"] then +local se_recycle_long_handed_inserter_results = {{type="item", name="iron-stick", amount=1}, {type="item", name="inserter", amount=1, probability=0.75}} +if data.raw.item["solder"] then + table.insert(se_recycle_long_handed_inserter_results, {type="item", name="solder", amount=1}) +end +if data.raw.item["articulated-mechanism"] then + table.insert(se_recycle_long_handed_inserter_results, {type="item", name="articulated-mechanism", amount=1}) +end +data:extend({ + { + type = "recipe", + name = "se-recycle-long-handed-inserter", + icons = { + { + icon = "__space-exploration-graphics__/graphics/blank.png", + icon_size = 64 + }, + { + icon = "__base__/graphics/icons/inserter.png", + icon_size = 64, + scale = 0.33, + shift = {-8, 8} + }, + { + icon = "__base__/graphics/icons/long-handed-inserter.png", + icon_size = 64, + scale = 0.33, + shift = {8, -8} + }, + { + icon = "__space-exploration-graphics__/graphics/icons/transition-arrow.png", + icon_size = 64 + } + }, + category = "hard-recycling", + subgroup = "recycling", + main_product = "", + order = "l", + enabled = false, + energy_required = 3, + ingredients = {{type="item", name="long-handed-inserter", amount=1}}, + results = se_recycle_long_handed_inserter_results, + } +}) +util.add_unlock("se-recycling-facility", "se-recycle-long-handed-inserter") +end \ No newline at end of file diff --git a/IntermediatesForYou2/prototypes/technology.lua b/IntermediatesForYou2/prototypes/technology.lua new file mode 100644 index 0000000..c1f756b --- /dev/null +++ b/IntermediatesForYou2/prototypes/technology.lua @@ -0,0 +1,85 @@ +local util = require("data-util") + +if mods["aai-industry"] or mods["Krastorio2"] then + data:extend( + { + { + type = "technology", + name = "slag-processing", + icon = "__IntermediatesForYou2__/graphics/icons/slag.png", + icon_size = 128, + prerequisites = {"advanced-material-processing-2"}, + effects = { + { + type = "unlock-recipe", + recipe = "slag", + }, + { + type = "unlock-recipe", + recipe = "iron-extraction", + } + }, + unit = + { + count = 100, + ingredients = + { + { "automation-science-pack", 1 }, + { "logistic-science-pack", 1 }, + { "chemical-science-pack", 1 } + }, + time = 30 + } + } + }) +end + +if mods["space-exploration"] then + data:extend( + { + { + type = "technology", + name = "elementite-processing", + icon = "__IntermediatesForYou2__/graphics/icons/elementite.png", + icon_size = 128, + prerequisites = {"production-science-pack"}, {"se-space-radiation-laboratory"}, + effects = { + { + type = "unlock-recipe", + recipe = "elementite", + }, + { + type = "unlock-recipe", + recipe = "trace-rare-ore-extraction", + }, + { + type = "unlock-recipe", + recipe = "elementite-dust", + }, + { + type = "unlock-recipe", + recipe = "elementium-plate", + }, + { + type = "unlock-recipe", + recipe = "elementium-heat-shielding", + } + }, + unit = + { + count = 300, + ingredients = + { + { "automation-science-pack", 1 }, + { "logistic-science-pack", 1 }, + { "chemical-science-pack", 1 }, + { "se-rocket-science-pack", 1 }, + { "space-science-pack", 1 }, + { "production-science-pack", 1 }, + { "utility-science-pack", 1 } + }, + time = 30 + } + } + }) +end \ No newline at end of file diff --git a/IntermediatesForYou2/recipe-final-fix.lua b/IntermediatesForYou2/recipe-final-fix.lua new file mode 100644 index 0000000..5e9d76b --- /dev/null +++ b/IntermediatesForYou2/recipe-final-fix.lua @@ -0,0 +1,44 @@ +local util = require("data-util") + +if mods["MDbobelectronics2"] then + util.remove_ingredient("advanced-processing-unit", "processing-electronics") +end + +if (mods["Krastorio2"] and mods["bzgas"]) or false then + if mods["bzgold"] then + util.remove_ingredient("chemical-plant", "silver-plate") + end + if mods["bzaluminum"] then + util.remove_ingredient("kr-filtration-plant", "aluminum-plate") + end + if mods["bztin"] then + util.remove_ingredient("kr-filtration-plant", "solder") + end + util.remove_ingredient("kr-filtration-plant", "pipe") + util.add_ingredient("kr-filtration-plant", "basic-chemical-plant", 1) +end + +if mods["space-exploration"] then + util.add_ingredient("se-delivery-cannon-chest", "shock-absorber", 10) + + util.remove_ingredient("speed-module-2", "electronic-circuit") + util.remove_ingredient("speed-module-2", "electric-motor") + + util.remove_ingredient("speed-module-3", "integrated-circuit") + + util.remove_ingredient("productivity-module-3", "integrated-circuit") + + util.remove_ingredient("effectivity-module-3", "integrated-circuit") + + util.remove_ingredient("productivity-module-2", "electronic-circuit") + + util.remove_ingredient("effectivity-module-2", "electronic-circuit") + if mods["BrassTacks-Updated"] then + util.add_product("se-core-fragment-omni",{ type = "item", name = "zinc-ore", amount = 8 }) + end + + if mods["248k-Redux"] then + util.replace_ingredient("se-canister", "plastic-bar", "fi_materials_GFK", 5) + util.remove_ingredient("se-canister", "glass") + end +end \ No newline at end of file diff --git a/IntermediatesForYou2/recipe-modify.lua b/IntermediatesForYou2/recipe-modify.lua new file mode 100644 index 0000000..a7fa38a --- /dev/null +++ b/IntermediatesForYou2/recipe-modify.lua @@ -0,0 +1,240 @@ +local util = require("data-util") + +-- Main vanilla changes +util.add_ingredient("flamethrower-turret", "turret-base", 1) + +util.add_ingredient("gun-turret", "turret-base", 1) + +util.remove_ingredient("flamethrower-turret", "iron-gear-wheel") + +util.remove_ingredient("satellite", "low-density-structure") +util.add_ingredient("satellite", "satellite-body", 1) + +util.remove_ingredient("artillery-turret", "steel-plate") +util.remove_ingredient("artillery-turret", "concrete") +util.add_ingredient("artillery-turret", "turret-large-base", 1) + +util.add_ingredient("inserter", "spring", 2) +util.remove_ingredient("inserter", "iron-stick") + +util.add_ingredient("fast-inserter", "shock-absorber", 1) +util.add_ingredient("car", "shock-absorber", 4) +util.add_ingredient("artillery-turret", "shock-absorber", 10) + +util.add_ingredient("stack-filter-inserter", "filter-inserter", 1) +util.remove_ingredient("stack-filter-inserter", "stack-inserter") + +-- Mod changes +if mods["bztin"] then + util.remove_ingredient("fast-inserter", "bronze-plate") + util.remove_ingredient("filter-inserter", "bronze-plate") + if data.raw.item["motorized-articulator"] then + util.remove_ingredient("motorized-articulator", "bronze-plate") + util.add_ingredient("motorized-articulator", "spring", 2) + end +end + +if mods["bismuth"] then + util.remove_ingredient("satellite", "bismuth-glass") +end + +if mods["bzcarbon"] then + util.remove_ingredient("satellite", "graphene") +end + +--Turrets +if mods["Krastorio2"] and mods["aai-industry"] then + util.remove_ingredient("gun-turret", "kr-iron-beam") + util.remove_ingredient("gun-turret", "motor") + util.remove_ingredient("gun-turret", "iron-gear-wheel") +else + util.remove_ingredient("gun-turret", "iron-gear-wheel") +end + +if mods["bzlead"] then + util.remove_ingredient("flamethrower-turret", "lead-plate") + + util.remove_ingredient("pipe-to-ground", "lead-plate") + util.remove_ingredient("pipe-to-ground", "tin-plate") + util.add_ingredient("pipe-to-ground", "solder", 1) + + util.remove_ingredient("artillery-turret", "lead-plate") +end + +if mods["Repair_Turret"] then + util.remove_ingredient("repair-turret", "iron-gear-wheel") + util.add_ingredient("repair-turret", "turret-base", 1) +end + +if mods["RampantArsenal"] then + util.remove_ingredient("ridle-item-rampant-arsenal", "iron-plate") + util.add_ingredient("ridle-item-rampant-arsenal", "turret-base", 1) + + util.remove_ingredient("shotgun-item-rampant-arsenal", "iron-gear-wheel") + util.add_ingredient("shotgun-item-rampant-arsenal", "turret-base", 1) + + util.remove_ingredient("cannon-item-rampant-arsenal", "iron-gear-wheel") + util.add_ingredient("cannon-item-rampant-arsenal", "turret-base", 1) + + util.remove_ingredient("rocket-item-rampant-arsenal", "iron-gear-wheel") + util.add_ingredient("rocket-item-rampant-arsenal", "turret-base", 1) + + util.remove_ingredient("rapid-rocket-item-rampant-arsenal", "steel-plate") + util.add_ingredient("rapid-rocket-item-rampant-arsenal", "rocket-item-rampant-arsenal", 1) + + util.remove_ingredient("lightning-item-rampant-arsenal", "iron-gear-wheel") + util.add_ingredient("lightning-item-rampant-arsenal", "turret-base", 1) + + util.remove_ingredient("acid-cannon-rampant-arsenal", "iron-gear-wheel") + util.add_ingredient("acid-cannon-rampant-arsenal", "turret-base", 1) + + util.remove_ingredient("capsule-item-rampant-arsenal", "steel-plate") + util.add_ingredient("capsule-item-rampant-arsenal", "turret-base", 1) + + util.remove_ingredient("lite-artillery-turret-rampant-arsenal", "iron-gear-wheel") + util.add_ingredient("lite-artillery-turret-rampant-arsenal", "turret-base", 1) + + util.remove_ingredient("rapid-cannon-item-rampant-arsenal", "steel-plate") + util.remove_ingredient("rapid-cannon-item-rampant-arsenal", "concrete") + util.add_ingredient("rapid-cannon-item-rampant-arsenal", "turret-large-base", 1) + + util.remove_ingredient("advanced-laser-item-rampant-arsenal", "steel-plate") + util.add_ingredient("advanced-laser-item-rampant-arsenal", "turret-large-base", 1) + + util.remove_ingredient("suppression-cannon-item-rampant-arsenal", "steel-plate") + util.remove_ingredient("suppression-cannon-item-rampant-arsenal", "concrete") + util.add_ingredient("suppression-cannon-item-rampant-arsenal", "turret-large-base", 1) + if mods["bzlead"] then + util.remove_ingredient("rapid-cannon-item-rampant-arsenal", "lead-plate") + util.remove_ingredient("suppression-cannon-item-rampant-arsenal", "lead-plate") + end +end + +if mods["EndgameCombat"] then + util.remove_ingredient("acid-turret", "iron-gear-wheel") + util.add_ingredient("acid-turret", "turret-base", 1) + + util.remove_ingredient("sticky-turret", "iron-gear-wheel") + util.add_ingredient("sticky-turret", "turret-base", 1) +end + +--chemical plant +if mods["bzgas"] then + util.remove_ingredient("chemical-plant", "stone-brick") + util.remove_ingredient("chemical-plant", "pipe") + util.add_ingredient("chemical-plant", "basic-chemical-plant", 1) + + if (mods["bzlead"] and mods["bztin"]) or false then + util.remove_ingredient("basic-chemical-plant", "tin-plate") + util.remove_ingredient("basic-chemical-plant", "lead-plate") + util.add_ingredient("basic-chemical-plant", "solder", 8) + end +end + +if mods["bobassembly"] then + --chemical plant 2 + util.remove_ingredient("chemical-plant-2", "solder") + util.remove_ingredient("chemical-plant-2", "pipe") + --oil refinery 2 + util.replace_ingredient("oil-refinery-2", "stone-brick", "concrete") + util.remove_ingredient("oil-refinery-2", "pipe") + --should be done by BrimStuff-Updated but I will just do it here ¯\_(ツ)_/¯ + if mods["BrimStuff-Updated"] then + util.add_crafting_category("assembling-machine", "chemical-plant-2", "basic-chemistry") + util.add_crafting_category("assembling-machine", "chemical-plant-3", "basic-chemistry") + util.add_crafting_category("assembling-machine", "chemical-plant-4", "basic-chemistry") + end +end + +--electronics +if (mods["MDbobelectronics2"] and mods["Krastorio2"]) or false then + util.replace_ingredient("kr-electronic-components", "plastic-bar", "basic-electronic-components") + util.replace_ingredient("kr-electronic-components", "glass", "BOBMD-electronic-components") + util.remove_ingredient("kr-electronic-components", "silicon-wafer") + + util.remove_ingredient("processing-unit", "cpu") + util.remove_ingredient("processing-unit", "BOBMD-electronic-components") + util.remove_ingredient("processing-unit", "intergrated-electronics") + util.replace_ingredient("processing-unit", "basic-electronic-components", "advanced-electronic-components") + + util.remove_ingredient("advanced-circuit", "basic-electronic-components") + util.remove_ingredient("advanced-circuit", "BOBMD-electronic-components") + + util.replace_ingredient("advanced-processing-unit", "basic-electronic-components", "kr-electronic-components") + util.add_ingredient("advanced-processing-unit", "advanced-electronic-components", 3) + util.remove_ingredient("advanced-processing-unit", "BOBMD-electronic-components") + util.remove_ingredient("advanced-processing-unit", "intergrated-electronics") + + if mods["space-exploration"] then + util.remove_ingredient("se-space-assembling-machine", "advanced-circuit") + end +end + +if mods["Krastorio2"] then + util.add_ingredient("stack-filter-inserter", "inserter-parts", 4) + + if mods["ThemTharHills-Updated"] then + util.remove_ingredient("processing-unit", "integrated-circuit") + util.remove_ingredient("processing-unit", "cpu") + util.remove_ingredient("mainboard", "integrated-circuit") + if not mods["MDbobelectronics2"] then + util.add_ingredient("processing-unit", "advanced-electronic-components", 2) + end + end + --make the greenhouse upgradeable to bio lab + util.remove_ingredient("kr-bio-lab", "glass") + util.remove_ingredient("kr-bio-lab", "kr-iron-beam") + util.add_ingredient("kr-bio-lab", "kr-greenhouse", 1) + + util.remove_ingredient("kr-steel-pipe-to-ground", "lead-plate") + util.remove_ingredient("kr-steel-pipe-to-ground", "tin-plate") + util.add_ingredient("kr-steel-pipe-to-ground", "solder", 1) + --turret + util.add_ingredient("kr-laser-artillery-turret", "turret-large-base", 1) + util.add_ingredient("kr-rocket-turret", "turret-large-base", 1) + util.add_ingredient("kr-railgun-turret", "turret-large-base", 1) + util.remove_ingredient("kr-railgun-turret", "steel-beam") + if mods["bzlead"] then + util.remove_ingredient("kr-laser-artillery-turret", "lead-plate") + util.remove_ingredient("kr-rocket-turret", "lead-plate") + util.remove_ingredient("kr-railgun-turret", "lead-plate") + end +end + +if mods["space-exploration"] then + util.add_ingredient("se-delivery-cannon-chest", "shock-absorber", 10) + + util.add_ingredient("speed-module-2", "electric-engine-unit", 10) + + util.remove_ingredient("speed-module-3", "mlcc") + util.remove_ingredient("speed-module-3", "cooling-fan") + + util.remove_ingredient("productivity-module-3", "mlcc") + util.remove_ingredient("productivity-module-3", "cooling-fan") + + util.remove_ingredient("effectivity-module-3", "mlcc") + util.remove_ingredient("effectivity-module-3", "cooling-fan") + + util.set_ingredient("speed-module-4", "se-iridium-plate", 90) + util.add_ingredient("speed-module-4", "elementium-plate", 30) + + if mods["bztin"] then + util.remove_ingredient("se-space-biochemical-laboratory", "solder") + end + + if mods["Nylon2"] then + util.add_ingredient("productivity-module-2", "nylon-machine-parts", 10) + end + + if mods["248k-Redux"] then + util.replace_ingredient("se-canister", "plastic-bar", "fi_materials_GFK", 5) + util.remove_ingredient("se-canister", "glass") + + util.add_ingredient("effectivity-module-2", "el_lithium_battery", 10) + end +end + +if mods["BrassTacks-Updated"] then + util.set_main_product("zinc-plate", "zinc-plate") + util.add_product("zinc-plate", {name="silver-ore", amount=1, probability=0.06}) +end \ No newline at end of file diff --git a/IntermediatesForYou2/thumbnail.png b/IntermediatesForYou2/thumbnail.png new file mode 100644 index 0000000..396a4b6 Binary files /dev/null and b/IntermediatesForYou2/thumbnail.png differ diff --git a/README.md b/README.md index 71774e6..a4b1a3f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ -# IntermediatesForYou2 +# IntermediatesForYou +Updated for Factorio 2.0. + +Original mod: https://mods.factorio.com/mod/IntermediatesForYou \ No newline at end of file