Natural Gas

by brevven

Adds a natural gas resource, along with early game plastic. Integrates ElAdamo's gas-fired boiler. Compatible with Krastorio 2 and Space Exploration. A standalone piece of BZ Mods.

Content
30 days ago
1.1
21.1K
Mining Fluids Manufacturing

b Alternate (wooden) green circuit recipe still require tech

1 year, 8 months ago

...And lot of modded labs still require green circuits (More Science for example).
We have deadlock.

IMHO, the best solution is to just leave the lab recipe alone, but provide the way for craft this circuits from start.

1 year, 8 months ago

...Aluminum & carbon have same problems with More Science labs.

Guess I'll write a simple mod myself to fix this compatibility issue (or rather just fork an abandoned Research Desk that has same problem).

1 year, 8 months ago

Thank you for the report. I will make More Science compatible.

Electronic Circuits are intentionally delayed with Carbon, Aluminum & Natural Gas. I will probably need to programmatically detect recipes that are pre-electronics to change, if custom changes haven't been added yet.

1 year, 8 months ago
(updated 1 year, 8 months ago)

I've uploaded a more general fix for this, Aluminum, and Graphite & Diamonds. It will catch anything in the electronics tree, or anything unlocked at the beginning of the game. It won't specifically catch things outside the electronics tech tree, but all the vanilla ones are handled already. If you notice anything that is not caught by this fix, please let me know!

1 year, 8 months ago
(updated 1 year, 8 months ago)

The first thing I noticed: copper-processing tech (from tin?) may cause same problems.
Also, this tech looks strange: we don't add [iron/lead/aluminum]-processing to the game after all.

UPD: It's not from tin, it's from aluminum. And through this I see very strange thing: copper wire required aluminum plate if unlocks before.
Please, just remove this nonsense tech!

1 year, 8 months ago

Also, this tech looks strange: we don't add [iron/lead/aluminum]-processing to the game after all.

The Aluminum mod pushes copper a few techs deeper in the tree, while iron, lead, and aluminum are all available from the start.

And through this I see very strange thing: copper wire required aluminum plate if unlocks before.

Thanks for letting me know. This unlock does not appear to be part of More Science. Do you know which mod it is from, or perhaps have a modlist?
I should be able to come up with a fix for it, but being able to reproduce with an existing mod would help.

I am going to leave the tech in, it would also be a bit tricky to support properly with an option but I will think on that.

1 year, 8 months ago

Do you know which mod it is from, or perhaps have a modlist?

Research Desk mod does it. Unfortunately, the existing version is abandoned, has many bugs, and is incompatible with your mods. Now I am writing my own fork, but it's not ready yet.

I am going to leave the tech in, it would also be a bit tricky to support properly with an option but I will think on that.

I stated my reasons why copper-processing would be better removed there: https://mods.factorio.com/mod/bzaluminum/discussion/62ef7df11ae23c2a94455fe5

1 year, 8 months ago

The good news: I do have a more general solution to the issue of e.g. copper cables requiring copper plates, so that will be in the latest.

The bad news: I took a look at the existing Research Desk mod. In the current state it will unfortunately be incompatible with Natural Gas, Aluminum and Graphite & Diamonds, because Research Desk puts a variety of techs behind electronics, which will create a tech loop (or a stack overflow in certain cases).

I can look into trying to make my mods compatible with it, but I might wait to see what your fork looks like first, because it will take some rearranging of technologies to make it work.

The above fix should work for research desk if the tech dependency loop were not to exist.

1 year, 8 months ago

The bad news: I took a look at the existing Research Desk mod. In the current state it will unfortunately be incompatible with Natural Gas, Aluminum and Graphite & Diamonds, because Research Desk puts a variety of techs behind electronics, which will create a tech loop (or a stack overflow in certain cases).

Here's very early and incomplete version of my fork: https://files.catbox.moe/o3qx8t.zip
It's under development, but already can works with your mod (and gets some weird results, like green circuit recipe dup).
In addition, new tier-0 circuits have been introduced and I plan to replace all early game green circuits with them.

I hope this illustrates what i am going to do with this mod and may be helpful for you.

1 year, 8 months ago

...And another possible issue with this:

