[MOD 0.12.x] Equalizer chests v1.4.0

Topics and discussion about specific mods
Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

[MOD 0.12.x] Equalizer chests v1.4.0

Post by Boogieman14 »

*NOTE* Version for Factorio 0.13 and up can be found in the mod portal!


So I made my first mod :)



This mod will provide 48-slot chests that will 'connect' with their direct neighbours and balance ("equalize") the contents of these chests (think Communicating vessels). My personal use case for this will be with train unloaders, where the chests furthest from the middle of the wagon don't receive nearly as much materials as the center chest.

This mod only deals with itemcounts, so no effort is made to balance individual items. There's also a lower threshold of 10 items below which no items will be transfer (this to avoid ping-ponging stuff back and forth).

I haven't tested it extensively yet, but some basic testing showed no obvious problems. I think it should be MP-safe.

As of 0.11.2, the scripting now also works when the chest was placed by a robot.

Of course, I welcome any tips and suggestions for improvement :)

You're welcome to include this mod in any modpacks, provided you include a link to this forum post whenever you publish the pack.

Updated for 0.12.0
The update for 0.12.0 has only been tested briefly, no extensive playthroughs have been done with it yet (but all the basic functionality appears to work: placing, balacing, removing, destroying). I have not tested this at all in MP and no provisions have been made yet for different forces.
acknowledgement
version history
Blue coloured icons provided by Turtle.


0.12.11+:
Equalizer_Chests_1.1.4.zip
For 0.12.11 and later
(17.56 KiB) Downloaded 1424 times
for older versions of Factorio
Last edited by Boogieman14 on Wed Jul 12, 2017 2:03 pm, edited 12 times in total.
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7351
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by bobingabout »

Sounds useful, but for barely more than that one specific purpose that you mentioned. But for that purpose, it could be quite invaluble.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by Boogieman14 »

Yeah, that's probably true for many specific mods like this. I'm pretty sure I'll enjoy the benefits though, and if nothing else, it's been a nice learning experience :)
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by TheSAguy »

Hey Boogieman14,

I was very exited to see this!

This sounds a lot like the mod I suggested/requested here: https://forums.factorio.com/forum/vie ... =33&t=6251

I'm not sure why you're "equalize" the content over the different chests, all that's needed is that two adjacent chests become one container.

I'm glad for this though and will definitely give it a try.

atehxx
Inserter
Inserter
Posts: 30
Joined: Sat Jun 21, 2014 9:35 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by atehxx »

I didn't use this yet but checked source and is this ok?:

Code: Select all

--game.onevent(defines.events.onpreplayermineditem, removedEntity)
--game.onevent(defines.events.onrobotpremined, removedEntity)
--game.onevent(defines.events.onentitydied, removedEntity)
You don't seem to check for removed chests atm.

Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by Boogieman14 »

TheSAguy wrote: all that's needed is that two adjacent chests become one container.
I suspect your "all that's needed" may actually be a lot more complicated than it sounds :) Especially when you want the flexibility you're describing of being able to add (and presumably removed) containers at will. This mod will leave each container as a standalone unit that interfaces with its neighbours. So it doesn't become one big inventory.
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by Boogieman14 »

atehxx wrote:I didn't use this yet but checked source and is this ok?:

Code: Select all

--game.onevent(defines.events.onpreplayermineditem, removedEntity)
--game.onevent(defines.events.onrobotpremined, removedEntity)
--game.onevent(defines.events.onentitydied, removedEntity)
You don't seem to check for removed chests atm.
Yes, that's actually ok :) I guess i might as well remove that bit, because it isn't needed. Removal makes the entity invalid (entity.valid = false), all the code that interacts with chests checks for that valid flag, and in the tick-loop, if the entity is invalid, it gets removed at that moment. As far as I can think of, nothing else is needed for removal.
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13171
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by Rseding91 »

Looks nice. I downloaded the mod to see how you where handling the detection of new chests (and ticking of the chests) only to read the first two lines of the control.lua file and get a giant grin across my face :D

I don't see any issues with the logic you've got setup - nice mod :)
If you want to get ahold of me I'm almost always on Discord.

