This commit is contained in:
Brevven 2021-07-24 23:55:53 -07:00
parent c0eb0397f0
commit 9d17404848
18 changed files with 334 additions and 163 deletions

View file

@ -1,4 +1,9 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 0.12.4
Date: 2021-07-26
Changes:
- Minor refactor
---------------------------------------------------------------------------------------------------
Version: 0.12.3 Version: 0.12.3
Date: 2021-07-12 Date: 2021-07-12
Features: Features:

View file

@ -1,54 +1,12 @@
local me = require("me")
local util = {} local util = {}
util.name = "bztitanium" util.me = me
util.titanium_plate = "" util.get_setting = util.me.get_setting
util.titanium_processing = ""
if mods["FactorioExtended-Plus-Core"] then function util.fe_plus(sub)
util.titanium_plate = "titanium-alloy" if mods["FactorioExtended-Plus-"..sub] then
else return true
util.titanium_plate = "titanium-plate"
end
if mods["pyrawores"] then
util.titanium_processing = "titanium-mk01"
else
util.titanium_processing = "titanium-processing"
end
function util.steel_to_titanium(name)
util.replace_ingredient(name, "steel-plate", util.titanium_plate)
end
function util.add_titanium_ingredient(amount, name)
util.add_ingredient(name, util.titanium_plate, amount)
end
function util.rare_to_titanium(name)
util.replace_ingredient(name, "rare-metals", util.titanium_plate)
end
function util.add_titanium_prerequisite(name)
util.add_prerequisite(name, util.titanium_processing)
end
function util.get_setting(name)
if settings.startup[name] == nil then
return nil
end
return settings.startup[name].value
end
function util.fluid_amount()
local amt = util.get_setting("bztitanium-mining-fluid-amount")
return amt and amt or 3
end
local bypass = {}
if util.get_setting(util.name.."-recipe-bypass") then
for recipe in string.gmatch(util.get_setting(util.name.."-recipe-bypass"), '[^",%s]+') do
bypass[recipe] = true
end end
end end
@ -117,8 +75,8 @@ end
-- Add a given quantity of ingredient to a given recipe -- Add a given quantity of ingredient to a given recipe
function util.add_ingredient(recipe_name, ingredient, quantity) function util.add_ingredient(recipe_name, ingredient, quantity)
if bypass[recipe_name] then return end if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity) add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity) add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity) add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
@ -140,7 +98,7 @@ end
-- Add a given quantity of product to a given recipe. -- Add a given quantity of product to a given recipe.
-- Only works for recipes with multiple products -- Only works for recipes with multiple products
function util.add_product(recipe_name, product) function util.add_product(recipe_name, product)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] and data.raw.item[product] 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].normal, product)
add_product(data.raw.recipe[recipe_name].expensive, product) add_product(data.raw.recipe[recipe_name].expensive, product)
@ -155,8 +113,8 @@ end
-- Replace one ingredient with another in a recipe -- Replace one ingredient with another in a recipe
function util.replace_ingredient(recipe_name, old, new) function util.replace_ingredient(recipe_name, old, new)
if bypass[recipe_name] then return end if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] and data.raw.item[new] then
replace_ingredient(data.raw.recipe[recipe_name], old, new) replace_ingredient(data.raw.recipe[recipe_name], old, new)
replace_ingredient(data.raw.recipe[recipe_name].normal, old, new) replace_ingredient(data.raw.recipe[recipe_name].normal, old, new)
replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new) replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new)
@ -180,7 +138,7 @@ end
-- Remove an ingredient from a recipe -- Remove an ingredient from a recipe
function util.remove_ingredient(recipe_name, old) function util.remove_ingredient(recipe_name, old)
if bypass[recipe_name] then return end if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
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].normal, old)
@ -203,11 +161,10 @@ function remove_ingredient(recipe, old)
end end
end end
-- Replace an amount of an ingredient in a recipe. Keep at least 1 of old. -- 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) function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amount)
if bypass[recipe_name] then return end if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] and data.raw.item[new] then
replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount) replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount)
replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount) replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount)
replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount) replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount)
@ -223,11 +180,9 @@ function replace_some_ingredient(recipe, old, old_amount, new, new_amount)
end end
end end
for i, ingredient in pairs(recipe.ingredients) do for i, ingredient in pairs(recipe.ingredients) do
-- For final fixes
if ingredient.name == old then if ingredient.name == old then
ingredient.amount = math.max(1, ingredient.amount - old_amount) ingredient.amount = math.max(1, ingredient.amount - old_amount)
end end
-- For updates
if ingredient[1] == old then if ingredient[1] == old then
ingredient[2] = math.max(1, ingredient[2] - old_amount) ingredient[2] = math.max(1, ingredient[2] - old_amount)
end end
@ -238,7 +193,7 @@ end
-- multiply the cost, energy, and results of a recipe by a multiple -- multiply the cost, energy, and results of a recipe by a multiple
function util.multiply_recipe(recipe_name, multiple) function util.multiply_recipe(recipe_name, multiple)
if bypass[recipe_name] then return end if me.bypass[recipe_name] then return end
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].normal, multiple)
@ -290,14 +245,108 @@ function multiply_recipe(recipe, multiple)
end end
end end
-- Remove an element of type t and name from data.raw -- Returns true if a recipe has an ingredient
function util.remove_raw(t, name) function util.has_ingredient(recipe_name, ingredient)
for i, elem in pairs(data.raw[t]) do return data.raw.recipe[recipe_name] and (
if elem.name == name then has_ingredient(data.raw.recipe[recipe_name], ingredient) or
data.raw[t][i] = nil has_ingredient(data.raw.recipe[recipe_name].normal, ingredient))
break 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
-- 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)
replace_product(data.raw.recipe[recipe_name].normal, old, new)
replace_product(data.raw.recipe[recipe_name].expensive, old, new)
end
end
function replace_product(recipe, old, new)
if recipe ~= nil and recipe.results ~= nil then
if recipe.result == old then
recipe.results = new
return
end
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
end end
-- Remove an element of type t and name from data.raw
function util.remove_raw(t, name)
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
-- Multiply energy required
function util.multiply_time(recipe, factor)
if me.bypass[recipe_name] then return end
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
function multiply_time(recipe, factor)
if recipe then
if recipe.energy_required then
recipe.energy_required = recipe.energy_required * factor
end
end
end
-- Set recipe category
function util.set_category(recipe, category)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe] then
data.raw.recipe[recipe].category = category
end
end
-- Set recipe subgroup
function util.set_subgroup(recipe, subgroup)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe] then
data.raw.recipe[recipe].subgroup = subgroup
end
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] then
for i, existing in pairs(data.raw[entity_type][entity].crafting_categories) do
if existing == category then
log(entity.." not adding "..new.." -- duplicate")
return
end
end
table.insert(data.raw[entity_type][entity].crafting_categories, category)
end
end
return util return util

