Any Planet Start


Start on any of the first three planets: Vulcanus, Gleba, or Fulgora. Choose your planet in the startup mod settings before starting a new game. Now compatible with some modded planets!

Content
2 months ago
2.0
11.9K
Transportation Environment

i ✅ Duplicate prerequisites w/ AAI Industry

2 months ago
(updated 2 months ago)

I noticed that other threads for compat requests with AAI Industry exists, but I decided to take a crack at fixing it, and with a few extra lines in the add_prerequisites() function this is solved, and it at least runs successfully. It could still be unwinnable, but I think this is at least a non-committal way to allow others to tackle that part if they desire.

--- Adds prerequisites to a technology's list of prerequisites.
---@param name string
---@param prerequisites string[]
function utils.add_prerequisites(name, prerequisites)
    local technology = data.raw.technology[name]
    technology.prerequisites = technology.prerequisites or {}

-- NEW STARTS HERE
    local existing = {}
    for _, prerequisite in pairs(technology.prerequisites) do
        existing[prerequisite] = true
    end
    for _, prerequisite in pairs(prerequisites) do
        if not existing[prerequisite] then
            technology.prerequisites[#technology.prerequisites+1] = prerequisite
        end
    end
end

Simply registers existing prerequisites into a set, so that duplicates don't exist, since that was the only load error (specifically, it was "engine" being duplicated in the "chemical-science-pack" tech prerequisites).

Tested this with Fulgora, Vulcanus, Gleba, and Aquilo (with Dredgeworks: Frozen Reaches)

2 months ago

I just changed the function to do basically what you've suggested, just slightly differently, thanks for the suggestion. Added in 1.1.8

2 months ago

Awesome cheers! And yeah those are great improvements to the code, didn't love it testing against the map if prerequisites was previously nil

New response