[MOD 1.1.x|1.0.x]Recycling Machines

Topics and discussion about specific mods
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by DRY411S »

Having looked at this issue, and the fact that it is an edge/corner case currently only known with the Industrial Revolution 2 mod, which includes its own Recycling/Scrappage functionality, instead of trying to fix this, the next version of my mod will declare that it is incompatible with Industrial Revolution 2.
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by DRY411S »

I have discovered that the Production Scrap 2 mod, and my Recycling Machines Mod are not compatible. When Production Scrap 2 and Recycling Machines mod are both active, even though they appear to be craftable, any attempt to craft a recycling Machine results in an assembler being crafted instead (or machine scrap)!

I'm looking for a fix...

https://github.com/DRY411S/Recycling-Machines/issues/96
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 530
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by Silari »

Looks like in your mod you're copying the original assembling machine recipe, and setting the result to be your recycling machine. However, Production Scrap 2 adds the results property on the assembling machine recipes since they have more than one possible result - the machine or the scrap. You don't alter results, and results overrides whatever is in result.

You need to do something similar as you do for the ingredients - check if results exists, and if it does iterate through it so you can find the mention of assembling-machine-<level>+1 and replace it with your recycling-machine-<level>+1. Below example works but I certainly haven't tested it thoroughly.

Code: Select all

function swopassemblerforrecycler(recipe,level)
--log("Machine level: " .. level .. " : " .. serpent.block(recipe))
if recipe.ingredients  ~= nil then
	for _,rec_ingredient in ipairs(recipe.ingredients) do
		if rec_ingredient[1] == "assembling-machine-"..level then
			rec_ingredient[1] = "recycling-machine-"..level
		end
	end -- each assembling machine's recipe ingredient
    if recipe.results ~= nil then
        for _,rec_result in ipairs(recipe.results) do
            if rec_result.name == "assembling-machine-"..level+1 then
                rec_result.name = "recycling-machine-"..level+1
            end
        end
	else
        recipe.result = "recycling-machine-" .. level+1
    end
end
if recipe.normal ~= nil then
	for _,rec_ingredient in ipairs(recipe.normal.ingredients) do
		if rec_ingredient[1] == "assembling-machine-"..level then
			rec_ingredient[1] = "recycling-machine-"..level
		end
	end -- each assembling machine's normal recipe ingredient
    if recipe.normal.results ~= nil then
        for _,rec_result in ipairs(recipe.normal.results) do
            if rec_result.name == "assembling-machine-"..level+1 then
                rec_result.name = "recycling-machine-"..level+1
            end
        end
	else
        recipe.normal.result = "recycling-machine-" .. level+1
    end
end
if recipe.expensive ~= nil  then
	for _,rec_ingredient in ipairs(recipe.expensive.ingredients) do
		if rec_ingredient.name == "assembling-machine-"..level then
			rec_ingredient.name = "recycling-machine-"..level
		end
	end -- each assembling machine's expensive recipe ingredient
	if recipe.expensive.results ~= nil then
        for _,rec_result in ipairs(recipe.expensive.results) do
            if rec_result.name == "assembling-machine-"..level+1 then
                rec_result.name = "recycling-machine-"..level+1
            end
        end
	else
        recipe.expensive.result = "recycling-machine-"..level+1
    end
end
--log(serpent.block(recipe))
return recipe
end
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by DRY411S »

Yep, my mod assumes that the assembling machine recipe has a single result, whereas Production Scrap amends it to have a results table.

I have similar code in mind, thanks for the prototype! I do want to return results though, in the spirit of the Production Scrap mod, so there's a chance the crafting of a recycling machine will 'fail' and produce scrap instead.