View file

@ -1,6 +1,6 @@
{ {
"name": "bztitanium", "name": "bztitanium",
"version": "0.12.3", "version": "0.12.4",
"factorio_version": "1.1", "factorio_version": "1.1",
"title": "Titanium", "title": "Titanium",
"author": "Brevven", "author": "Brevven",

117
me.lua Normal file
View file

@ -0,0 +1,117 @@
local me = {}
me.name = "bztitanium"
me.titanium_plate = ""
me.titanium_processing = ""
if mods["FactorioExtended-Plus-Core"] then
me.titanium_plate = "titanium-alloy"
else
me.titanium_plate = "titanium-plate"
end
if mods["pyrawores"] then
me.titanium_processing = "titanium-mk01"
else
me.titanium_processing = "titanium-processing"
end
function me.steel_to_titanium(name)
replace_ingredient(name, "steel-plate", me.titanium_plate)
end
function me.add_titanium_ingredient(amount, name)
add_ingredient(name, me.titanium_plate, amount)
end
function me.rare_to_titanium(name)
replace_ingredient(name, "rare-metals", me.titanium_plate)
end
function me.add_titanium_prerequisite(name)
add_prerequisite(name, me.titanium_processing)
end
function me.get_setting(name)
if settings.startup[name] == nil then
return nil
end
return settings.startup[name].value
end
function me.fluid_amount()
local amt = me.get_setting("bztitanium-mining-fluid-amount")
return amt and amt or 3
end
me.bypass = {}
if me.get_setting(me.name.."-recipe-bypass") then
for recipe in string.gmatch(me.get_setting(me.name.."-recipe-bypass"), '[^",%s]+') do
me.bypass[recipe] = true
end
end
--
-- TODO These helpers are all duplicates, remove them
--
function replace_ingredient(recipe_name, old, new)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] and data.raw.item[new] then
xreplace_ingredient(data.raw.recipe[recipe_name], old, new)
xreplace_ingredient(data.raw.recipe[recipe_name].normal, old, new)
xreplace_ingredient(data.raw.recipe[recipe_name].expensive, old, new)
end
end
function xreplace_ingredient(recipe, old, new)
if recipe ~= nil and recipe.ingredients ~= nil then
for i, existing in pairs(recipe.ingredients) do
if existing[1] == new or existing.name == new then
log("Not adding "..new.." -- duplicate")
return
end
end
for i, ingredient in pairs(recipe.ingredients) do
if ingredient.name == old then ingredient.name = new end
if ingredient[1] == old then ingredient[1] = new end
end
end
end
function add_prerequisite(technology_name, prerequisite)
technology = data.raw.technology[technology_name]
if technology and data.raw.technology[prerequisite] then
if technology.prerequisites then
table.insert(technology.prerequisites, prerequisite)
else
technology.prerequisites = {prerequisite}
end
end
end
function add_ingredient(recipe_name, ingredient, quantity)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
xadd_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
xadd_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
xadd_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
end
end
function xadd_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
log("Not adding "..ingredient.." -- duplicate")
return
end
end
table.insert(recipe.ingredients, {ingredient, quantity})
end
end
--
-- End duplicates
--
return me

View file

@ -9,12 +9,12 @@ if settings.startup["bztitanium-mining-fluid"] then
end end
if mining_fluid == "chlorine" and data.raw.fluid["chlorine"] and mods["Krastorio2"] then if mining_fluid == "chlorine" and data.raw.fluid["chlorine"] and mods["Krastorio2"] then
data.raw.technology[util.titanium_processing].prerequisites = {"kr-fluids-chemistry"} data.raw.technology[util.me.titanium_processing].prerequisites = {"kr-fluids-chemistry"}
data.raw.technology[util.titanium_processing].unit.ingredients = { data.raw.technology[util.me.titanium_processing].unit.ingredients = {
{"basic-tech-card", 1}, {"automation-science-pack", 1}, {"logistic-science-pack", 1}} {"basic-tech-card", 1}, {"automation-science-pack", 1}, {"logistic-science-pack", 1}}
elseif mining_fluid == "sulfuric-acid" then elseif mining_fluid == "sulfuric-acid" then
data.raw.technology[util.titanium_processing].prerequisites = {"sulfur-processing"} data.raw.technology[util.me.titanium_processing].prerequisites = {"sulfur-processing"}
data.raw.technology[util.titanium_processing].unit.ingredients = { data.raw.technology[util.me.titanium_processing].unit.ingredients = {
{"automation-science-pack", 1}, {"logistic-science-pack", 1}} {"automation-science-pack", 1}, {"logistic-science-pack", 1}}
else else
if data.raw.technology["titanium-processing"] then if data.raw.technology["titanium-processing"] then

View file

@ -105,7 +105,7 @@ data:extend(
recipe = "dirty-water-filtration-titanium", recipe = "dirty-water-filtration-titanium",
} }
}, },
prerequisites = {"kr-enriched-ores", util.titanium_processing}, prerequisites = {"kr-enriched-ores", util.me.titanium_processing},
unit = unit =
{ {
count = 150, count = 150,

View file

@ -32,7 +32,7 @@ data:extend({
hardness = 1, hardness = 1,
mining_particle = "titanium-ore-particle", mining_particle = "titanium-ore-particle",
mining_time = 2, mining_time = 2,
fluid_amount = util.fluid_amount(), fluid_amount = util.me.fluid_amount(),
required_fluid=(settings.startup["bztitanium-mining-fluid"] and settings.startup["bztitanium-mining-fluid"].value or "lubricant"), required_fluid=(settings.startup["bztitanium-mining-fluid"] and settings.startup["bztitanium-mining-fluid"].value or "lubricant"),
result = "titanium-ore" result = "titanium-ore"
}, },

View file

@ -19,11 +19,11 @@ if mods["5dim_core"] then
enabled = false, enabled = false,
energy_required = 140, energy_required = 140,
ingredients = {{"titanium-ore", 425}}, ingredients = {{"titanium-ore", 425}},
result = util.titanium_plate, result = util.me.titanium_plate,
result_count = 100, result_count = 100,
} }
}) })
table.insert(data.raw.technology[util.titanium_processing].effects, table.insert(data.raw.technology[util.me.titanium_processing].effects,
{type = "unlock-recipe", recipe="titanium-plate-industrial-ore"}) {type = "unlock-recipe", recipe="titanium-plate-industrial-ore"})
@ -52,7 +52,7 @@ if mods["5dim_core"] then
ingredients = { ingredients = {
{"titanium-dust", 5} {"titanium-dust", 5}
}, },
result = util.titanium_plate result = util.me.titanium_plate
}, },
{ {
type = "recipe", type = "recipe",
@ -78,21 +78,21 @@ if mods["5dim_core"] then
enabled = false, enabled = false,
energy_required = 140, energy_required = 140,
ingredients = {{"titanium-dust", 425}}, ingredients = {{"titanium-dust", 425}},
result = util.titanium_plate, result = util.me.titanium_plate,
result_count = 100, result_count = 100,
} }
}) })
table.insert(data.raw.technology[util.titanium_processing].effects, table.insert(data.raw.technology[util.me.titanium_processing].effects,
{type = "unlock-recipe", recipe="titanium-dust"}) {type = "unlock-recipe", recipe="titanium-dust"})
table.insert(data.raw.technology[util.titanium_processing].effects, table.insert(data.raw.technology[util.me.titanium_processing].effects,
{type = "unlock-recipe", recipe="titanium-plate-dust"}) {type = "unlock-recipe", recipe="titanium-plate-dust"})
table.insert(data.raw.technology[util.titanium_processing].effects, table.insert(data.raw.technology[util.me.titanium_processing].effects,
{type = "unlock-recipe", recipe="titanium-plate-industrial-dust"}) {type = "unlock-recipe", recipe="titanium-plate-industrial-dust"})
if mods["5dim_automation"] then if mods["5dim_automation"] then
for i, name in ipairs( for i, name in ipairs(
{"5d-assembling-machine-07","5d-assembling-machine-08","5d-lab-06","5d-lab-07"}) do {"5d-assembling-machine-07","5d-assembling-machine-08","5d-lab-06","5d-lab-07"}) do
util.steel_to_titanium(name) util.me.steel_to_titanium(name)
end end
end end
@ -115,7 +115,7 @@ if mods["5dim_core"] then
end end
if mods["5dim_battlefield"] then if mods["5dim_battlefield"] then
util.steel_to_titanium(name) util.me.steel_to_titanium(name)
end end
end end

