Merging Chests

by Atria

Enables merging of multiple chests into one entity. Supports merging of arbitrary number of chests (configurable in mod settings). Version 5.0.0 introduced potentially breaking changes for old saves. If your have chests larger than 42 don't update to 5.0.0.

Content
a month ago
0.13 - 1.1
99.7K
Storage

i logistic version

5 years ago

How about making logistic chests mergeable? I really like to be able to have chests of any size in my factory makes my life much easier, and a logistic version would be great!
Anyway thanks for this mod, it's a must-have in my games

5 years ago

There were a lot of suggestion to do that but I still don't know if I should implement that.

Easiest way of doing it is already implemented and that is letting people decide which type of chest they want to be mergable. But that only works for one type of chest. Doing it for multiple chests would require significant change of code to be able to merge them. And there is also number types of entities that would be created at startup. There are a lot of them as it is with area chests (I'm talking about thousands to tens of thousands separate entity types). There is already problem with accidental massive load times, which I would like to avoid.

And there is also my subjective opinion that making logistic chests mergable would be too cheaty.

5 years ago

one type of the logistic chest is a good way to go, i don't think making the purple and the red chests merging together is necessary, can't imagine the scene^^

5 years ago

No, I meant allowing to merge only one type of chest in one save file. Only Logistic requester and nothing else...ok only passive providers and nothing else.

5 years ago

Given how powerful merging chests already is, I don't think that's a problem. Besides, merging storage chest doesn't really get you anything, the bots handle putting things in free chests. Same with active providers, having separate ones isn't too big a deal because the bots are always going to do their best to keep it empty. Mering passive providers though, that can be useful since it's the one chest type you're likely to be inserting stuff into en masse like you might with a big combined steel chest.

5 years ago
(updated 5 years ago)

I did some very minor hacking and got passive providers to merge and they appear to be working. Of course they still look like a big steel chest due to the graphics provided but it does indeed seem to work okay. All I did was add the passive provider chest to the options, and make sure the type is logistic-container instead of just container of 'passive provider chest' was selected in the option, and everything else just... worked. I was surprised at how easy that was.

5 years ago

Yes, but now you can merge only passive providers. If I'd implement logistics chest merging the next request would be to implement merging of all chest types at the same time.

5 years ago

Oh no doubt. That was mostly meant as a bone to throw to folks that perhaps want to provide a pull request to add the functionality. The more I thought about it on the drive into work this morning I realized that for the use case I have in mind isn't significantly helped by just having a bigger box since logi bots automatically solve problems such as even consumption or delivery of items with how I'm building my train stations anyway. So in short, it's certainly possible, and with a decent chunk of work they could all be supported, but in the end it isn't as useful as I first thought anyway. It was an interesting dive into some fairly complicated code in any case and I learned some more about lua in the process especially on what looks like some strange variable scoping. Even if I don't end up using it how I thought I would, I do thank you for you work on this mod anyway.

4 years ago
(updated 4 years ago)

You can add support of all chests with warning about RAM eating and possible incompabilities incase of unlimited chest size, so if someone want to use alot of chests at same time - he would better limit their size. As example Rampant mod got warning like this.

4 years ago

But as chests saved to globals that also can get into terrifying savefile size, so idk really, but infact that would be nice to have steel, wood and iron chests at same time for earlier game

4 years ago

But as chests saved to globals that also can get into terrifying savefile size, so idk really, but infact that would be nice to have steel, wood and iron chests at same time for earlier game

4 years ago
(updated 4 years ago)

It's not as easy as flipping the switch, if I want to support all chests at the same time I'll need some logic that searches for chests of same type to merge.

4 years ago

Loop? Some kind of case's or states, of if-else block style. I see what you are talking about, but thats kinda generic task.

4 years ago

A way to do it cleanly, which would not require massive rewrite of code is to include chest type name in its merged variant. But that would break all previous save because I can't find if it is possible migrate all merged chests to their correct new name. I'll check some more if it really is impossible. If it would be possible I may actually implement it.

Then there is a messy way of doing it. Holding data about all merged chests in global state but that would explode the save file size, as you said, as well as require me to rewrite a lot of the merging code.

4 years ago

Sure, i understand the backstage. Thats at your own. I use your mod allmost from the start and glad that it works atleast how it is :3

New response