[MOD 0.13.0+|v0.12]Recycling Machines

Topics and discussion about specific mods
flabort
Inserter
Inserter
Posts: 25
Joined: Wed May 11, 2016 2:57 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by flabort »

Well, what chemical reaction can't be reversed with a little finagling?
Take Water, for example. You can split it into hydrogen and oxygen through application of electricity, or you can put them back together through application of heat.
Plastics are often melted down for recycling, often to form new items that are made of plastic as well, but sometimes are broken down into the composite hydrogen and carbon (and oxygen, sometimes), to be shaped into other forms of plastic or rubber, or sometimes other chemicals entirely. Sure, it takes a lot more energy to reverse a reaction such as plastics-making, but it's been done. Now, I'm not sure about getting the carbon back in COAL form, but certainly in a burnable form; perhaps if a recipe requires coal to make it, such as plastic, you could have your script which automatically makes the recycling-recipe output solid-fuel instead.

I'm not saying everything should have a recycler - the oil refinery, for example, should not. Heh, imagine mixing the light and heavy oils with petrol to get crude oil and water back. No, that would be a bad idea. But the chemical plant does seem like a likely candidate to me.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by DRY411S »

Just to confirm that I've now checked that this mod is compatible with the Marathon Mod.

inick
Inserter
Inserter
Posts: 49
Joined: Thu Jun 16, 2016 7:36 pm
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by inick »

Thanks for the idea!

Appreciate the mod, really like the thought in it. I feel a 100% return is too grateful though. I really would rather a configurable amount/percent.

I just enabled it in 0.12.35 64-bit and found an existing world doesn't allow you to craft the recycling machines. I expect completing the research would enable it as it should. This is past research, and didn't have access to craft the recycler.


Can you add a check for if the research was already finished, then enable the machine?
thanks!

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by DRY411S »

inick wrote:Thanks for the idea!

Appreciate the mod, really like the thought in it. I feel a 100% return is too grateful though. I really would rather a configurable amount/percent.

I just enabled it in 0.12.35 64-bit and found an existing world doesn't allow you to craft the recycling machines. I expect completing the research would enable it as it should. This is past research, and didn't have access to craft the recycler.


Can you add a check for if the research was already finished, then enable the machine?
thanks!
Thanks for the feedback.

This is my first factorio mod so I'm learning as I go, but I'm pretty sure that I cannot enable it in an existing world. But I'll do so more reading around the start up phases in the game, and see if I can improve it.

Regarding 100% return, I'm also think about a GUI for that, but again as I understand it, I cannot present a GUI to the user until a world is fully created, and again that's too late to change any recipes.

If you wish to manually edit the percentage return, you can unzip the mod in the mods folder, put the zip file somewhere safe out of the way, and in the unzip, edit constants.lua. The next time you start a new world, the new percentage will be used.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by DRY411S »

DRY411S wrote:
inick wrote:Thanks for the idea!

Appreciate the mod, really like the thought in it. I feel a 100% return is too grateful though. I really would rather a configurable amount/percent.

I just enabled it in 0.12.35 64-bit and found an existing world doesn't allow you to craft the recycling machines. I expect completing the research would enable it as it should. This is past research, and didn't have access to craft the recycler.


Can you add a check for if the research was already finished, then enable the machine?
thanks!
Thanks for the feedback.

This is my first factorio mod so I'm learning as I go, but I'm pretty sure that I cannot enable it in an existing world. But I'll do so more reading around the start up phases in the game, and see if I can improve it.

Regarding 100% return, I'm also think about a GUI for that, but again as I understand it, I cannot present a GUI to the user until a world is fully created, and again that's too late to change any recipes.

If you wish to manually edit the percentage return, you can unzip the mod in the mods folder, put the zip file somewhere safe out of the way, and in the unzip, edit constants.lua. The next time you start a new world, the new percentage will be used.
OK! I was wrong about not being able to use the mod in a previously saved world. New version now in test that allows this. :)

Still a way to go with a version that lets you choose the recycling return that is always 100% at the moment.

inick
Inserter
Inserter
Posts: 49
Joined: Thu Jun 16, 2016 7:36 pm
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by inick »

DRY411S wrote:
OK! I was wrong about not being able to use the mod in a previously saved world. New version now in test that allows this. :)

Still a way to go with a version that lets you choose the recycling return that is always 100% at the moment.

I'll throw it on and play with your testing version if you wanna link me. I'm not a fast player and often have hours of "I hate this layout. Why do I keep doing this style layout to myself?!" Let me know if you want another tester! :)

--iNick

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by DRY411S »

inick wrote:
DRY411S wrote:
OK! I was wrong about not being able to use the mod in a previously saved world. New version now in test that allows this. :)

Still a way to go with a version that lets you choose the recycling return that is always 100% at the moment.

I'll throw it on and play with your testing version if you wanna link me. I'm not a fast player and often have hours of "I hate this layout. Why do I keep doing this style layout to myself?!" Let me know if you want another tester! :)

--iNick
You can always download (at your own risk) an unreleased test version by downloading the latest source code (NOT the release zipfile) from https://github.com/DRY411S/Recycling-Machines

The latest 'master' branch code up there is always tested by me, but not always built into the release at the top of this topic.

That's not for the faint-hearted though, you need to know how to name the mod folder the same as the info.json file.

inick
Inserter
Inserter
Posts: 49
Joined: Thu Jun 16, 2016 7:36 pm
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by inick »

DRY411S wrote:
inick wrote:
DRY411S wrote:
OK! I was wrong about not being able to use the mod in a previously saved world. New version now in test that allows this. :)

Still a way to go with a version that lets you choose the recycling return that is always 100% at the moment.

I'll throw it on and play with your testing version if you wanna link me. I'm not a fast player and often have hours of "I hate this layout. Why do I keep doing this style layout to myself?!" Let me know if you want another tester! :)

--iNick
You can always download (at your own risk) an unreleased test version by downloading the latest source code (NOT the release zipfile) from https://github.com/DRY411S/Recycling-Machines

The latest 'master' branch code up there is always tested by me, but not always built into the release at the top of this topic.
<SNIP>

Yea see... I know what github is, I understand it's purpose, but I haven't the faintest of ideas, clues, suggestions, howtos, or overall plain knowledge on how to leverage "building" from github. I don't get it, and don't visit github often enough to even think it's worth my time learning. Guess I'll wait for a release. Thanks, though.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by DRY411S »

inick wrote:<snip>

I just enabled it in 0.12.35 64-bit and found an existing world doesn't allow you to craft the recycling machines. I expect completing the research would enable it as it should. This is past research, and didn't have access to craft the recycler.


Can you add a check for if the research was already finished, then enable the machine?
thanks!
This is now available in v0.12.32, just released. The first post in the topic is updated with the new download location, and you can also download it by clicking here

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by DRY411S »

I believe that I cannot make the recycling return percentage interactive.
  • The recycling recipes are built during the 'data' phase when they cannot access any global variables.
  • I can present the player with a box where they can choose a new percentage only in the 'control' phase, when the recipes are now built, and read-only.
  • I could store this new percentage in a global and force the 'data' phase again.
  • But the data phase cannot read the global....
  • doom loop
If any modding experts can point me the right way, I'll have a go, but right now I cannot figure out a way.

User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by Arch666Angel »

DRY411S wrote:I believe that I cannot make the recycling return percentage interactive.
  • The recycling recipes are built during the 'data' phase when they cannot access any global variables.
  • I can present the player with a box where they can choose a new percentage only in the 'control' phase, when the recipes are now built, and read-only.
  • I could store this new percentage in a global and force the 'data' phase again.
  • But the data phase cannot read the global....
  • doom loop
If any modding experts can point me the right way, I'll have a go, but right now I cannot figure out a way.
That's a limitation of factorio, if you want it configurable you need to do it in the data phase to modify the entities. A way I could think of would be just to create 3 sets of recipes with each set having a different yield, a box for choosing when stating the game and then enabling/disabling the recipes on_researched when a dummy technology is researched. But haven't tried anything like that.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by DRY411S »

