naive pymods compatibility
This commit is contained in:
parent
7128b93c8f
commit
ffb93b47e5
8 changed files with 56 additions and 14 deletions
|
|
@ -1,4 +1,9 @@
|
|||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.9.4
|
||||
Date: 2020-12-29
|
||||
Changes:
|
||||
- Base "naive" compatibility with Pyanodon's Raw Ores (pyrawores) - we just use their plates an remove our ore/plates.
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.9.3
|
||||
Date: 2020-12-22
|
||||
Changes:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
local data_util = {}
|
||||
|
||||
data_util.titanium_plate = ""
|
||||
data_util.titanium_processing = ""
|
||||
|
||||
if mods["FactorioExtended-Plus-Core"] then
|
||||
data_util.titanium_plate = "titanium-alloy"
|
||||
|
|
@ -8,6 +9,13 @@ else
|
|||
data_util.titanium_plate = "titanium-plate"
|
||||
end
|
||||
|
||||
if mods["pyrawores"] then
|
||||
data_util.titanium_processing = "titanium-mk01"
|
||||
else
|
||||
data_util.titanium_processing = "titanium-processing"
|
||||
end
|
||||
|
||||
|
||||
-- Remove an element of type t and name from data.raw
|
||||
function data_util.remove_raw(t, name)
|
||||
for i, elem in pairs(data.raw[t]) do
|
||||
|
|
@ -18,17 +26,34 @@ function data_util.remove_raw(t, name)
|
|||
end
|
||||
end
|
||||
|
||||
function data_util.check_for_ingredient(recipe, name)
|
||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||
log(serpent.dump(recipe))
|
||||
for i, ingredient in pairs(recipe.ingredients) do
|
||||
if ingredient.name == name then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--- Add a given quantity of titanium plates to a given recipe
|
||||
function data_util.add_titanium_ingredient(quantity, recipe)
|
||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||
if data_util.check_for_ingredient(recipe, data_util.titanium_plate) then
|
||||
return
|
||||
end
|
||||
table.insert(recipe.ingredients, {data_util.titanium_plate, quantity})
|
||||
end
|
||||
end
|
||||
|
||||
--- Add titanium processing as a prerequisite to a given technology
|
||||
function data_util.add_titanium_prerequisite(technology)
|
||||
table.insert(technology.prerequisites, "titanium-processing")
|
||||
if mods["pyrawores"] then
|
||||
return
|
||||
end
|
||||
table.insert(technology.prerequisites, data_util.titanium_processing)
|
||||
end
|
||||
|
||||
--- Change all occurances of steel plates to titanium plates in a given recipe
|
||||
|
|
@ -43,6 +68,9 @@ end
|
|||
|
||||
function data_util.replace_ingredient(recipe, old, new)
|
||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||
if data_util.check_for_ingredient(recipe, new) then
|
||||
return
|
||||
end
|
||||
for i, ingredient in pairs(recipe.ingredients) do
|
||||
-- For final fixes
|
||||
if ingredient.name == old then ingredient.name = new end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bztitanium",
|
||||
"version": "0.9.3",
|
||||
"version": "0.9.4",
|
||||
"factorio_version": "1.1",
|
||||
"title": "Titanium",
|
||||
"author": "Brevven",
|
||||
|
|
|
|||
|
|
@ -1,21 +1,23 @@
|
|||
-- Settings, etc.
|
||||
--
|
||||
-- Finalize tech tree based on settings and other dependent mods.
|
||||
local util = require("__bztitanium__.data-util");
|
||||
|
||||
local mining_fluid
|
||||
if settings.startup["bztitanium-mining-fluid"] then
|
||||
mining_fluid = settings.startup["bztitanium-mining-fluid"].value
|
||||
end
|
||||
|
||||
if mining_fluid == "chlorine" and data.raw.fluid["chlorine"] and mods["Krastorio2"] then
|
||||
data.raw.technology["titanium-processing"].prerequisites = {"kr-fluids-chemistry"}
|
||||
data.raw.technology["titanium-processing"].unit.ingredients = {
|
||||
data.raw.technology[util.titanium_processing].prerequisites = {"kr-fluids-chemistry"}
|
||||
data.raw.technology[util.titanium_processing].unit.ingredients = {
|
||||
{"basic-tech-card", 1}, {"automation-science-pack", 1}, {"logistic-science-pack", 1}}
|
||||
elseif mining_fluid == "sulfuric-acid" then
|
||||
data.raw.technology["titanium-processing"].prerequisites = {"sulfur-processing"}
|
||||
data.raw.technology["titanium-processing"].unit.ingredients = {
|
||||
data.raw.technology[util.titanium_processing].prerequisites = {"sulfur-processing"}
|
||||
data.raw.technology[util.titanium_processing].unit.ingredients = {
|
||||
{"automation-science-pack", 1}, {"logistic-science-pack", 1}}
|
||||
else
|
||||
data.raw.technology["titanium-processing"].prerequisites = {"lubricant"}
|
||||
data.raw.technology[util.titanium_processing].prerequisites = {"lubricant"}
|
||||
if not mods["Pre0-17-60Oil"] then
|
||||
data.raw.technology["solar-panel-equipment"].unit.ingredients = {
|
||||
{"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
-- Enriched Titanium for Krastorio2
|
||||
local util = require("__bztitanium__.data-util");
|
||||
|
||||
if mods["Krastorio2"] then
|
||||
data:extend(
|
||||
{
|
||||
|
|
@ -103,7 +105,7 @@ data:extend(
|
|||
recipe = "dirty-water-filtration-titanium",
|
||||
}
|
||||
},
|
||||
prerequisites = {"kr-enriched-ores", "titanium-processing"},
|
||||
prerequisites = {"kr-enriched-ores", util.titanium_processing},
|
||||
unit =
|
||||
{
|
||||
count = 150,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ if mods["5dim_core"] then
|
|||
result_count = 100,
|
||||
}
|
||||
})
|
||||
table.insert(data.raw.technology["titanium-processing"].effects,
|
||||
table.insert(data.raw.technology[util.titanium_processing].effects,
|
||||
{type = "unlock-recipe", recipe="titanium-plate-industrial-ore"})
|
||||
|
||||
|
||||
|
|
@ -83,11 +83,11 @@ if mods["5dim_core"] then
|
|||
result_count = 100,
|
||||
}
|
||||
})
|
||||
table.insert(data.raw.technology["titanium-processing"].effects,
|
||||
table.insert(data.raw.technology[util.titanium_processing].effects,
|
||||
{type = "unlock-recipe", recipe="titanium-dust"})
|
||||
table.insert(data.raw.technology["titanium-processing"].effects,
|
||||
table.insert(data.raw.technology[util.titanium_processing].effects,
|
||||
{type = "unlock-recipe", recipe="titanium-plate-dust"})
|
||||
table.insert(data.raw.technology["titanium-processing"].effects,
|
||||
table.insert(data.raw.technology[util.titanium_processing].effects,
|
||||
{type = "unlock-recipe", recipe="titanium-plate-industrial-dust"})
|
||||
|
||||
if mods["5dim_automation"] then
|
||||
|
|
|
|||
|
|
@ -16,9 +16,11 @@ end
|
|||
util.add_titanium_prerequisite(data.raw.technology["solar-panel-equipment"])
|
||||
|
||||
|
||||
-- Also add titanium to steam turbines
|
||||
-- Also add titanium to some nuclear steam-handling stuff
|
||||
util.add_titanium_ingredient(20, data.raw.recipe["steam-turbine"])
|
||||
util.add_titanium_ingredient(20, data.raw.recipe["heat-exchanger"])
|
||||
if mods["pyrawores"] then
|
||||
util.add_titanium_ingredient(20, data.raw.recipe["heat-exchanger"])
|
||||
end
|
||||
util.add_titanium_prerequisite(data.raw.technology["nuclear-power"])
|
||||
|
||||
-- Krastorio 2 changes
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ if mods["modmashsplinterresources"] then
|
|||
util.remove_raw("recipe", "titanium-extraction-process")
|
||||
end
|
||||
|
||||
if not mods["pyrawores"] then
|
||||
data:extend(
|
||||
{
|
||||
{
|
||||
|
|
@ -88,3 +89,5 @@ data:extend(
|
|||
},
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue