initial 2.0 vanilla compat
This commit is contained in:
parent
5520061fc8
commit
a2163f7e0f
6 changed files with 255 additions and 328 deletions
|
|
@ -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:
|
||||||
|
|
|
||||||
|
|
@ -305,17 +305,14 @@ 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.normal
|
|
||||||
elseif recipe.ingredients then
|
|
||||||
return recipe
|
return recipe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
-- Set/override a technology's prerequisites
|
-- Set/override a technology's prerequisites
|
||||||
function util.set_prerequisite(technology_name, prerequisites)
|
function util.set_prerequisite(technology_name, prerequisites)
|
||||||
|
|
@ -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,15 +531,12 @@ 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
|
end
|
||||||
|
|
@ -564,17 +546,12 @@ function add_product(recipe, product)
|
||||||
end
|
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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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": "",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ 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"] = {}
|
||||||
|
data.raw.planet.nauvis.map_gen_settings.autoplace_settings.entity.settings["titanium-ore"] = {}
|
||||||
|
|
||||||
if (not mods["pyrawores"]) then
|
if (not mods["pyrawores"]) then
|
||||||
data:extend({
|
data:extend({
|
||||||
|
|
@ -15,10 +17,10 @@ data:extend({
|
||||||
richness = true,
|
richness = true,
|
||||||
order = "b-e"
|
order = "b-e"
|
||||||
},
|
},
|
||||||
{
|
--{
|
||||||
type = "noise-layer",
|
-- type = "noise-layer",
|
||||||
name = "titanium-ore"
|
-- name = "titanium-ore"
|
||||||
},
|
--},
|
||||||
{
|
{
|
||||||
type = "resource",
|
type = "resource",
|
||||||
icon_size = 64, icon_mipmaps = 3,
|
icon_size = 64, icon_mipmaps = 3,
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -31,28 +31,16 @@ data:extend({
|
||||||
{ 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,
|
enabled = false,
|
||||||
energy_required = 16,
|
energy_required = mods.Krastorio2 and 16 or 8,
|
||||||
ingredients = {{"titanium-ore", 10}},
|
ingredients = {util.item("titanium-ore", mods.Krastorio2 and 10 or 5)},
|
||||||
results =
|
results = {mods.Krastorio2 and {type="item", name= util.me.titanium_plate, amount_min=2, amount_max=3} or util.item(util.me.titanium_plate)},
|
||||||
mods["crafting-efficiency-2"] and {{type="item", name= util.me.titanium_plate, amount=3, probability=5/6}} or
|
-- expensive =
|
||||||
{{type="item", name= util.me.titanium_plate, amount_min=2, amount_max=3}} ,
|
-- {
|
||||||
} or
|
-- energy_required = 16,
|
||||||
{
|
-- ingredients = {{"titanium-ore", 10}},
|
||||||
enabled = false,
|
-- result = util.me.titanium_plate
|
||||||
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",
|
type = "item",
|
||||||
|
|
@ -97,27 +85,27 @@ data:extend({
|
||||||
prerequisites = {"lubricant"},
|
prerequisites = {"lubricant"},
|
||||||
order = "b-b"
|
order = "b-b"
|
||||||
},
|
},
|
||||||
mods["TheBigFurnace"] and {
|
-- mods["TheBigFurnace"] and {
|
||||||
type = "recipe",
|
-- type = "recipe",
|
||||||
name = "big-titanium-plate",
|
-- name = "big-titanium-plate",
|
||||||
category = "big-smelting",
|
-- category = "big-smelting",
|
||||||
order = "d[titanium-plate]",
|
-- order = "d[titanium-plate]",
|
||||||
normal =
|
-- normal =
|
||||||
{
|
-- {
|
||||||
enabled = false,
|
-- enabled = false,
|
||||||
energy_required = 8.75,
|
-- energy_required = 8.75,
|
||||||
ingredients = {{"titanium-ore", 50}},
|
-- ingredients = {{"titanium-ore", 50}},
|
||||||
result = util.me.titanium_plate,
|
-- result = util.me.titanium_plate,
|
||||||
result_count = 10,
|
-- result_count = 10,
|
||||||
},
|
-- },
|
||||||
expensive =
|
-- expensive =
|
||||||
{
|
-- {
|
||||||
enabled = false,
|
-- enabled = false,
|
||||||
energy_required = 16,
|
-- energy_required = 16,
|
||||||
ingredients = {{"titanium-ore", 100}},
|
-- ingredients = {{"titanium-ore", 100}},
|
||||||
result = util.me.titanium_plate,
|
-- result = util.me.titanium_plate,
|
||||||
result_count = 10,
|
-- result_count = 10,
|
||||||
}
|
-- }
|
||||||
} or nil,
|
-- } or nil,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue