Page 1 of 1

How to make an inventory that incudes the exact contents (slot by slot) in blueprints?

Posted: Thu Apr 18, 2024 7:05 pm
by mrvn
I'm working on a crafting combinator and currently am stuck at support for modules.

Currently the crafting combiantor has a chest containing modules in a user defined order, one module per slot. When setting a recipe the combinator simply tries to insert modules in the order they are in the chest. When removing a recipe the modules are put back into the chest in the order they are in the assembler into any free slots. Overall this means the order of the modules in the chest remains the same.

This allows the user to place productivity modules first in the chest and the crafting combinator will use them whenever possible. When not it will keep going and use any efficiency or speed modules later in the chest.


Now here comes the problem:

When I make a blueprint of the assembler and crafting combinator then the assembler gets an item-request-proxy for the inserted modules. For the chest I have to add my own item-request-proxy. That gets me the right number of modules but in a random order.

How do I go about preserving the order the modules should be in.

PS: one untried idea I have is to use a cargo wagon instead of a chest and set item filters to lock in the order of modules. I want one module per slot so I only need the order, not any count per slot.

Re: How to make an inventory that incudes the exact contents (slot by slot) in blueprints?

Posted: Fri Apr 19, 2024 4:46 am
by Pi-C
Did you already consider script inventories? They can be resized if necessary, and you can loop over the slots just like it was a common inventory, so it is possible to preserve order.

Re: How to make an inventory that incudes the exact contents (slot by slot) in blueprints?

Posted: Fri Apr 19, 2024 6:14 am
by mrvn
Pi-C wrote:
Fri Apr 19, 2024 4:46 am
Did you already consider script inventories? They can be resized if necessary, and you can loop over the slots just like it was a common inventory, so it is possible to preserve order.
How would the user interact with that inventory?
How would the blueprint include the contents of that inventory?
How would bots place modules into that inventory after blueprinting?

Creating an inventory is not the problem. The chest entity already has one. It's the contents that's the problem in blueprints.