initial 2.0 vanilla compat

This commit is contained in:
Brevven 2024-12-03 02:26:02 -08:00
parent 5520061fc8
commit a2163f7e0f
6 changed files with 255 additions and 328 deletions

View file

@ -1,4 +1,9 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 2.0.0
Date: 2024-12-06
Features:
- Works with Factorio 2.0 vanilla
---------------------------------------------------------------------------------------------------
Version: 1.2.13 Version: 1.2.13
Date: 2023-12-23 Date: 2023-12-23
Fixes: Fixes:

View file

@ -305,15 +305,12 @@ function util.se_matter(params)
end end
end end
-- deprecated
-- Get the normal prototype for a recipe -- either .normal or the recipe itself -- Get the normal prototype for a recipe -- either .normal or the recipe itself
function util.get_normal(recipe_name) function util.get_normal(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
recipe = data.raw.recipe[recipe_name] recipe = data.raw.recipe[recipe_name]
if recipe.normal and recipe.normal.ingredients then return recipe
return recipe.normal
elseif recipe.ingredients then
return recipe
end
end end
end end
@ -428,17 +425,13 @@ end
function util.set_enabled(recipe_name, enabled) function util.set_enabled(recipe_name, enabled)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.enabled = enabled end data.raw.recipe[recipe_name].enabled = enabled
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
end end
end end
function util.set_hidden(recipe_name) function util.set_hidden(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.hidden = true end data.raw.recipe[recipe_name].hidden = true
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
end end
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 if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
me.add_modified(recipe_name) 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], 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
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 if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then
me.add_modified(recipe_name) me.add_modified(recipe_name)
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid) 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
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 if data.raw.recipe[recipe_name] and data.raw.item[ingredient.name] then
me.add_modified(recipe_name) me.add_modified(recipe_name)
add_ingredient_raw(data.raw.recipe[recipe_name], ingredient) 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
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 if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
me.add_modified(recipe_name) me.add_modified(recipe_name)
set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity) 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
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] (data.raw.item[product.name] or data.raw.fluid[product.name]
) then ) then
add_product(data.raw.recipe[recipe_name], product) 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
end end
function add_product(recipe, product) function add_product(recipe, product)
if recipe ~= nil then if recipe ~= nil then
if product.name and data.raw[product.type][product.name] then if product.name and data.raw[product.type][product.name] then
if not recipe.normal then if recipe.results == nil then
if recipe.results == nil then recipe.results = {{recipe.result, recipe.result_count and recipe.result_count or 1}}
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
recipe.result = nil
recipe.result_count = nil
table.insert(recipe.results, product)
end end
end 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) function util.get_ingredient_amount(recipe_name, ingredient_name)
local recipe = data.raw.recipe[recipe_name] local recipe = data.raw.recipe[recipe_name]
if recipe then if recipe then
if recipe.normal and recipe.normal.ingredients then if recipe.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
for i, ingredient in pairs(recipe.ingredients) do for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == ingredient_name then return ingredient.amount end if ingredient.name == ingredient_name then return ingredient.amount end
end end
@ -584,25 +561,17 @@ function util.get_ingredient_amount(recipe_name, ingredient_name)
return 0 return 0
end 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) function util.get_amount(recipe_name, product)
if not product then product = recipe_name end if not product then product = recipe_name end
local recipe = data.raw.recipe[recipe_name] local recipe = data.raw.recipe[recipe_name]
if recipe then if recipe then
if recipe.normal and recipe.normal.results then if recipe.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
for i, result in pairs(recipe.results) do for i, result in pairs(recipe.results) do
if result.name == product then return result.amount end if result.name == product then return result.amount end
end end
elseif recipe.result_count then
return recipe.result_count
end end
return 1 return 0
end end
return 0 return 0
end end
@ -612,9 +581,7 @@ function util.get_result_count(recipe_name, product)
if not product then product = recipe_name end if not product then product = recipe_name end
local recipe = data.raw.recipe[recipe_name] local recipe = data.raw.recipe[recipe_name]
if recipe then if recipe then
if recipe.normal and recipe.normal.results then if recipe.results then
return #(recipe.normal.results)
elseif recipe.results then
return #(recipe.results) return #(recipe.results)
end end
return 1 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 if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then
me.add_modified(recipe_name) me.add_modified(recipe_name)
replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply) 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
end end
@ -662,8 +627,6 @@ function util.remove_ingredient(recipe_name, old, options)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
me.add_modified(recipe_name) me.add_modified(recipe_name)
remove_ingredient(data.raw.recipe[recipe_name], old) 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
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 if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
me.add_modified(recipe_name) 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], 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
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 if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
me.add_modified(recipe_name) 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], 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
end end
@ -747,8 +706,6 @@ function util.set_product_amount(recipe_name, product, amount, options)
me.add_modified(recipe_name) me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then 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], 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
end end
@ -784,8 +741,6 @@ function util.multiply_recipe(recipe_name, multiple, options)
me.add_modified(recipe_name) me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
multiply_recipe(data.raw.recipe[recipe_name], multiple) 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
end end
@ -831,9 +786,8 @@ end
-- Returns true if a recipe has an ingredient -- Returns true if a recipe has an ingredient
function util.has_ingredient(recipe_name, ingredient) function util.has_ingredient(recipe_name, ingredient)
return data.raw.recipe[recipe_name] and ( return data.raw.recipe[recipe_name] and
has_ingredient(data.raw.recipe[recipe_name], ingredient) or has_ingredient(data.raw.recipe[recipe_name], ingredient)
has_ingredient(data.raw.recipe[recipe_name].normal, ingredient))
end end
function has_ingredient(recipe, ingredient) function has_ingredient(recipe, ingredient)
@ -853,8 +807,6 @@ function util.remove_product(recipe_name, old, options)
me.add_modified(recipe_name) me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
remove_product(data.raw.recipe[recipe_name], old) 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
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 not should_force(options) and bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
set_main_product(data.raw.recipe[recipe_name], product) 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
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 not should_force(options) and bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
replace_product(data.raw.recipe[recipe_name], old, new, options) 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
end end
@ -937,8 +885,6 @@ function util.set_recipe_time(recipe_name, time, options)
me.add_modified(recipe_name) me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
set_recipe_time(data.raw.recipe[recipe_name], time) 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
end end
@ -956,8 +902,6 @@ function util.multiply_time(recipe_name, factor, options)
me.add_modified(recipe_name) me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
multiply_time(data.raw.recipe[recipe_name], factor) 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
end end
@ -975,8 +919,6 @@ function util.add_time(recipe_name, amount, options)
me.add_modified(recipe_name) me.add_modified(recipe_name)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
add_time(data.raw.recipe[recipe_name], amount) 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
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_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, 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 end
data.raw.recipe[recipe_name].icon = nil data.raw.recipe[recipe_name].icon = nil
data.raw.recipe[recipe_name].icon_size = 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 not should_force(options) and bypass(recipe_name) then return end
if data.raw.recipe[recipe] then if data.raw.recipe[recipe] then
add_to_ingredient(data.raw.recipe[recipe], ingredient, amount) 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
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 not should_force(options) and bypass(recipe_name) then return end
if data.raw.recipe[recipe_name] then 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], 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
end end

