Logistic Wagon

by folk

Adds a new kind of train cargo wagon that connects to the logistic system in weird and mysterious ways.

Content
14 days ago
0.14 - 2.0
286
Logistics
Owner:
folk
Source:
https://github.com/folknor/factorio-l...
Homepage:
https://forums.factorio.com/viewtopic...
License:
CC-BY-NC 4.0
Created:
7 years ago
Latest Version:
0.2.10 (14 days ago)
Factorio version:
0.14 - 2.0
Downloaded by:
286 users

Logistic Wagon

I got so tired of trying to find a way to keep my outposts stocked! This is my solution. It adds a new cargo wagon that acts like a magical logistic chest. It will seem complicated at first, but once you "get it", it makes sense :-)
Please note when you read step 1 and 2 that stack sizes are configurable per station/wagon.

Step 1: Train with Logistic Wagon stops at a station in automatic mode

Each Logistic Wagon looks to its immediate 4 spots for a logistic chest of either type. If it finds none, it acts like a normal wagon. If it finds 1 or more chests, it acts on each chest individually in random order.

It can act on the same chest type more than once at the same stop.

Note that the list below is not in prioritized order; again like I said above, the chests are processed in random order.

1.1 Storage (yellow)

Dumps as much as possible of the wagons non-filtered inventory into it.

1.2 Passive Provider (red)

If the wagon is filtered, inserts enough items into the chest so that the chest has one full stack of each filtered item.

1.3 Active Provider (purple)

Does one of 2 things, either;

A. If the chest is completely blocked by a red bar, it dumps all of the wagons non-filtered inventory into the chest (treats it like a yellow chest) and then reapplies the full red bar
- or -
B. If the chest is not red-barred, and the wagon is filtered, it inserts as many items as the logistic network the chest belongs to is missing in order to reach one stack of each filtered item (so if the entire local logistic network contains 60 ammunition clips, it will insert 40, if the ammunition stack size is 100).

1.4 Requester (blue)

Does one of 2 things, either;

A. If the blue chest is completely blocked by a red bar, it removes the red bar so that the chest can be filled up by whatever system is in place (inserter or bot puts empty barrels for example - for dumping into the wagon back to base). Obviously you need to preconfigure some logistic requests in the chest for anything you want to dump.
- or -
B. If the wagon is filtered, and the chest has any item request that is set to zero (any item, like empty barrel), it will modify the request to satisfy all filtered slots in the wagon (fill up with ammo and stuff at the base). It will only request enough items to fill up the wagons filtered slots (and remember stack size is configurable, so if you filter 4 slots for ammo and override the stack size of ammo to 5, it will request at most 20.)

Step 2: The train leaves the station

2.1 Storage (yellow)

Ignored.

2.2 Passive Provider (red)

All contents of all passive provider chests are fully loaded into the wagon, until the wagon is full. Ignores all filters, simply grabs everything.

2.3 Active Provider (purple)

Ignored.

2.4 Requester chests (blue)

Does one of two things, either:

A. If the chest had a red bar when the train stopped, it grabs everything in the chest and reapplies the red bar.
- or -
B. Otherwise, if the wagon is filtered, and there is any item request set to non-zero, it zeroes the request. Then, grabs enough items from the chest to fill the wagons filtered slots.

Stack size configuration

Multiple wagons connected to the same train act independently on their chests, and can have different stack size configurations.

If a Logistic Wagon finds a constant combinator with any parameter set in one of the 4 chest spots, it uses the parameters in that CC for determining stack sizes of each item type it handles during that stop, if they are set.

The combinators do not have to be connected to anything.

The addon comes with a few preconfigured stack sizes at the top of control.lua, explicitly overriding the game data on these items. Currently, they are:

["gun-turret"] = 5
["laser-turret"] = 5
["flamethrower-turret"] = 5
["logistic-robot"] = 5
["construction-robot"] = 5
["repair-pack"] = 15

If you want to load up your wagons with 50 gun turrets (per filtered slot), you need to put down a CC and override this.
In prioritized order, the wagons determine/read stack sizes from: (1) attached constant combinator, (2) control.lua, (3) game defaults.

If you configure stack size overrides, they must be set per-wagon, per-station.
So, hopefully to make that clear; the combinator configurations are not saved for other stops in the schedule, or for other wagons in the same train. They are independent per station and wagon. So if you at the depot set up a gun-turret stack size of 50, it will still use 5 as the stack size when it reaches the other stations in its schedule. Unless you override it there as well.

How-to Guides

How to: Stock outposts with items X/Y/Z

  1. In your base, make a station and put a requester chest immediately next to the middle of the Logistic Wagon (take a look at the green squares in the screenshot above). Set a request slot in the chest to X/Y/Z with a value of 0. The maximum value is irrelevant.
  2. In the Logistic Wagon, filter slots for X/Y/Z.
  3. Send the wagon in automatic mode to the station you made, and set it to wait for 120 seconds or however long you think it will take your bots to fill the chest (remember the requests are set when the train arrives, so it depends how far the bots have to travel, etc).
  4. At your outpost, put down an active provider chest (immediately next to the middle section of where the wagon will be) and make sure it's inside the grid of a roboport with at least 1 logistic bot. Or use belts/inserters if you want.
  5. Send the train to the outpost in automatic mode and set it to wait there for however long you want. Immediately when it arrives, it will read the contents of the logistic network of the active provider chest and make sure to dump as much of its filtered inventory into the chest so that the network has a total of 1 stack of each filtered item.

How to: Remove items from outposts (empty barrels, excess alien artifacts, etc)

  1. At the outpost, put down a requester (blue) chest in one of the 4 spots that connect to the Logistic Wagon (look at the screenshots above). Set requests in the chest for items you want to dump (10x Empty Barrel, 500x Alien Artifact, etc)
  2. Fill the requester chest inventory with the red bar completely (click the X in the inventory and drag it to fill the entire inventory). When the train arrives, it will remove the red bar, and when it leaves the station it will grab everything in the chest and reapply the red bar.
  3. At the home base, set a filter inserter to unload per item type into whatever you want and set the filters appropriately.

How to: Use the Logistic Wagon as a normal wagon with a few filtered slots

The Logistic Wagon has 48 slots, compared to the 40 slots in the normal cargo wagon.

  1. At your depot or unloader station, put down one request chest with a zero-item request in a spot like on the screenshots. Either use filtered inserters to unload the wagon or put down a storage (yellow) chest. Inserters are faster because you have 11 spots remaining for inserters on the wagon but on the storage chest there are only 3.
  2. Filter a few slots in the Logistic Wagon for whatever items you want to bring out to the outpost.
  3. At the outpost, either put down an active provider chest, or a passive provider chest, depending on what you want to happen, in one of the 4 positions, and use inserters to fill the rest of the wagon with ore. Or passive provider chests (which the wagon will grab when it leaves), but then you can only have 3-4 of them as buffers to load from as opposed to 11 with inserters.

How to: Clean the wagons inventory at the depot

  1. Put down an active provider (purple) chest and fully apply a red bar to it.
  2. When the wagon arrives, it will remove the red bar, dump all non-filtered wagon contents into it, and reapply the red bar.
    You can also use storage chests, but the problem with these is that bots will load stuff into them so it might not be empty when the train wants to dump contents.

Changelog

Moved to the changelog tab above/changelog.txt ingame.