(I may decide to do the same with all the recycling recipes, so there's a chance the recycling fails and 'scraps' the input.)
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by DRY411S »

Production Scrap 2 mod compatability is going to be a lot more difficult than I thought. Recycling Machines mod does not like any recipes that produce more than 1 result. Because it does not know which result to recycle.

Example:

Production Scrap 2 electronic circuit recipe, uses wire and plate to produce 94% electronic circuit, 6% circuit scrap.
Recycling Machine looks at the results of that recipe, and doesn't know whether it should recycle the circuit or the scrap, and decides it will recycle neither.

(Production Scrap 2 has its own recipes for recycling scrap)
Devastatorius
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Apr 19, 2024 10:09 am
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by Devastatorius »

Is this mod still alive?
I don't see updates for more than 3 years.
Well, i get game crashes frequently when friends sending messages to me on Steam chat and macOS. No idea about Windows OSes.
This happens when i enable this mod.
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by DRY411S »

Devastatorius wrote: Fri Apr 19, 2024 10:12 am Is this mod still alive?
I don't see updates for more than 3 years.
Well, i get game crashes frequently when friends sending messages to me on Steam chat and macOS. No idea about Windows OSes.
This happens when i enable this mod.
It's not been amended for 3 years because there are no bugs. ;)

Unless you can give me the error message from factorio when the crashes occur, either screenshots, or factorio log entries that 'blame' this mod for the crashes, then there's nothing I can do to investigate.

(As it happens, with base factorio 2.0 when it drops including vanilla recycling machines, I doubt that there will be any more updates to this mod other than bugfixes until factorio 2.0 is released, and then it will be retired.)
Last edited by DRY411S on Fri Apr 19, 2024 10:58 am, edited 1 time in total.
Devastatorius
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Apr 19, 2024 10:09 am
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by Devastatorius »

Ok, i'll try do that on evening. And i have enabled verbose logging to try catch errors or something like that. Thanks.
Devastatorius
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Apr 19, 2024 10:09 am
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by Devastatorius »

Hello.
After tested in some ways, we found is it Steam bug. And it happens in some other games too.
This happens when we trigger shift+tab. Even if this ability is disabled in Steam options.
Good news is that, when we stopped adding/removing mods to the Factorio game, crashes gone away.
BTW thanks for your support and have a good day.
Vanur
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Mar 03, 2024 1:05 pm
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by Vanur »

Incompatible with Warptorio:

Error while running setup for recipe prototype: "dry411srev-warptorio-armor" (recipe): Recipe Item-production "power-amrmor-mk-2" is not stackable but has max count of 5
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by DRY411S »

Vanur wrote: Fri Sep 20, 2024 8:30 pm Incompatible with Warptorio:

Error while running setup for recipe prototype: "dry411srev-warptorio-armor" (recipe): Recipe Item-production "power-amrmor-mk-2" is not stackable but has max count of 5
No idea why I wasn't notified of this. Thanks. Will log it on Github and investigate as I consider whether to make the mod compatible with factorio 2.0.
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by DRY411S »

This mod is not compatible with factorio 2.0. I am considering whether to make it so, but first I want to try the built in recycling machines that ship with the new version of the game. There may be no need for this mod going fowards if all it does is ape the vanilla machines.

The vanilla machines are late in the tech tree, perhaps my Recycling Machines available earlier will 'nerf' what the devs have done?
10-21-2024, 13-17-48.png
10-21-2024, 13-17-48.png (48.89 KiB) Viewed 361 times
tenderroast
Manual Inserter
Manual Inserter
Posts: 1
Joined: Mon Oct 21, 2024 9:37 pm
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by tenderroast »

You could always just add the cheat tag to it, especially since it works with production module upgrades, to effectively have infinite resources, just take a long time to get it.
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 731
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by DRY411S »

tenderroast wrote: Mon Oct 21, 2024 9:43 pm You could always just add the cheat tag to it, especially since it works with production module upgrades, to effectively have infinite resources, just take a long time to get it.
Does it work with Production module upgrades? I thought I had removed that a long time ago!
Jürgen Erhard
Filter Inserter
Filter Inserter
Posts: 299
Joined: Sun Jun 12, 2016 11:29 pm
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by Jürgen Erhard »

DRY411S wrote: Mon Oct 21, 2024 12:14 pm This mod is not compatible with factorio 2.0. I am considering whether to make it so, but first I want to try the built in recycling machines that ship with the new version of the game. There may be no need for this mod going fowards if all it does is ape the vanilla machines.

The vanilla machines are late in the tech tree, perhaps my Recycling Machines available earlier will 'nerf' what the devs have done? 10-21-2024, 13-17-48.png
The vanilla machines aren't vanilla, they're DLC-only.
ErubianWarlord
Burner Inserter
Burner Inserter
Posts: 8
Joined: Fri Jan 26, 2024 10:38 am
Contact:

Re: [MOD 1.1.x|1.0.x]Recycling Machines

Post by ErubianWarlord »

the dev's version fits a very different ecological niche then this one does

their's is primarily made for breaking down the Scrap resource and acting as a quality gambler come Voiding device

your modded one was for legitimate uncrating of items down to their components which pairs well with things like the Ruins mod
Post Reply

Return to “Mods”