Arch666Angel wrote:
DRY411S wrote:I believe that I cannot make the recycling return percentage interactive.
  • The recycling recipes are built during the 'data' phase when they cannot access any global variables.
  • I can present the player with a box where they can choose a new percentage only in the 'control' phase, when the recipes are now built, and read-only.
  • I could store this new percentage in a global and force the 'data' phase again.
  • But the data phase cannot read the global....
  • doom loop
If any modding experts can point me the right way, I'll have a go, but right now I cannot figure out a way.
That's a limitation of factorio, if you want it configurable you need to do it in the data phase to modify the entities. A way I could think of would be just to create 3 sets of recipes with each set having a different yield, a box for choosing when stating the game and then enabling/disabling the recipes on_researched when a dummy technology is researched. But haven't tried anything like that.
Thanks for the feedback. This would work I think. My mod has an event handler for research_finished which I could adapt. Currently it enables the recycling recipe every time the 'real' recipe research is complete.

I started working in IT when 32K of memory was a MASSIVE amount. It's hard to get past the idea that I must occupy memory with a bunch of recipes that are never used.

User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by Arch666Angel »

DRY411S wrote:
Arch666Angel wrote:
DRY411S wrote:I believe that I cannot make the recycling return percentage interactive.
  • The recycling recipes are built during the 'data' phase when they cannot access any global variables.
  • I can present the player with a box where they can choose a new percentage only in the 'control' phase, when the recipes are now built, and read-only.
  • I could store this new percentage in a global and force the 'data' phase again.
  • But the data phase cannot read the global....
  • doom loop
If any modding experts can point me the right way, I'll have a go, but right now I cannot figure out a way.
That's a limitation of factorio, if you want it configurable you need to do it in the data phase to modify the entities. A way I could think of would be just to create 3 sets of recipes with each set having a different yield, a box for choosing when stating the game and then enabling/disabling the recipes on_researched when a dummy technology is researched. But haven't tried anything like that.
Thanks for the feedback. This would work I think. My mod has an event handler for research_finished which I could adapt. Currently it enables the recycling recipe every time the 'real' recipe research is complete.

I started working in IT when 32K of memory was a MASSIVE amount. It's hard to get past the idea that I must occupy memory with a bunch of recipes that are never used.
Yeah that's not very efficient and on another note, there is probably the issue that this is not multiplayer compatible.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by DRY411S »

Yes that too. Maybe I should just publish 3 different versions :)

User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by Arch666Angel »

DRY411S wrote:Yes that too. Maybe I should just publish 3 different versions :)
Or just add a config and do it in the data phase :D

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by DRY411S »

Arch666Angel wrote:
DRY411S wrote:Yes that too. Maybe I should just publish 3 different versions :)
Or just add a config and do it in the data phase :D
Except that means the users unzipping and editing. I don't like it. The data code already does 'require' from a config file though.

User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by Arch666Angel »

DRY411S wrote:
Arch666Angel wrote:
DRY411S wrote:Yes that too. Maybe I should just publish 3 different versions :)
Or just add a config and do it in the data phase :D
Except that means the users unzipping and editing. I don't like it. The data code already does 'require' from a config file though.
What I did: Create trigger mods, so the main mod will change configs depending on which trigger mod is active and they can be switched on and off in the mod menu. the trigger mod only really needs an empty table which you can check in the main mod.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by DRY411S »

Good tip thank you. Which of your mods use this approach so I can take a look?

User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by Arch666Angel »

DRY411S wrote:Good tip thank you. Which of your mods use this approach so I can take a look?
The ore mod uses this system, did come with it because I found no other way to detect RSO mod.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 703
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [MOD 0.12.33+]Recycling Machines

Post by DRY411S »

Arch666Angel wrote:
DRY411S wrote:Good tip thank you. Which of your mods use this approach so I can take a look?
The ore mod uses this system, did come with it because I found no other way to detect RSO mod.
So I understand the logic (in your infinite ores data.lua), but I don't understand where the 'triggers' are being set . Could you help me understand please?

Locked

Return to “Mods”