View file

@ -7,19 +7,19 @@ if mods["Krastorio2"] then
util.replace_ingredient("advanced-tech-card", "electric-engine-unit", "flying-robot-frame") util.replace_ingredient("advanced-tech-card", "electric-engine-unit", "flying-robot-frame")
-- Flavor changes -- Flavor changes
util.rare_to_titanium("kr-electric-mining-drill-mk2") util.me.rare_to_titanium("kr-electric-mining-drill-mk2")
util.rare_to_titanium("kr-advanced-transport-belt") util.me.rare_to_titanium("kr-advanced-transport-belt")
util.rare_to_titanium("kr-advanced-loader") util.me.rare_to_titanium("kr-advanced-loader")
if mods["deadlock-beltboxes-loaders"] then if mods["deadlock-beltboxes-loaders"] then
util.rare_to_titanium("kr-advanced-transport-belt-beltbox") util.me.rare_to_titanium("kr-advanced-transport-belt-beltbox")
util.rare_to_titanium("kr-advanced-transport-belt-loader") util.me.rare_to_titanium("kr-advanced-transport-belt-loader")
end end
util.steel_to_titanium("kr-quarry-drill") util.me.steel_to_titanium("kr-quarry-drill")
util.steel_to_titanium("kr-singularity-lab") util.me.steel_to_titanium("kr-singularity-lab")
util.steel_to_titanium("stack-inserter") util.me.steel_to_titanium("stack-inserter")
util.steel_to_titanium("stack-filter-inserter") util.me.steel_to_titanium("stack-filter-inserter")
util.add_titanium_ingredient(40, "kr-advanced-steam-turbine") util.me.add_titanium_ingredient(40, "kr-advanced-steam-turbine")
end end

