Cupric Asteroids


Adds a new type of asteroid that gives earlier access to copper in space.

Content
14 days ago
2.0
2.70K
Factorio: Space Age Icon Space Age Mod
Environment Mining

g (Compatibility/Bug?) No option for stone byproduct/triproduct with BZ mods and Crushing Industry present

10 days ago

Hello again!

Thoroughly enjoying your mods, however, I noticed while playing with version 1.5.5 of Cupric Asteroids that stone is removed as an optional byproduct/triproduct (understandably to prevent a duplicate with Crushing Industry) - that said, I also have several BZ mods present (Lead, Silica/Silicon, Titanium, Tin, and Zircon), of which stone is no longer present as a result of asteroid crushing, nor is there the option anymore to select stone as a byproduct or triproduct.

Would it be possible to add back the stone option as byproducts/triproducts when BZ mods are present?

No rush either if you are willing to do so - I am a ways off still from that stage of the game. I've additionally written a small compatibility mod of my own to add stone back to asteroid crushing, but would prefer if it was natively compatible/incorporated when BZ mods are present.

Thanks for your hard work on these fantastic mods!

10 days ago

Hi Eckelmonster, full BZ mods compat is pretty intricate so I think it was done with specific reason, but I'd have to look again to see. How does your tweak mod handle it? I'm not opposed to allowing you to squeeze yet another byproduct into advanced asteroid crushing, just explaining the reason why

10 days ago

Thanks for being open to it, but I understand if not - appreciate the explanation!

As far as the tweak mod I made, it's essentially just creating a dictionary of the available asteroid-chunk prototypes, and then looking for any recipes with a matching name; if found it then loops through the results of the recipe, and adds stone only if stone was not already present. It's not up on the mod portal, but this is the extent of it (it's one .lua file loaded during data-updates - mod is optionally dependent on crushing-industry, cupric-asteroids, and the above BZ mods):

info.json

{
    "name": "configurable-asteroids",
    "version": "0.1.0",
    "factorio_version": "2.0",
    "title": "configurable-asteroids",
    "author": "TheEckelmonster",
    "description": "Various configurable settings for asteroids",
    "dependencies": [
        "base >= 2.0.72",
        "? crushing-industry >= 0.4.21",
        "? cupric-asteroids >= 1.5.5",
        "? bzlead >= 2.0.28",
        "? bzsilicon >= 2.0.18",
        "? bztin >= 2.1.15",
        "? bztitanium >= 2.0.26",
        "? bzzirconium >= 2.1.13"
    ]
}

data-updates.lua

local asteroid_chunks_dictionary = {}

for _, v in pairs(data.raw["asteroid-chunk"]) do
    local _, _, name = v.name:find("(%a+%-asteroid)%-chunk")

    if (type(name) == "string" and #name > 0) then
        asteroid_chunks_dictionary[name .. "-crushing"] = true
        asteroid_chunks_dictionary["advanced-" .. name .. "-crushing"] = true
        if (name == "oxide-asteroid" and mods["bzzirconium"]) then
            asteroid_chunks_dictionary["advanced-" .. name .. "-crushing-zirc"] = true
        end
    end
end

for _, v in pairs(data.raw["recipe"]) do
    if (asteroid_chunks_dictionary[v.name]) then
        if (v.result) then
            local results = { v.result,}
            v.results = results
            v.result = nil
        end

        local stone_already_present = false
        for i, j in pairs(v.results) do
            if (j.name == "stone") then
                stone_already_present = true
                break
            end
        end

        if (not stone_already_present) then
            if (v.name:find("advanced-", 1, true)) then
                table.insert(v.results, {
                    type = "item",
                    name = "stone",
                    amount_min = 2,
                    amount_max = 8,
                    probability = 0.01
                })
            else
                table.insert(v.results, {
                    type = "item",
                    name = "stone",
                    amount_min = 3,
                    amount_max = 12,
                    probability = 0.02
                })
            end
        end
    end
end

You are more than welcome to use the above code however you'd like - let me know if I can be of any assistance.

10 days ago

Ah. So something to keep in mind and one of the motivators here is that the burner and electric crushers have a limit on their result size, since they're furnaces. Granted you can increase that, so I can make an option that forces stone to be a byproduct, but that is the reason BZ ore compatibility was so precise, I was balancing the number of byproducts from basic asteroid processing so that you don't NEED advanced / big crushers. Thank you for the code though! I'll add this later when I have time

10 days ago

That makes a lot of sense - hadn't thought about/considered that (still a bit new with modding Factorio).

As for the code though, you are very welcome - happy to help to the extent I can. No rush, but I'll be on the lookout for the update!

10 days ago

No worries, you actually happened to run into one of the hardest pieces of compatibility, getting BZ Carbon + Lead + Tin (+Titanium?) working with CI and CA was a couple weeks of dedicated work and brainstorming haha

New response