Dark Matter Replicators Space Age


This mod adds replicators, machines which can produce items using nothing but electricity. Lower tiers of replicators are the most energy efficient and can essentially transform depleted, empty land into a resource. Higher tier replicators can simplify production lines or otherwise act as a convenience. Tier 1 replicators can replace depleted mining drills, allowing your expansion to be for growth rather than necessity.

Utilities
1 year, 20 days ago
2.0
1.80K
Cheats

b Yuoki

2 months ago

The following mods could not be loaded: ...tors-space-age__/prototypes/repltable/table-creation.lua:136: attempt to index field '?' (a nil value)
stack traceback:
...tors-space-age__/prototypes/repltable/table-creation.lua:136: in function 'repltech_item_table'
...eplicators-space-age__/prototypes/replications/yuoki.lua:21: in main chunk
[C]: in function 'require'
dark-matter-replicators-space-age/data.lua:65: in main chunk

17 days ago
(updated 17 days ago)

I have not fully tested this fix but it does allow the game to load. I have not researched the Dark Matter in my game yet so I do not know if this somehow breaks anything in game.

Try replacing the function on line 136 of prototypes/repltable/table-creation.lua with the below function.
This makes it so Dark Matter stops trying to load missing recipes into the item table causing a nil issue later.

Original function from line 136

function repltech_item_table(item_table, category, prerequisites, overrides)
overrides = overrides or {}
local name = overrides.internal_name or
item_table[1].overrides.internal_name or item_table[1].name
repl_table[name] = {
name = name,
category = repltypes[category],
items = item_table,
prerequisites = replsub_prereq(prerequisites),
overrides = overrides,
from = "repltech_item_table",
}
end

Replacement function:

function repltech_item_table(item_table, category, prerequisites, overrides)
overrides = overrides or {}

    if not item_table or not item_table[1] then
            log("DMR: repltech_item_table skipped because item_table is empty or nil")
            return nil
    end

    local first_item = item_table[1]
    local first_overrides = first_item.overrides or {}

    local name = overrides.internal_name or first_overrides.internal_name or first_item.name

    if not name then
            log("DMR: repltech_item_table skipped because no valid name could be determined")
            return nil
    end

    repl_table[name] = {
            name = name,
            category = repltypes[category],
            items = item_table,
            prerequisites = replsub_prereq(prerequisites),
            overrides = overrides,
            from = "repltech_item_table",
    }

    return repl_table[name]

end

New response