View file

@ -42,10 +42,10 @@ if mods["modmashsplinter"] then
end end
if mods["modmashsplinterlogistics"] then if mods["modmashsplinterlogistics"] then
util.steel_to_titanium("regenerative-transport-belt") util.me.steel_to_titanium("regenerative-transport-belt")
util.steel_to_titanium("regenerative-splitter") util.me.steel_to_titanium("regenerative-splitter")
util.steel_to_titanium("regenerative-underground-belt-structure") util.me.steel_to_titanium("regenerative-underground-belt-structure")
util.steel_to_titanium("regenerative-mini-loader") util.me.steel_to_titanium("regenerative-mini-loader")
end end
end end

View file

@ -3,22 +3,22 @@ local util = require("__bztitanium__.data-util");
if data.raw.recipe["se-space-pipe"] then if data.raw.recipe["se-space-pipe"] then
-- Space Exploration space stuff -- Space Exploration space stuff
util.steel_to_titanium("se-space-pipe") util.me.steel_to_titanium("se-space-pipe")
util.steel_to_titanium("se-space-transport-belt") util.me.steel_to_titanium("se-space-transport-belt")
util.steel_to_titanium("se-space-underground-belt") util.me.steel_to_titanium("se-space-underground-belt")
util.steel_to_titanium("se-space-splitter") util.me.steel_to_titanium("se-space-splitter")
util.steel_to_titanium("se-space-rail") util.me.steel_to_titanium("se-space-rail")
util.add_titanium_ingredient(1, "se-space-platform-scaffold") util.me.add_titanium_ingredient(1, "se-space-platform-scaffold")
-- Space Exploration alternative LDS -- Space Exploration alternative LDS
util.steel_to_titanium("se-low-density-structure-beryllium") util.me.steel_to_titanium("se-low-density-structure-beryllium")
-- Space Exploration buildings -- Space Exploration buildings
util.add_titanium_ingredient(20, "se-condenser-turbine") util.me.add_titanium_ingredient(20, "se-condenser-turbine")
-- A couple more deeper tech thematic items to use titanium in. -- A couple more deeper tech thematic items to use titanium in.
util.add_titanium_ingredient(2, "se-lattice-pressure-vessel") util.me.add_titanium_ingredient(2, "se-lattice-pressure-vessel")
util.add_titanium_ingredient(2, "se-aeroframe-bulkhead") util.me.add_titanium_ingredient(2, "se-aeroframe-bulkhead")
-- Organization -- Organization
data.raw.item["titanium-plate"].subgroup = "plates" data.raw.item["titanium-plate"].subgroup = "plates"
@ -26,10 +26,10 @@ if data.raw.recipe["se-space-pipe"] then
-- deadlock loaders for SE -- mods["deadlock-beltboxes-loaders"] -- deadlock loaders for SE -- mods["deadlock-beltboxes-loaders"]
if mods["Deadlock-SE-bridge"] then if mods["Deadlock-SE-bridge"] then
if data.raw.recipe["se-space-transport-belt-loader"] then if data.raw.recipe["se-space-transport-belt-loader"] then
util.steel_to_titanium("se-space-transport-belt-loader") util.me.steel_to_titanium("se-space-transport-belt-loader")
end end
if data.raw.recipe["se-space-transport-belt-beltbox"] then if data.raw.recipe["se-space-transport-belt-beltbox"] then
util.steel_to_titanium("se-space-transport-belt-beltbox") util.me.steel_to_titanium("se-space-transport-belt-beltbox")
end end
end end
end end

