From a2163f7e0f3c797cdd1a39b7e9f2621c9160ed15 Mon Sep 17 00:00:00 2001 From: Brevven Date: Tue, 3 Dec 2024 02:26:02 -0800 Subject: [PATCH] initial 2.0 vanilla compat --- changelog.txt | 5 + data-util.lua | 103 +++------------- info.json | 4 +- titanium-ore.lua | 180 +++++++++++++-------------- titanium-recipe-modules.lua | 57 ++++----- titanium-recipe.lua | 234 +++++++++++++++++------------------- 6 files changed, 255 insertions(+), 328 deletions(-) diff --git a/changelog.txt b/changelog.txt index 30b4cac..790588f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 2.0.0 +Date: 2024-12-06 + Features: + - Works with Factorio 2.0 vanilla +--------------------------------------------------------------------------------------------------- Version: 1.2.13 Date: 2023-12-23 Fixes: diff --git a/data-util.lua b/data-util.lua index 5329574..87ba006 100644 --- a/data-util.lua +++ b/data-util.lua @@ -305,15 +305,12 @@ function util.se_matter(params) end end +-- deprecated -- 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 + return recipe end end @@ -428,17 +425,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 @@ -448,8 +441,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 @@ -472,8 +463,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 @@ -498,8 +487,6 @@ function util.add_ingredient_raw(recipe_name, ingredient, options) if data.raw.recipe[recipe_name] and data.raw.item[ingredient.name] 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 @@ -520,8 +507,6 @@ function util.set_ingredient(recipe_name, ingredient, quantity, options) if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then 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) end end @@ -546,35 +531,27 @@ function util.add_product(recipe_name, product, options) (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.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 = {{recipe.result, recipe.result_count and recipe.result_count or 1}} end + recipe.result = nil + recipe.result_count = nil + table.insert(recipe.results, product) end end end --- Get the amount of the ingredient, will check base/normal not expensive +-- Get the amount of the ingredient 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.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.name == ingredient_name then return ingredient.amount end end @@ -584,25 +561,17 @@ function util.get_ingredient_amount(recipe_name, ingredient_name) return 0 end --- Get the amount of the result, will check base/normal not expensive +-- Get the amount of the result 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.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.name == product then return result.amount end end - elseif recipe.result_count then - return recipe.result_count end - return 1 + return 0 end return 0 end @@ -612,9 +581,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 @@ -629,8 +596,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 @@ -662,8 +627,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 @@ -689,8 +652,6 @@ 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 @@ -720,8 +681,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 @@ -747,8 +706,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 @@ -784,8 +741,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 @@ -831,9 +786,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) @@ -853,8 +807,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 @@ -877,8 +829,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 @@ -893,8 +843,6 @@ 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) end end @@ -937,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 @@ -956,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 @@ -975,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 @@ -1037,13 +979,6 @@ function util.add_icon(recipe_name, icon, options) 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 @@ -1106,8 +1041,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 @@ -1130,8 +1063,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 diff --git a/info.json b/info.json index ff512b0..1a4087a 100644 --- a/info.json +++ b/info.json @@ -1,7 +1,7 @@ { "name": "bztitanium", - "version": "1.2.13", - "factorio_version": "1.1", + "version": "2.0.0", + "factorio_version": "2.0", "title": "Titanium", "author": "Brevven", "contact": "", diff --git a/titanium-ore.lua b/titanium-ore.lua index 30befeb..604c763 100644 --- a/titanium-ore.lua +++ b/titanium-ore.lua @@ -1,89 +1,91 @@ -local resource_autoplace = require('resource-autoplace'); - -local util = require("__bztitanium__.data-util"); - -if mods["FactorioExtended-Plus-Core"] then - util.remove_raw("item", "titanium-ore") -end - -if (not mods["pyrawores"]) then -data:extend({ - { - type = "autoplace-control", - category = "resource", - name = "titanium-ore", - richness = true, - order = "b-e" - }, - { - type = "noise-layer", - name = "titanium-ore" - }, - { - type = "resource", - icon_size = 64, icon_mipmaps = 3, - name = "titanium-ore", - icon = "__bztitanium__/graphics/icons/titanium-ore.png", - flags = {"placeable-neutral"}, - order="a-b-a", - map_color = {r=0.65, g=0.80, b=0.80}, - minable = - { - hardness = 1, - mining_particle = "titanium-ore-particle", - mining_time = 2, - fluid_amount = util.me.fluid_amount(), - required_fluid=(settings.startup["bztitanium-mining-fluid"] and settings.startup["bztitanium-mining-fluid"].value or "lubricant"), - result = "titanium-ore" - }, - collision_box = {{ -0.1, -0.1}, {0.1, 0.1}}, - selection_box = {{ -0.5, -0.5}, {0.5, 0.5}}, - - autoplace = resource_autoplace.resource_autoplace_settings{ - name = "titanium-ore", - order = "b-z", - base_density = 3, - has_starting_area_placement = false, - regular_rq_factor_multiplier = 0.8 - }, - - stage_counts = {15000, 9500, 5500, 2900, 1300, 400, 150, 80}, - stages = - { - sheet = - { - filename = "__bztitanium__/graphics/entity/ores/titanium-ore.png", - priority = "extra-high", - size = 64, - frame_count = 8, - variation_count = 8, - hr_version = - { - filename = "__bztitanium__/graphics/entity/ores/hr-titanium-ore.png", - priority = "extra-high", - size = 128, - frame_count = 8, - variation_count = 8, - scale = 0.5 - } - } - }, - }, - { - type = "item", - name = "titanium-ore", - icon_size = 64, icon_mipmaps = 3, - icon = "__bztitanium__/graphics/icons/titanium-ore.png", - pictures = { - {filename="__bztitanium__/graphics/icons/titanium-ore.png", size=64, scale=0.25}, - {filename="__bztitanium__/graphics/icons/titanium-ore-2.png", size=64, scale=0.25}, - {filename="__bztitanium__/graphics/icons/titanium-ore-3.png", size=64, scale=0.25}, - {filename="__bztitanium__/graphics/icons/titanium-ore-4.png", size=64, scale=0.25}, - }, - subgroup = "raw-resource", - order = "t-c-a", - stack_size = util.get_stack_size(50) - }, -}) -end - +local resource_autoplace = require('resource-autoplace'); + +local util = require("__bztitanium__.data-util"); + +if mods["FactorioExtended-Plus-Core"] then + util.remove_raw("item", "titanium-ore") +end +data.raw.planet.nauvis.map_gen_settings.autoplace_controls["titanium-ore"] = {} +data.raw.planet.nauvis.map_gen_settings.autoplace_settings.entity.settings["titanium-ore"] = {} + +if (not mods["pyrawores"]) then +data:extend({ + { + type = "autoplace-control", + category = "resource", + name = "titanium-ore", + richness = true, + order = "b-e" + }, + --{ + -- type = "noise-layer", + -- name = "titanium-ore" + --}, + { + type = "resource", + icon_size = 64, icon_mipmaps = 3, + name = "titanium-ore", + icon = "__bztitanium__/graphics/icons/titanium-ore.png", + flags = {"placeable-neutral"}, + order="a-b-a", + map_color = {r=0.65, g=0.80, b=0.80}, + minable = + { + hardness = 1, + mining_particle = "titanium-ore-particle", + mining_time = 2, + fluid_amount = util.me.fluid_amount(), + required_fluid=(settings.startup["bztitanium-mining-fluid"] and settings.startup["bztitanium-mining-fluid"].value or "lubricant"), + result = "titanium-ore" + }, + collision_box = {{ -0.1, -0.1}, {0.1, 0.1}}, + selection_box = {{ -0.5, -0.5}, {0.5, 0.5}}, + + autoplace = resource_autoplace.resource_autoplace_settings{ + name = "titanium-ore", + order = "b-z", + base_density = 3, + has_starting_area_placement = false, + regular_rq_factor_multiplier = 0.8 + }, + + stage_counts = {15000, 9500, 5500, 2900, 1300, 400, 150, 80}, + stages = + { + sheet = + { + filename = "__bztitanium__/graphics/entity/ores/titanium-ore.png", + priority = "extra-high", + size = 64, + frame_count = 8, + variation_count = 8, + hr_version = + { + filename = "__bztitanium__/graphics/entity/ores/hr-titanium-ore.png", + priority = "extra-high", + size = 128, + frame_count = 8, + variation_count = 8, + scale = 0.5 + } + } + }, + }, + { + type = "item", + name = "titanium-ore", + icon_size = 64, icon_mipmaps = 3, + icon = "__bztitanium__/graphics/icons/titanium-ore.png", + pictures = { + {filename="__bztitanium__/graphics/icons/titanium-ore.png", size=64, scale=0.25}, + {filename="__bztitanium__/graphics/icons/titanium-ore-2.png", size=64, scale=0.25}, + {filename="__bztitanium__/graphics/icons/titanium-ore-3.png", size=64, scale=0.25}, + {filename="__bztitanium__/graphics/icons/titanium-ore-4.png", size=64, scale=0.25}, + }, + subgroup = "raw-resource", + order = "t-c-a", + stack_size = util.get_stack_size(50) + }, +}) +end + diff --git a/titanium-recipe-modules.lua b/titanium-recipe-modules.lua index 4cfb793..011bce0 100644 --- a/titanium-recipe-modules.lua +++ b/titanium-recipe-modules.lua @@ -2,31 +2,32 @@ 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 - end -end - - --- FE+ allows modules for Titanium ore, we can't do that. -if mods["FactorioExtended-Plus-Core"] then - for j, module in pairs(data.raw.module) do - if module.limitation and #module.limitation > 0 then - for i=1,#module.limitation,1 do - if module.limitation[i] == "titanium-ore" then - table.remove(module.limitation, i) - break - end - end - end - end -end +-- 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 +-- log(serpent.block(module)) +-- for effect_name, effect in pairs(module.effect) do +-- if effect_name == "productivity" and module.effect.productivity > 0 then +-- table.insert(module.limitation, recipe) +-- end +-- end +-- end +-- end +-- end +-- end +-- +-- +-- -- FE+ allows modules for Titanium ore, we can't do that. +-- if mods["FactorioExtended-Plus-Core"] then +-- for j, module in pairs(data.raw.module) do +-- if module.limitation and #module.limitation > 0 then +-- for i=1,#module.limitation,1 do +-- if module.limitation[i] == "titanium-ore" then +-- table.remove(module.limitation, i) +-- break +-- end +-- end +-- end +-- end +-- end diff --git a/titanium-recipe.lua b/titanium-recipe.lua index 08e0740..0995fad 100644 --- a/titanium-recipe.lua +++ b/titanium-recipe.lua @@ -1,123 +1,111 @@ --- Titanium smelting - -local util = require("__bztitanium__.data-util"); - -if mods["FactorioExtended-Plus-Core"] then - util.remove_raw("recipe", "titanium-ore") - util.remove_raw("item", "titanium-alloy") - util.remove_raw("recipe", "titanium-alloy") - util.remove_raw("technology", "titanium-processing") -end - -if mods["modmashsplinterresources"] then - util.remove_raw("item", "titanium-plate") - util.remove_raw("recipe", "titanium-extraction-process") -end - -if (mods["bobrevamp"] and not mods["bobores"]) then - util.remove_raw("technology", "titanium-processing") -end - -if (not mods["pyrawores"] and not mods["bobplates"]) then -data:extend({ - { - type = "recipe", - name = util.me.titanium_plate, - main_product = util.me.titanium_plate, - category = "smelting", - order = "d[titanium-plate]", - icons = (mods["Krastorio2"] and - { - { icon = "__bztitanium__/graphics/icons/titanium-plate.png", icon_size = 64, icon_mipmaps = 3,}, - { icon = "__bztitanium__/graphics/icons/titanium-ore.png", icon_size = 64, icon_mipmaps = 3, scale=0.25, shift= {-8, -8}}, - } or nil), - normal = (mods["Krastorio2"] and - { - enabled = false, - energy_required = 16, - ingredients = {{"titanium-ore", 10}}, - results = - mods["crafting-efficiency-2"] and {{type="item", name= util.me.titanium_plate, amount=3, probability=5/6}} or - {{type="item", name= util.me.titanium_plate, amount_min=2, amount_max=3}} , - } or - { - enabled = false, - energy_required = 8, - ingredients = {{"titanium-ore", 5}}, - result = util.me.titanium_plate - }), - expensive = - { - enabled = false, - energy_required = 16, - ingredients = {{"titanium-ore", 10}}, - result = util.me.titanium_plate - } - }, - { - type = "item", - name = util.me.titanium_plate, - icon = "__bztitanium__/graphics/icons/titanium-plate.png", - icon_size = 64, icon_mipmaps = 3, - subgroup = "raw-material", - order = "b[titanium-plate]", - stack_size = util.get_stack_size(100) - }, - { - type = "technology", - name = "titanium-processing", - icon_size = 256, icon_mipmaps = 4, - icon = "__bztitanium__/graphics/technology/titanium-processing.png", - effects = - { - { - type = "unlock-recipe", - recipe = util.me.titanium_plate - }, - mods["TheBigFurnace"] and { - type = "unlock-recipe", - recipe = "big-titanium-plate", - } or nil, - }, - unit = - { - count = 75, - ingredients = (mods["Pre0-17-60Oil"] and - { - {"automation-science-pack", 1}, - {"logistic-science-pack", 1} - } or - { - {"automation-science-pack", 1}, - {"logistic-science-pack", 1}, - {"chemical-science-pack", 1} - }), - time = 30 - }, - prerequisites = {"lubricant"}, - order = "b-b" - }, - mods["TheBigFurnace"] and { - type = "recipe", - name = "big-titanium-plate", - category = "big-smelting", - order = "d[titanium-plate]", - normal = - { - enabled = false, - energy_required = 8.75, - ingredients = {{"titanium-ore", 50}}, - result = util.me.titanium_plate, - result_count = 10, - }, - expensive = - { - enabled = false, - energy_required = 16, - ingredients = {{"titanium-ore", 100}}, - result = util.me.titanium_plate, - result_count = 10, - } - } or nil, -}) -end +-- Titanium smelting + +local util = require("__bztitanium__.data-util"); + +if mods["FactorioExtended-Plus-Core"] then + util.remove_raw("recipe", "titanium-ore") + util.remove_raw("item", "titanium-alloy") + util.remove_raw("recipe", "titanium-alloy") + util.remove_raw("technology", "titanium-processing") +end + +if mods["modmashsplinterresources"] then + util.remove_raw("item", "titanium-plate") + util.remove_raw("recipe", "titanium-extraction-process") +end + +if (mods["bobrevamp"] and not mods["bobores"]) then + util.remove_raw("technology", "titanium-processing") +end + +if (not mods["pyrawores"] and not mods["bobplates"]) then +data:extend({ + { + type = "recipe", + name = util.me.titanium_plate, + main_product = util.me.titanium_plate, + category = "smelting", + order = "d[titanium-plate]", + icons = (mods["Krastorio2"] and + { + { icon = "__bztitanium__/graphics/icons/titanium-plate.png", icon_size = 64, icon_mipmaps = 3,}, + { icon = "__bztitanium__/graphics/icons/titanium-ore.png", icon_size = 64, icon_mipmaps = 3, scale=0.25, shift= {-8, -8}}, + } or nil), + enabled = false, + energy_required = mods.Krastorio2 and 16 or 8, + ingredients = {util.item("titanium-ore", mods.Krastorio2 and 10 or 5)}, + results = {mods.Krastorio2 and {type="item", name= util.me.titanium_plate, amount_min=2, amount_max=3} or util.item(util.me.titanium_plate)}, + -- expensive = + -- { + -- energy_required = 16, + -- ingredients = {{"titanium-ore", 10}}, + -- result = util.me.titanium_plate + -- } + }, + { + type = "item", + name = util.me.titanium_plate, + icon = "__bztitanium__/graphics/icons/titanium-plate.png", + icon_size = 64, icon_mipmaps = 3, + subgroup = "raw-material", + order = "b[titanium-plate]", + stack_size = util.get_stack_size(100) + }, + { + type = "technology", + name = "titanium-processing", + icon_size = 256, icon_mipmaps = 4, + icon = "__bztitanium__/graphics/technology/titanium-processing.png", + effects = + { + { + type = "unlock-recipe", + recipe = util.me.titanium_plate + }, + mods["TheBigFurnace"] and { + type = "unlock-recipe", + recipe = "big-titanium-plate", + } or nil, + }, + unit = + { + count = 75, + ingredients = (mods["Pre0-17-60Oil"] and + { + {"automation-science-pack", 1}, + {"logistic-science-pack", 1} + } or + { + {"automation-science-pack", 1}, + {"logistic-science-pack", 1}, + {"chemical-science-pack", 1} + }), + time = 30 + }, + prerequisites = {"lubricant"}, + order = "b-b" + }, +-- mods["TheBigFurnace"] and { +-- type = "recipe", +-- name = "big-titanium-plate", +-- category = "big-smelting", +-- order = "d[titanium-plate]", +-- normal = +-- { +-- enabled = false, +-- energy_required = 8.75, +-- ingredients = {{"titanium-ore", 50}}, +-- result = util.me.titanium_plate, +-- result_count = 10, +-- }, +-- expensive = +-- { +-- enabled = false, +-- energy_required = 16, +-- ingredients = {{"titanium-ore", 100}}, +-- result = util.me.titanium_plate, +-- result_count = 10, +-- } +-- } or nil, +}) +end