read contents of single train car?

Things that already exist in the current mod API
Post Reply
Tym
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Fri Feb 10, 2017 4:55 pm
Contact:

read contents of single train car?

Post by Tym »

perhaps i've missed this, but is there a method to retrieve the contents of a single train car? From what i've seen/read, the 'full inventory' stat is applied against the entire set of train cars.

I'm envisioning a train stop that unloads -per-car-, thus enabling a train unloading station for longer trains; rather than creating a station for a specific set of cars, in a two-up, three-up, or four-up configuration. Ideally, i'd like to be able to run a train of 'n' cars, unloading 'm' cars at a time, and process the entire train in chunks, if you will.

quyxkh
Smart Inserter
Smart Inserter
Posts: 1028
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: read contents of single train car?

Post by quyxkh »

You can get the wagon inventory from the wagon entity as usual and a constructed dictionary of the train inventory from the wagon's train (get_{item,fluid}_contents, I'm pretty sure there isn't a normal inventory entity for the train as a whole) edit: whoops, just get_contents for items, get_fluid_contents for fluids.

Post Reply

Return to “Already exists”