View file

@ -4,7 +4,7 @@ local util = require("__bztitanium__.data-util");
if deadlock then if deadlock then
deadlock.add_stack("titanium-ore", "__bztitanium__/graphics/icons/stacked/titanium-ore-stacked.png", "deadlock-stacking-2", 64) deadlock.add_stack("titanium-ore", "__bztitanium__/graphics/icons/stacked/titanium-ore-stacked.png", "deadlock-stacking-2", 64)
deadlock.add_stack(util.titanium_plate, "__bztitanium__/graphics/icons/stacked/titanium-plate-stacked.png" , "deadlock-stacking-2", 64) deadlock.add_stack(util.me.titanium_plate, "__bztitanium__/graphics/icons/stacked/titanium-plate-stacked.png" , "deadlock-stacking-2", 64)
if mods["Krastorio2"] then if mods["Krastorio2"] then
deadlock.add_stack("enriched-titanium", "__bztitanium__/graphics/icons/stacked/enriched-titanium-stacked.png" , "deadlock-stacking-2", 64) deadlock.add_stack("enriched-titanium", "__bztitanium__/graphics/icons/stacked/enriched-titanium-stacked.png" , "deadlock-stacking-2", 64)
end end
@ -13,7 +13,7 @@ end
-- Deadlock crating recipes -- Deadlock crating recipes
if deadlock_crating then if deadlock_crating then
deadlock_crating.add_crate("titanium-ore", "deadlock-crating-2") deadlock_crating.add_crate("titanium-ore", "deadlock-crating-2")
deadlock_crating.add_crate(util.titanium_plate, "deadlock-crating-2") deadlock_crating.add_crate(util.me.titanium_plate, "deadlock-crating-2")
if mods["Krastorio2"] then if mods["Krastorio2"] then
deadlock_crating.add_crate("enriched-titanium", "deadlock-crating-2") deadlock_crating.add_crate("enriched-titanium", "deadlock-crating-2")
end end

View file

