Brainstorming: 3-state filtering of inventory slots

Place to get help with not working mods / modding interface.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1652
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Brainstorming: 3-state filtering of inventory slots

Post by Pi-C »

Autodrive is supposed to add logistic abilities to cars. We do that by placing a hidden requester and a hidden active provider chest on top of the vehicle, and transferring the requested/provided items into the respective chests when a car is parked within the area covered by roboports.

Currently, everything that is in a filtered slot will be regarded as request until the slot contains a complete stack of the item, while all items that are not in a filtered slot will be provided. I've succeeded to get this working in my WIP version. However, this solution has a serious disadvantage: I can only set two states (requested/provided), but I actually need three (requested/provided/ignored). So I've had the idea to use virtual signals instead and generated two virtual signals (request/provide) for each item that is the result of at least one recipe. Needless to say, I realized that this doesn't work either because only item signals can be used as inventory slot filters -- there's no way to use virtual signals. (Actually, I still could use my virtual signals when setting the requested/provided items via the circuit network, but that's a different story.)

One might think that two slot states would be enough if items that should be kept simply were requested. This will work -- in the crude way logistic behavior is implemented at the moment. The purpose of Autodrive is that you can automate transportation with cars, so you could let them bring supplies to some outpost and get products in exchange. To be really useful, you'd have to be able to drop off supplies and pick up products at an outpost, then return to the main base, drop off the products and pick up new supplies. The solution would be to filter (mark as request) supply slots at A, and invert the filters (remove them from filtered slots + add filters to the other slots) at B. However, this would also remove the filters from the stacks that should be kept, so they would be provided at B. Defining the first X slots as "never provided" also wouldn't work because the inventory of modded cars could vary drastically. (There could be prototypes with just one or two inventory slots, so ignoring the first 5 slots would be too much; but if there are 200 slots available, this wouldn't be enough -- think of big tanks with, say, 8 fuel slots and 5 guns.)

Well, I hope you have some suggestions how I could cope with this! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Modding help”