OCs Nauvis Science Ports

by OC1024

This mod adds base game science pack recipes from Nauvis like military science to the non-Nauvis buildings like the foundry. This is the more compatible version of [OCs Alt Sciences]

Content
2 months ago
2.0
217
Factorio: Space Age Icon Space Age Mod
Manufacturing

g Updated the mod to version 2.1 and added a line of code to improve compatibility.

4 hours ago

local util = require("util")

-- 替换ocs的瓶子配方
local science_mapping = {
["foundry-automation-science-pack"] = "automation-science-pack",
["foundry-logistic-science-pack"] = "logistic-science-pack",
["foundry-military-science-pack"] = "military-science-pack",
["biochamber-chemical-science-pack"] = "chemical-science-pack",
["biochamber-space-science-pack"] = "space-science-pack",
["emplant-production-science-pack"] = "production-science-pack",
["emplant-utility-science-pack"] = "utility-science-pack",
}
for target_name, base_name in pairs(science_mapping) do
local base_recipe, target_recipe = data.raw.recipe[base_name], data.raw.recipe[target_name]
if base_recipe and target_recipe then
if base_recipe.ingredients then target_recipe.ingredients = util.table.deepcopy(base_recipe.ingredients) end
if base_recipe.results then target_recipe.results = util.table.deepcopy(base_recipe.results) end
if base_recipe.result then target_recipe.result = base_recipe.result end
if base_recipe.result_count then target_recipe.result_count = base_recipe.result_count end
if base_recipe.energy_required then target_recipe.energy_required = base_recipe.energy_required end
end
end

Added to data-updates.lua.

This way, even when playing with other mods, if this mod modifies a recipe (such as K2SO), it will automatically target and match the newly modified recipe, while other recipes remain unchanged.

2 hours ago
(updated 2 hours ago)

I could do that. That is reasonable. I think I'll do exactly that, thanks. You'll be credited.
EDIT: I found a way more elegant solution. But before I publish it, I want to test it myself.

New response