@ -2,43 +2,43 @@ local util = require("__bztitanium__.data-util");
-- Various vehicle/transport mod changes -- Various vehicle/transport mod changes
if mods["Aircraft"] then if mods["Aircraft"] then
util.steel_to_titanium("gunship") util.me.steel_to_titanium("gunship")
util.steel_to_titanium("cargo-plane") util.me.steel_to_titanium("cargo-plane")
util.steel_to_titanium("flying-fortress") util.me.steel_to_titanium("flying-fortress")
util.add_titanium_ingredient(10, "aircraft-afterburner") util.me.add_titanium_ingredient(10, "aircraft-afterburner")
-- jet doesn't use steel in base aircraft mod, but leave this here just in case that changes -- jet doesn't use steel in base aircraft mod, but leave this here just in case that changes
util.steel_to_titanium("jet") util.me.steel_to_titanium("jet")
end end
if mods["betterCargoPlanes"] then if mods["betterCargoPlanes"] then
util.steel_to_titanium("better-cargo-plane") util.me.steel_to_titanium("better-cargo-plane")
end end
if mods["HelicopterRevival"] or mods["Helicopters"] then if mods["HelicopterRevival"] or mods["Helicopters"] then
util.steel_to_titanium("heli-recipe") util.me.steel_to_titanium("heli-recipe")
end end
if mods["adamo-chopper"] then if mods["adamo-chopper"] then
util.steel_to_titanium("chopper-recipe") util.me.steel_to_titanium("chopper-recipe")
end end
if mods["jetpack"] then if mods["jetpack"] then
util.steel_to_titanium("jetpack-1") util.me.steel_to_titanium("jetpack-1")
end end
if mods["Hovercrafts"] or mods["Hovercrafts_Realism"] then if mods["Hovercrafts"] or mods["Hovercrafts_Realism"] then
util.steel_to_titanium("hcraft-recipe") util.me.steel_to_titanium("hcraft-recipe")
util.add_titanium_prerequisite("hcraft-tech") util.me.add_titanium_prerequisite("hcraft-tech")
end end
if mods["Raven"] then if mods["Raven"] then
util.add_titanium_ingredient(100, "raven") util.me.add_titanium_ingredient(100, "raven")
end end
if mods["Hover-Car"] then if mods["Hover-Car"] then
util.steel_to_titanium("hover-car-recipe") util.me.steel_to_titanium("hover-car-recipe")
util.steel_to_titanium("hover-car-mk2-recipe") util.me.steel_to_titanium("hover-car-mk2-recipe")
end end
if mods["fast_trans"] then if mods["fast_trans"] then
@ -48,9 +48,9 @@ if mods["fast_trans"] then
"fast-one-mk2 txt", "fast-one-mk2 txt",
"fast-one-mk3 txt", "fast-one-mk3 txt",
}) do }) do
util.steel_to_titanium(item) util.me.steel_to_titanium(item)
end end
util.add_titanium_prerequisite("fast-one-tech-mk2") util.me.add_titanium_prerequisite("fast-one-tech-mk2")
end end
-- Just a general compatiblity improvement with py alien life enabled alongside jetpack or other equipment mods -- Just a general compatiblity improvement with py alien life enabled alongside jetpack or other equipment mods

View file

@ -3,31 +3,31 @@
local util = require("__bztitanium__.data-util"); local util = require("__bztitanium__.data-util");
util.steel_to_titanium("low-density-structure") util.me.steel_to_titanium("low-density-structure")
if mods["modmashsplintergold"] then if mods["modmashsplintergold"] then
util.steel_to_titanium("low-density-structure-with-gold") util.me.steel_to_titanium("low-density-structure-with-gold")
end end
if not mods["bobrevamp"] then if not mods["bobrevamp"] then
util.add_titanium_prerequisite("low-density-structure") util.me.add_titanium_prerequisite("low-density-structure")
end end
if (not mods["bobplates"]) then if (not mods["bobplates"]) then
util.steel_to_titanium("flying-robot-frame") util.me.steel_to_titanium("flying-robot-frame")
util.add_titanium_prerequisite("robotics") util.me.add_titanium_prerequisite("robotics")
end end
if (mods["bobrevamp"] and not mods["bobplates"] and not mods["angelssmelting"]) then if (mods["bobrevamp"] and not mods["bobplates"] and not mods["angelssmelting"]) then
util.steel_to_titanium("flying-robot-frame-2") util.me.steel_to_titanium("flying-robot-frame-2")
util.steel_to_titanium("flying-robot-frame-3") util.me.steel_to_titanium("flying-robot-frame-3")
util.steel_to_titanium("flying-robot-frame-4") util.me.steel_to_titanium("flying-robot-frame-4")
end end
-- Memory storage changes -- Memory storage changes
if data.raw.item["memory-unit"] then if data.raw.item["memory-unit"] then
util.steel_to_titanium("memory-unit") util.me.steel_to_titanium("memory-unit")
end end
-- Underwater pipes changes -- Underwater pipes changes
@ -43,8 +43,8 @@ if data.raw.item["underwater-pipe"] then
table.remove(data.raw.technology["underwater-pipes"].prerequisites, index) table.remove(data.raw.technology["underwater-pipes"].prerequisites, index)
end end
end end
util.add_titanium_prerequisite("underwater-pipes") util.me.add_titanium_prerequisite("underwater-pipes")
util.steel_to_titanium("underwater-pipe") util.me.steel_to_titanium("underwater-pipe")
end end