View file

@ -1,7 +1,7 @@
{ {
"name": "bztitanium", "name": "bztitanium",
"version": "1.2.13", "version": "2.0.0",
"factorio_version": "1.1", "factorio_version": "2.0",
"title": "Titanium", "title": "Titanium",
"author": "Brevven", "author": "Brevven",
"contact": "", "contact": "",

View file

@ -1,89 +1,91 @@
local resource_autoplace = require('resource-autoplace'); local resource_autoplace = require('resource-autoplace');
local util = require("__bztitanium__.data-util"); local util = require("__bztitanium__.data-util");
if mods["FactorioExtended-Plus-Core"] then if mods["FactorioExtended-Plus-Core"] then
util.remove_raw("item", "titanium-ore") util.remove_raw("item", "titanium-ore")
end end
data.raw.planet.nauvis.map_gen_settings.autoplace_controls["titanium-ore"] = {}
if (not mods["pyrawores"]) then data.raw.planet.nauvis.map_gen_settings.autoplace_settings.entity.settings["titanium-ore"] = {}
data:extend({
{ if (not mods["pyrawores"]) then
type = "autoplace-control", data:extend({
category = "resource", {
name = "titanium-ore", type = "autoplace-control",
richness = true, category = "resource",
order = "b-e" name = "titanium-ore",
}, richness = true,
{ order = "b-e"
type = "noise-layer", },
name = "titanium-ore" --{
}, -- type = "noise-layer",
{ -- name = "titanium-ore"
type = "resource", --},
icon_size = 64, icon_mipmaps = 3, {
name = "titanium-ore", type = "resource",
icon = "__bztitanium__/graphics/icons/titanium-ore.png", icon_size = 64, icon_mipmaps = 3,
flags = {"placeable-neutral"}, name = "titanium-ore",
order="a-b-a", icon = "__bztitanium__/graphics/icons/titanium-ore.png",
map_color = {r=0.65, g=0.80, b=0.80}, flags = {"placeable-neutral"},
minable = order="a-b-a",
{ map_color = {r=0.65, g=0.80, b=0.80},
hardness = 1, minable =
mining_particle = "titanium-ore-particle", {
mining_time = 2, hardness = 1,
fluid_amount = util.me.fluid_amount(), mining_particle = "titanium-ore-particle",
required_fluid=(settings.startup["bztitanium-mining-fluid"] and settings.startup["bztitanium-mining-fluid"].value or "lubricant"), mining_time = 2,
result = "titanium-ore" fluid_amount = util.me.fluid_amount(),
}, required_fluid=(settings.startup["bztitanium-mining-fluid"] and settings.startup["bztitanium-mining-fluid"].value or "lubricant"),
collision_box = {{ -0.1, -0.1}, {0.1, 0.1}}, result = "titanium-ore"
selection_box = {{ -0.5, -0.5}, {0.5, 0.5}}, },
collision_box = {{ -0.1, -0.1}, {0.1, 0.1}},
autoplace = resource_autoplace.resource_autoplace_settings{ selection_box = {{ -0.5, -0.5}, {0.5, 0.5}},
name = "titanium-ore",
order = "b-z", autoplace = resource_autoplace.resource_autoplace_settings{
base_density = 3, name = "titanium-ore",
has_starting_area_placement = false, order = "b-z",
regular_rq_factor_multiplier = 0.8 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 =
{ stage_counts = {15000, 9500, 5500, 2900, 1300, 400, 150, 80},
sheet = stages =
{ {
filename = "__bztitanium__/graphics/entity/ores/titanium-ore.png", sheet =
priority = "extra-high", {
size = 64, filename = "__bztitanium__/graphics/entity/ores/titanium-ore.png",
frame_count = 8, priority = "extra-high",
variation_count = 8, size = 64,
hr_version = frame_count = 8,
{ variation_count = 8,
filename = "__bztitanium__/graphics/entity/ores/hr-titanium-ore.png", hr_version =
priority = "extra-high", {
size = 128, filename = "__bztitanium__/graphics/entity/ores/hr-titanium-ore.png",
frame_count = 8, priority = "extra-high",
variation_count = 8, size = 128,
scale = 0.5 frame_count = 8,
} variation_count = 8,
} scale = 0.5
}, }
}, }
{ },
type = "item", },
name = "titanium-ore", {
icon_size = 64, icon_mipmaps = 3, type = "item",
icon = "__bztitanium__/graphics/icons/titanium-ore.png", name = "titanium-ore",
pictures = { icon_size = 64, icon_mipmaps = 3,
{filename="__bztitanium__/graphics/icons/titanium-ore.png", size=64, scale=0.25}, icon = "__bztitanium__/graphics/icons/titanium-ore.png",
{filename="__bztitanium__/graphics/icons/titanium-ore-2.png", size=64, scale=0.25}, pictures = {
{filename="__bztitanium__/graphics/icons/titanium-ore-3.png", size=64, scale=0.25}, {filename="__bztitanium__/graphics/icons/titanium-ore.png", size=64, scale=0.25},
{filename="__bztitanium__/graphics/icons/titanium-ore-4.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},
subgroup = "raw-resource", {filename="__bztitanium__/graphics/icons/titanium-ore-4.png", size=64, scale=0.25},
order = "t-c-a", },
stack_size = util.get_stack_size(50) subgroup = "raw-resource",
}, order = "t-c-a",
}) stack_size = util.get_stack_size(50)
end },
})
end

View file

@ -2,31 +2,32 @@
local util = require("data-util"); local util = require("data-util");
for i, recipe in pairs(util.me.recipes) do -- for i, recipe in pairs(util.me.recipes) do
if data.raw.recipe[recipe] then -- if data.raw.recipe[recipe] then
for j, module in pairs(data.raw.module) do -- for j, module in pairs(data.raw.module) do
if module.effect then -- if module.effect then
for effect_name, effect in pairs(module.effect) do -- log(serpent.block(module))
if effect_name == "productivity" and effect.bonus > 0 and module.limitation and #module.limitation > 0 then -- for effect_name, effect in pairs(module.effect) do
table.insert(module.limitation, recipe) -- if effect_name == "productivity" and module.effect.productivity > 0 then
end -- table.insert(module.limitation, recipe)
end -- end
end -- end
end -- end
end -- end
end -- end
-- end
--
-- FE+ allows modules for Titanium ore, we can't do that. --
if mods["FactorioExtended-Plus-Core"] then -- -- FE+ allows modules for Titanium ore, we can't do that.
for j, module in pairs(data.raw.module) do -- if mods["FactorioExtended-Plus-Core"] then
if module.limitation and #module.limitation > 0 then -- for j, module in pairs(data.raw.module) do
for i=1,#module.limitation,1 do -- if module.limitation and #module.limitation > 0 then
if module.limitation[i] == "titanium-ore" then -- for i=1,#module.limitation,1 do
table.remove(module.limitation, i) -- if module.limitation[i] == "titanium-ore" then
break -- table.remove(module.limitation, i)
end -- break
end -- end
end -- end
end -- end
end -- end
-- end

View file

@ -1,123 +1,111 @@
-- Titanium smelting -- Titanium smelting
local util = require("__bztitanium__.data-util"); local util = require("__bztitanium__.data-util");
if mods["FactorioExtended-Plus-Core"] then if mods["FactorioExtended-Plus-Core"] then
util.remove_raw("recipe", "titanium-ore") util.remove_raw("recipe", "titanium-ore")
util.remove_raw("item", "titanium-alloy") util.remove_raw("item", "titanium-alloy")
util.remove_raw("recipe", "titanium-alloy") util.remove_raw("recipe", "titanium-alloy")
util.remove_raw("technology", "titanium-processing") util.remove_raw("technology", "titanium-processing")
end end
if mods["modmashsplinterresources"] then if mods["modmashsplinterresources"] then
util.remove_raw("item", "titanium-plate") util.remove_raw("item", "titanium-plate")
util.remove_raw("recipe", "titanium-extraction-process") util.remove_raw("recipe", "titanium-extraction-process")
end end
if (mods["bobrevamp"] and not mods["bobores"]) then if (mods["bobrevamp"] and not mods["bobores"]) then
util.remove_raw("technology", "titanium-processing") util.remove_raw("technology", "titanium-processing")
end end
if (not mods["pyrawores"] and not mods["bobplates"]) then if (not mods["pyrawores"] and not mods["bobplates"]) then
data:extend({ data:extend({
{ {
type = "recipe", type = "recipe",
name = util.me.titanium_plate, name = util.me.titanium_plate,
main_product = util.me.titanium_plate, main_product = util.me.titanium_plate,
category = "smelting", category = "smelting",
order = "d[titanium-plate]", order = "d[titanium-plate]",
icons = (mods["Krastorio2"] and icons = (mods["Krastorio2"] and
{ {
{ icon = "__bztitanium__/graphics/icons/titanium-plate.png", icon_size = 64, icon_mipmaps = 3,}, { 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}}, { icon = "__bztitanium__/graphics/icons/titanium-ore.png", icon_size = 64, icon_mipmaps = 3, scale=0.25, shift= {-8, -8}},
} or nil), } or nil),
normal = (mods["Krastorio2"] and enabled = false,
{ energy_required = mods.Krastorio2 and 16 or 8,
enabled = false, ingredients = {util.item("titanium-ore", mods.Krastorio2 and 10 or 5)},
energy_required = 16, results = {mods.Krastorio2 and {type="item", name= util.me.titanium_plate, amount_min=2, amount_max=3} or util.item(util.me.titanium_plate)},
ingredients = {{"titanium-ore", 10}}, -- expensive =
results = -- {
mods["crafting-efficiency-2"] and {{type="item", name= util.me.titanium_plate, amount=3, probability=5/6}} or -- energy_required = 16,
{{type="item", name= util.me.titanium_plate, amount_min=2, amount_max=3}} , -- ingredients = {{"titanium-ore", 10}},
} or -- result = util.me.titanium_plate
{ -- }
enabled = false, },
energy_required = 8, {
ingredients = {{"titanium-ore", 5}}, type = "item",
result = util.me.titanium_plate name = util.me.titanium_plate,
}), icon = "__bztitanium__/graphics/icons/titanium-plate.png",
expensive = icon_size = 64, icon_mipmaps = 3,
{ subgroup = "raw-material",
enabled = false, order = "b[titanium-plate]",
energy_required = 16, stack_size = util.get_stack_size(100)
ingredients = {{"titanium-ore", 10}}, },
result = util.me.titanium_plate {
} type = "technology",
}, name = "titanium-processing",
{ icon_size = 256, icon_mipmaps = 4,
type = "item", icon = "__bztitanium__/graphics/technology/titanium-processing.png",
name = util.me.titanium_plate, effects =
icon = "__bztitanium__/graphics/icons/titanium-plate.png", {
icon_size = 64, icon_mipmaps = 3, {
subgroup = "raw-material", type = "unlock-recipe",
order = "b[titanium-plate]", recipe = util.me.titanium_plate
stack_size = util.get_stack_size(100) },
}, mods["TheBigFurnace"] and {
{ type = "unlock-recipe",
type = "technology", recipe = "big-titanium-plate",
name = "titanium-processing", } or nil,
icon_size = 256, icon_mipmaps = 4, },
icon = "__bztitanium__/graphics/technology/titanium-processing.png", unit =
effects = {
{ count = 75,
{ ingredients = (mods["Pre0-17-60Oil"] and
type = "unlock-recipe", {
recipe = util.me.titanium_plate {"automation-science-pack", 1},
}, {"logistic-science-pack", 1}
mods["TheBigFurnace"] and { } or
type = "unlock-recipe", {
recipe = "big-titanium-plate", {"automation-science-pack", 1},
} or nil, {"logistic-science-pack", 1},
}, {"chemical-science-pack", 1}
unit = }),
{ time = 30
count = 75, },
ingredients = (mods["Pre0-17-60Oil"] and prerequisites = {"lubricant"},
{ order = "b-b"
{"automation-science-pack", 1}, },
{"logistic-science-pack", 1} -- mods["TheBigFurnace"] and {
} or -- type = "recipe",
{ -- name = "big-titanium-plate",
{"automation-science-pack", 1}, -- category = "big-smelting",
{"logistic-science-pack", 1}, -- order = "d[titanium-plate]",
{"chemical-science-pack", 1} -- normal =
}), -- {
time = 30 -- enabled = false,
}, -- energy_required = 8.75,
prerequisites = {"lubricant"}, -- ingredients = {{"titanium-ore", 50}},
order = "b-b" -- result = util.me.titanium_plate,
}, -- result_count = 10,
mods["TheBigFurnace"] and { -- },
type = "recipe", -- expensive =
name = "big-titanium-plate", -- {
category = "big-smelting", -- enabled = false,
order = "d[titanium-plate]", -- energy_required = 16,
normal = -- ingredients = {{"titanium-ore", 100}},
{ -- result = util.me.titanium_plate,
enabled = false, -- result_count = 10,
energy_required = 8.75, -- }
ingredients = {{"titanium-ore", 50}}, -- } or nil,
result = util.me.titanium_plate, })
result_count = 10, end
},
expensive =
{
enabled = false,
energy_required = 16,
ingredients = {{"titanium-ore", 100}},
result = util.me.titanium_plate,
result_count = 10,
}
} or nil,
})
end