If you notice anything that is not caught by this fix, please let me know!

It's all siblings. util.replace_ingredients_prior_to check only ancestors.
And you still change some recipes (lab, offshore-pump, electric-mining-drill, assembling-machine-1, radar etc.) by hand, without checking.

1 year, 8 months ago
(updated 1 year, 8 months ago)

Also have some false positives with "Filter Combinator" and "Switch Button". util.replace_ingredients_prior_to replace them circuits, no idea why.

UPD: It's should be a separate bugreport I guess: https://mods.factorio.com/mod/bzaluminum/discussion/62eff13b5c75d0a1f5f8a6bf

1 year, 8 months ago

Yes, siblings will still be a minor issue. At least it won't cause a true deadlock or tech loop, though it might be inconvenient enough to require a fix if we run into one.

1 year, 8 months ago

I will try to write my own version that works with siblings.

I will try to write my own version that works with siblings.
Also, right now I propose solution for another problem:

gets some weird results, like green circuit recipe dup

...because we both set it. For avoid this, I use next code (based on your lib):

function util.remove_all_recipe_effects(recipe_name)
    for name, _ in pairs(data.raw.technology) do
        util.remove_recipe_effect(name, recipe_name)
    end
end

function util.add_unlock_force(technology_name, recipe)
    util.set_enabled(recipe, false)
    util.remove_all_recipe_effects(recipe)
    util.add_unlock(technology_name, recipe)
end

...

util.add_unlock_force("electronics", "electronic-circuit")

However, to avoid all dups we both need to use it.
Also, with this remove_prior_unlocks is no longer needed.

P.S. Yes, I am using your data-util.lua lib. It's very suitable for me ^_^

1 year, 8 months ago

That's a very good idea, will give it a try sometime soon. Thanks!

1 year, 8 months ago
(updated 1 year, 8 months ago)

Thanks!

You are welcome! ^_^

Also, for better work we need to adapt remove_recipe_effect to catch dups in single tech:

function util.remove_recipe_effect(technology_name, recipe_name)
    local technology = data.raw.technology[technology_name]
    local index = -1
    local cnt = 0
    if technology and technology.effects then
        for i, effect in pairs(technology.effects) do
            if effect.type == "unlock-recipe" and effect.recipe == recipe_name then
                index = i
                cnt = cnt + 1
            end
        end
        if index > -1 then
            table.remove(technology.effects, index)
            if cnt > 1 then -- not over yet, do it again
                util.remove_recipe_effect(technology_name, recipe_name)
            end
        end
    end
end

Recursion is fine here because it's a very rare case.

1 year, 8 months ago
(updated 1 year, 8 months ago)

I will try to write my own version that works with siblings.

Done:

function util.replace_ingredients_prior_to(tech, old, new, multiplier)
    if not data.raw.technology[tech] then
        log("Not replacing ingredient "..old.." with "..new.." because tech "..tech.." was not found")
        return
    end

    for i, recipe in pairs(data.raw.recipe) do
        if recipe.enabled and recipe.enabled ~= 'false' then 
            util.replace_ingredient(recipe.name, old, new, multiplier, true)
        end
    end

    for curr_tech_name, curr_tech in pairs (data.raw.technology) do
        if  curr_tech_name ~= tech and curr_tech.effects and not technology_has_ancestor(curr_tech_name, tech) then
            for _, effect in pairs(curr_tech.effects) do
                if effect.type == "unlock-recipe" then
                    util.replace_ingredient(effect.recipe, old, new, multiplier, true)
                end
            end
        end
    end
end

function technology_has_ancestor(current, ancestor)
    local tech = data.raw.technology[current]
    if tech.prerequisites then
        for _, prereq in pairs(tech.prerequisites) do
            if prereq == ancestor or technology_has_ancestor(prereq, ancestor) then
                return true
            end
        end
    end
    return false
end
1 year, 8 months ago

Also, the fork we talked about above is ready after all: https://mods.factorio.com/mod/research-desk-fork

Of course, I use all the above code in it.

1 year, 8 months ago

Uploaded everything but the sibling change in latest Aluminum -- I need to evaluate the sibling change with more mods. (Eg the great^n-nibling case)

New response