Hey Nightmare3711,
first of all, thanks for your mod – I really like the idea, it’s a cool addon concept 😄
I thought I’d give you a bit of help, since I know my own code and structure quite well 😉
From a technical perspective, all BRE technologies can be safely patched via data.raw.technology[...] (for example in data-final-fixes.lua).
Because some tech tiers depend on settings (max tier), it’s best to patch defensively and only if the technology actually exists.
As a simple gate condition, you can use something like this:
.
if not (mods["Better_Robots_Extended"] and mods["Space Age"]) then return end
local function add_pack(tech, pack)
tech.unit = tech.unit or {}
tech.unit.ingredients = tech.unit.ingredients or {}
for _, ing in ipairs(tech.unit.ingredients) do
if ing[1] == pack then return end
end
table.insert(tech.unit.ingredients, {pack, 1})
end
local function add_prereq(tech, prereq)
tech.prerequisites = tech.prerequisites or {}
for _, p in ipairs(tech.prerequisites) do
if p == prereq then return end
end
table.insert(tech.prerequisites, prereq)
end
local function remove_prereq(tech, prereq)
if not tech.prerequisites then return end
for i = #tech.prerequisites, 1, -1 do
if tech.prerequisites[i] == prereq then
table.remove(tech.prerequisites, i)
end
end
end
local function patch(name, fn)
local tech = data.raw.technology[name]
if tech then fn(tech) end
end
patch("BRE-construction-robotics-2", function(t)
-- add_prereq(t, "low-density-structure")
-- remove_prereq(t, "personal-battery")
-- add_pack(t, "utility-science-pack")
end)
patch("BRE-logistic-robotics-2", function(t)
-- add_prereq(t, "low-density-structure")
-- remove_prereq(t, "personal-battery")
-- add_pack(t, "utility-science-pack")
end)
patch("BRE-construction-robotics-3", function(t)
-- add_prereq(t, "electromagnetic-science-pack")
-- add_pack(t, "utility-science-pack")
-- add_pack(t, "production-science-pack")
-- add_pack(t, "electromagnetic-science-pack")
end)
patch("BRE-logistic-robotics-3", function(t)
-- add_prereq(t, "electromagnetic-science-pack")
-- add_pack(t, "utility-science-pack")
-- add_pack(t, "production-science-pack")
-- add_pack(t, "electromagnetic-science-pack")
end)
patch("BRE-construction-robotics-4", function(t)
-- add_prereq(t, "carbon-fiber")
-- add_prereq(t, "metallurgic-science-pack")
-- add_pack(t, "agricultural-science-pack")
-- add_pack(t, "metallurgic-science-pack")
end)
patch("BRE-logistic-robotics-4", function(t)
-- add_prereq(t, "carbon-fiber")
-- add_prereq(t, "metallurgic-science-pack")
-- add_pack(t, "agricultural-science-pack")
-- add_pack(t, "metallurgic-science-pack")
end)
patch("BRE-construction-robotics-5", function(t)
-- add_prereq(t, "quantum-processor")
-- add_pack(t, "cryogenic-science-pack")
end)
patch("BRE-logistic-robotics-5", function(t)
-- add_prereq(t, "quantum-processor")
-- add_pack(t, "cryogenic-science-pack")
end)
.
After that, you’re free to decide where and how you want to add Space Age science packs or prerequisites.
I would recommend avoiding changes to research count or time, since BRE already handles balance via settings – science packs and prerequisites are totally fine.
If you do want to adjust the research count, it becomes significantly more complex, as it is internally tied to settings that would then also need to be updated or reworked.
I haven’t tested the code myself, but it should work fine – sorry in advance if something needs a small tweak 😅
If you want, I’m happy to take another look at the SA tech progression or help with testing 😊
Thanks again for the work and the idea behind the addon!