atehxx
Inserter
Inserter
Posts: 30
Joined: Sat Jun 21, 2014 9:35 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by atehxx »

Boogieman14 wrote: Yes, that's actually ok :) I guess i might as well remove that bit, because it isn't needed. Removal makes the entity invalid (entity.valid = false), all the code that interacts with chests checks for that valid flag, and in the tick-loop, if the entity is invalid, it gets removed at that moment. As far as I can think of, nothing else is needed for removal.
Right... I got to that part of code later... :) I guess I no longer need to create my tiny mod with long&narrow boxes anymore :P

User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by SHiRKiT »

Let's come up with a possible scenario:
I have line setup of 10 chests.
I only input to 8 of them.
Only pull from 4 of them.

Let's say that after inputting some items, I stop doing so, and items are only being pulled out of 4 chests at random. What would happen in that case?

Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by Boogieman14 »

Test it and let me know ;)

You'd probably end up with 4 empty chests (well, that one's for sure) and 6 chests with a number of items in it. The exact numbers depend on the distribution of the extraction inserters. If they're all at one end of the line, the other chests will contain between 1 and 60 items. If they're evenly distributed, the leftovers will all be in the 1-10 range, I think.
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

KrzysD
Long Handed Inserter
Long Handed Inserter
Posts: 61
Joined: Mon Oct 27, 2014 6:49 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by KrzysD »

Bug report; if you put blueprints in they will be cleared.

Would it be to much to ask for Equalizing Passive Provider Chest? 8-)

Thanks for the useful mod :D

Kane
Filter Inserter
Filter Inserter
Posts: 666
Joined: Fri Sep 05, 2014 7:34 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by Kane »

Seems to work well. Any chance of seeing future logistic versions of these chests?

Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by Boogieman14 »

KrzysD wrote:Bug report; if you put blueprints in they will be cleared.
That's interesting. Blueprints probably have some special properties that the code doesn't take into account. I'll have to look into it, although not sure I'll spend too much time trying to fix this as it seems such a fringe case :)
Would it be to much to ask for Equalizing Passive Provider Chest? 8-)
That should be possible, although not sure if/when I'll get around to it as I've been taking a break from Factorio (so much to do, so little time :lol: )
Thanks for the useful mod :D
Glad you like it :)
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

Turtle
Fast Inserter
Fast Inserter
Posts: 240
Joined: Sat May 31, 2014 9:45 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by Turtle »

Thanks for this mod. I find it invaluable at train stations. I got sick of accidentally making these chests instead of regular steel chests though, so I tinted some steel chests with a blue-ish tint:
equalizer-chest.png
equalizer-chest.png (5.74 KiB) Viewed 20428 times
Equalizer_Chests_1.0.0.zip
Download
(16.48 KiB) Downloaded 368 times
The only part of the code changed is the pathing for the images.
@Booggieman14 - Please let me know if you don't approve and I'll take it down, otherwise feel free to update your first post.

Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by Boogieman14 »

Awesome, I never got around to doing that myself, even though I ran into the problem myself a few times in my latest game :oops: I've added it to the first post, thanks :)
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by TheSAguy »

I use your chest as a buffer at my Iron and Copper smelting stations.
I haul in great volumes of ore and store them in the chests.

The ore goes in tat the top as fast as I can get it. (Normally the belts are full, I just had an alien attack take down my power)

Image

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by TheSAguy »

Hey Boogieman14,

I thought of an upgrade to your chests. Quantum Chests!
They will work like underground belts. You build them in pairs and they stay connected, but can span a distance underground. The distance can be increased by upgrading, like underground belts.

Boogieman14
Filter Inserter
Filter Inserter
Posts: 770
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by Boogieman14 »

Cool layout, hadn't thought of using them like that ;)

As for the quantum chests, I seem to remember I've seen something like that already. Or maybe those were remote inserters or something like that. I probably won't make something like that, as I feel this kind of "teleportation" doesn't really fit in the setting of the game. Equalizer chests work by physically handing stuff over to adjecent chests.
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.

buder5
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Apr 26, 2014 4:31 am
Contact:

Re: [Mod 0.11.x] Equalizer chests v1.0.0

Post by buder5 »

any plan for factorio 0.12 ?

Post Reply

Return to “Mods”