Schmitt | No Handcrafting 🤲⛓


Handcrafting disabled. Starting inventory adjusted (to be able to start at all without handcrafting): 1 burner mining drill, 1 stone furnace, 1 assembling machine, 1 small electric pole, 1 boiler, 1 steam engine, 1 offshore pump.

Tweaks
9 months ago
1.1
2.77K
Manufacturing

i ✅ data-final-fixes cleanup

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

Hi, returning the favor here with a suggestion of my own :)

You can greatly simplify your process in data-final-fixes like below.

-- Mostly copied from https://mods.factorio.com/mod/Lazy_Rabbit of author 'DarkyPupu'
-- Copied by DE_Schmitt

-- source = destination
local category_replacements = {
    _default = "basic-crafting", -- _default stands in for nil key
    handcraft = "basic-crafting",
    handcrafting = "basic-crafting",
    crafting = "advanced-crafting",
    electronics = "electronics-machine"
}

-- Replace entries for basic-crafting with advanced-crafting if py is present
if mods["pypostprocessing"] then
    for source, destination in pairs(category_replacements) do
        if destination == "basic-crafting" then
            category_replacements[source] = "advanced-crafting"
        end
    end
end

-- For every recipe, we replace the category if it has a relevant entry in category_replacements
for _, recipe in pairs(data.raw["recipe"]) do
    local target_category = category_replacements[recipe.category or "_default"]
    if target_category then -- We have an entry replacing the given category
        recipe.category = target_category
    end
end
1 year, 9 months ago

Thanks for sharing your ideas! I also see that you have a similiar mod where you probably realized that code already. https://mods.factorio.com/mod/NoHandCraftingContinued

1 year, 9 months ago

Yep, sure was - I saw you on the front page and it was a reminder to do a little housekeeping on my own version.

New response