dfarhi / factorio-teamwork

1 stars 1 forks source link

Compat with industrial revolution? #17

Open xXParryXx opened 2 years ago

xXParryXx commented 2 years ago

image this error happens when trying to load both mods at once

dfarhi commented 2 years ago

Weird. It's got to be related to this block of code:

https://github.com/dfarhi/factorio-teamwork/blob/master/data-updates.lua#L23

but I don't see why count would ever be 0. Does the Industrial Revolution mod change the stats of the steel-axe tech?

xXParryXx commented 2 years ago

after looking at the code it seem that it happens as IR "dumps the vanilla tech list" and then "completely wipe all vanilla prereqs and all science pack costs. harsh but fair" and then disables that tech with some other techs as it replaces most of them with its own the quotes are comments in the IR code for the technology-vanilla.lua where all the vanilla tech and that value is changed correct me if im wrong but the techs that teamwork uses is all of the modules, steel axe, toolbelt and auto trash slots? all but the auto trash slots gets disabled by IR and IR doesnt replace the steel axe nor the toolbelt techs as its intended to be slower and only get slots from better armour.

dfarhi commented 2 years ago

Ah, I think I see.

The teamwork code was designed so it would work fine if another mod removed one of the listed techs entirely. But it sounds like IR turns them off not by removing them, but instead: a) Changing the values to invalid values (removes the "count" field) b) Setting them to "disabled".

That sounds like a weird thing to do --- why not just remove them? if you're going to disable them, why set the count to an invalid value? --- but anyway I can definitely imagine that I didn't account for that in the teamwork code.

dfarhi commented 2 years ago

If that's the issue we can fix it by just ignoring all techs "disabled" in this way. How are they disabled in IR?

xXParryXx commented 2 years ago

yea IR uses DIR.disable_technology("") but im gonna also give the code before that bit as it might be related(not a programmer but can kinda read it)

if DIR.dump_vanilla_techs then
    local list = {}
    local techdump = "\n\n\nreturn {\n"
    for _,tech in pairs(data.raw.technology) do
        if not tech.enabled or tech.enabled ~= false then list[DIR.strip_numeric_suffix(tech.name)] = true end
    end
    local array = {}
    for techname,_ in pairs (list) do
        table.insert(array,techname)
    end
    table.sort(array)
    for _,techname in pairs(array) do
        techdump = techdump .. "    [\"" .. techname .. "\"] = true,\n"
    end
    log(techdump.."}\n\n\n")    
end
for _,tech in pairs(data.raw.technology) do
    if DIR.is_tech_rebuildable(tech) then
        tech.prerequisites = tech.IR_native and tech.prerequisites or nil
        tech.unit.ingredients = {{"automation-science-pack", 1}}
        tech.unit.time = 60
        tech.unit.count = 1
        tech.unit.count_formula = nil
    end
end

and all the techs it disables with comments for its replacements if there is

DIR.disable_technology("advanced-electronics") --> ir2-electronics-2
DIR.disable_technology("advanced-electronics-2") --> ir2-electronics-3
DIR.disable_technology("advanced-material-processing") --> no material equivalent, functionally this would be ir2-furnaces-1
DIR.disable_technology("advanced-material-processing-2") --> no material equivalent, functionally this would be ir2-furnaces-2
DIR.disable_technology("cliff-explosives") --> explosives
DIR.disable_technology("concrete") --> ir2-concrete-1
DIR.disable_technology("construction-robotics") --> personal-roboport-equipment
DIR.disable_technology("effectivity-module") --> ir2-modules-1
DIR.disable_technology("effectivity-module-2") --> ir2-modules-2
DIR.disable_technology("effectivity-module-3") --> ir2-modules-3
DIR.disable_technology("electronics") --> ir2-electronics-1
DIR.disable_technology("fast-inserter") --> ir2-inserters-2
DIR.disable_technology("flammables") --> no equivalent, unlocks nothing, arguably shouldn't exist
DIR.disable_technology("inserter-capacity-bonus-4") --> no equivalent really; in IR, non-stack inserter bonuses are from ir2-normal-inserter-capacity-bonus-1/2; see also stack-inserter
DIR.disable_technology("inserter-capacity-bonus-5") --> inserter-capacity-bonus-1
DIR.disable_technology("inserter-capacity-bonus-6") --> inserter-capacity-bonus-2
DIR.disable_technology("inserter-capacity-bonus-7") --> inserter-capacity-bonus-3
DIR.disable_technology("logistic-robotics") --> robotics
DIR.disable_technology("lubricant") --> oil-processing
DIR.disable_technology("modules") --> no equivalent, i guess ir2-modules-1
DIR.disable_technology("productivity-module") --> ir2-modules-1
DIR.disable_technology("productivity-module-2") --> ir2-modules-2
DIR.disable_technology("productivity-module-3") --> ir2-modules-3
DIR.disable_technology("rail-signals") --> automated-rail-transportation
DIR.disable_technology("solar-energy") --> ir2-solar-energy-1
DIR.disable_technology("speed-module") --> ir2-modules-1
DIR.disable_technology("speed-module-2") --> ir2-modules-2
DIR.disable_technology("speed-module-3") --> ir2-modules-3
DIR.disable_technology("stack-inserter") --> ir2-inserters-3; also adds bonus to stack inserters covered in vanilla by inserter-capacity-bonus-1/2/3/4
DIR.disable_technology("steel-axe") --> no equivalent
DIR.disable_technology("steel-processing") --> ir2-steel-milestone
DIR.disable_technology("toolbelt") --> no equivalent, inventory bonuses are purely armour-based in IR
DIR.disable_technology("uranium-ammo") --> military-4

after this there is only stuff that changes icons, prereqs and unlocks, i hope it helps figuring out a fix as it would be interesting to build a split base with friends in IR

dfarhi commented 2 years ago

hmm, I have no idea what DIR.disable_technology("") is. Is there some way to check if a technology has been disabled in this way?