View file

@ -2,7 +2,7 @@
local util = require("__bztitanium__.data-util"); local util = require("__bztitanium__.data-util");
local recipes = {util.titanium_plate} local recipes = {util.me.titanium_plate}
if mods["Krastorio2"] then if mods["Krastorio2"] then
table.insert(recipes, "enriched-titanium-plate") table.insert(recipes, "enriched-titanium-plate")

View file

@ -3,7 +3,7 @@ local util = require("__bztitanium__.data-util");
if mods["space-exploration"] then if mods["space-exploration"] then
se_delivery_cannon_recipes["titanium-ore"] = {name= "titanium-ore"} se_delivery_cannon_recipes["titanium-ore"] = {name= "titanium-ore"}
se_delivery_cannon_recipes[util.titanium_plate] = {name= util.titanium_plate} se_delivery_cannon_recipes[util.me.titanium_plate] = {name= util.me.titanium_plate}
if mods["Krastorio2"] then if mods["Krastorio2"] then
data:extend({ data:extend({
{ {
@ -20,7 +20,7 @@ if mods["space-exploration"] then
{name = "se-vulcanite-block", amount = 1}, {name = "se-vulcanite-block", amount = 1},
}, },
results = { results = {
{name = util.titanium_plate, amount = 6}, {name = util.me.titanium_plate, amount = 6},
}, },
icons = icons =
{ {
@ -50,7 +50,7 @@ if mods["space-exploration"] then
{name = "se-vulcanite-block", amount = 1}, {name = "se-vulcanite-block", amount = 1},
}, },
results = { results = {
{name = util.titanium_plate, amount = 6}, {name = util.me.titanium_plate, amount = 6},
}, },
icons = icons =
{ {
@ -61,6 +61,6 @@ if mods["space-exploration"] then
}) })
table.insert(data.raw.technology["se-processing-vulcanite"].effects, table.insert(data.raw.technology["se-processing-vulcanite"].effects,
{type = "unlock-recipe", recipe= "titanium-smelting-vulcanite"}) {type = "unlock-recipe", recipe= "titanium-smelting-vulcanite"})
util.add_titanium_prerequisite(data.raw.technology["se-processing-vulcanite"]) util.me.add_titanium_prerequisite(data.raw.technology["se-processing-vulcanite"])
end end
end end

View file

@ -3,50 +3,50 @@
local util = require("__bztitanium__.data-util"); local util = require("__bztitanium__.data-util");
if (not mods["bobplates"]) then if (not mods["bobplates"]) then
util.steel_to_titanium("power-armor") util.me.steel_to_titanium("power-armor")
util.add_prerequisite("power-armor", util.titanium_processing) util.add_prerequisite("power-armor", util.me.titanium_processing)
-- Generally, steel-based equipment techs require solar panel tech, so only require -- Generally, steel-based equipment techs require solar panel tech, so only require
-- titanium processing for that. -- titanium processing for that.
util.add_prerequisite("solar-panel-equipment", util.titanium_processing) util.add_prerequisite("solar-panel-equipment", util.me.titanium_processing)
-- All equipment that uses steel now uses titanium. Who wants to carry around steel! -- All equipment that uses steel now uses titanium. Who wants to carry around steel!
for name, recipe in pairs(data.raw.recipe) do for name, recipe in pairs(data.raw.recipe) do
if recipe.result ~= nil and recipe.result:find("equipment") then if recipe.result ~= nil and recipe.result:find("equipment") then
util.steel_to_titanium(recipe.name) util.me.steel_to_titanium(recipe.name)
end end
end end
end end
-- Also add titanium to some nuclear steam-handling stuff -- Also add titanium to some nuclear steam-handling stuff
util.add_titanium_ingredient(20, "steam-turbine") util.me.add_titanium_ingredient(20, "steam-turbine")
if not mods["pyrawores"] then if not mods["pyrawores"] then
util.add_titanium_ingredient(20, "heat-exchanger") util.me.add_titanium_ingredient(20, "heat-exchanger")
util.add_prerequisite("nuclear-power", util.titanium_processing) util.add_prerequisite("nuclear-power", util.me.titanium_processing)
end end
-- Krastorio 2 changes -- Krastorio 2 changes
if mods["Krastorio2"] then if mods["Krastorio2"] then
util.add_prerequisite("kr-electric-mining-drill-mk2", util.titanium_processing) util.add_prerequisite("kr-electric-mining-drill-mk2", util.me.titanium_processing)
util.add_prerequisite("kr-quarry-minerals-extraction", util.titanium_processing) util.add_prerequisite("kr-quarry-minerals-extraction", util.me.titanium_processing)
end end
if mods["Aircraft"] then if mods["Aircraft"] then
util.add_prerequisite("advanced-aerodynamics", util.titanium_processing) util.add_prerequisite("advanced-aerodynamics", util.me.titanium_processing)
end end
if mods["eve-weaponry"] then if mods["eve-weaponry"] then
util.steel_to_titanium("small-titanium-sabot") util.me.steel_to_titanium("small-titanium-sabot")
end end
if mods["FastFurnaces"] then if mods["FastFurnaces"] then
util.add_titanium_ingredient(1, "fast-long-handed-inserter") util.me.add_titanium_ingredient(1, "fast-long-handed-inserter")
end end
if mods["NuclearFurnace"] then if mods["NuclearFurnace"] then
util.add_titanium_ingredient(200, "nuclear-furnace-4") util.me.add_titanium_ingredient(200, "nuclear-furnace-4")
end end
-- Useful Equipment -- Useful Equipment

View file

@ -22,7 +22,7 @@ if (not mods["pyrawores"] and not mods["bobplates"]) then
data:extend({ data:extend({
{ {
type = "recipe", type = "recipe",
name = util.titanium_plate, name = util.me.titanium_plate,
category = "smelting", category = "smelting",
order = "d[titanium-plate]", order = "d[titanium-plate]",
icons = (mods["Krastorio2"] and icons = (mods["Krastorio2"] and
@ -35,25 +35,25 @@ data:extend({
enabled = false, enabled = false,
energy_required = 16, energy_required = 16,
ingredients = {{"titanium-ore", 10}}, ingredients = {{"titanium-ore", 10}},
results = {{type="item", name= util.titanium_plate, amount_min=2, amount_max=3}}, results = {{type="item", name= util.me.titanium_plate, amount_min=2, amount_max=3}},
} or } or
{ {
enabled = false, enabled = false,
energy_required = 8, energy_required = 8,
ingredients = {{"titanium-ore", 5}}, ingredients = {{"titanium-ore", 5}},
result = util.titanium_plate result = util.me.titanium_plate
}), }),
expensive = expensive =
{ {
enabled = false, enabled = false,
energy_required = 16, energy_required = 16,
ingredients = {{"titanium-ore", 10}}, ingredients = {{"titanium-ore", 10}},
result = util.titanium_plate result = util.me.titanium_plate
} }
}, },
{ {
type = "item", type = "item",
name = util.titanium_plate, name = util.me.titanium_plate,
icon = "__bztitanium__/graphics/icons/titanium-plate.png", icon = "__bztitanium__/graphics/icons/titanium-plate.png",
icon_size = 64, icon_mipmaps = 3, icon_size = 64, icon_mipmaps = 3,
subgroup = "raw-material", subgroup = "raw-material",
@ -69,7 +69,7 @@ data:extend({
{ {
{ {
type = "unlock-recipe", type = "unlock-recipe",
recipe = util.titanium_plate recipe = util.me.titanium_plate
}, },
mods["TheBigFurnace"] and { mods["TheBigFurnace"] and {
type = "unlock-recipe", type = "unlock-recipe",
@ -104,7 +104,7 @@ data:extend({
enabled = false, enabled = false,
energy_required = 8.75, energy_required = 8.75,
ingredients = {{"titanium-ore", 50}}, ingredients = {{"titanium-ore", 50}},
result = util.titanium_plate, result = util.me.titanium_plate,
result_count = 10, result_count = 10,
}, },
expensive = expensive =
@ -112,7 +112,7 @@ data:extend({
enabled = false, enabled = false,
energy_required = 16, energy_required = 16,
ingredients = {{"titanium-ore", 100}}, ingredients = {{"titanium-ore", 100}},
result = util.titanium_plate, result = util.me.titanium_plate,
result_count = 10, result_count = 10,
} }
} or nil, } or nil,