[MOD 0.12.35] Logistics Railway 1.0.8

Topics and discussion about specific mods
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

[MOD 0.12.35] Logistics Railway 1.0.8

Post by Supercheese »

Logistics Railway
Rails.png
Rails.png (208.63 KiB) Viewed 40944 times
Animated Example - Large Image
Check out the Mod Spotlight by Xterminator for a video demonstration of the mod's mechanics.

Info / Long Description:
Tech.jpg
Tech.jpg (721.25 KiB) Viewed 40944 times
This mod allows you to load/unload your trains using your logistics robots! You don't need to change your trains at all -- simply replace some of your normal rail segments with one of the types of special Logistics Rails and any cargo wagon that stops on those rails will be automagically converted into a Logistics Wagon of the associated type. Then you can remove your inserters and chests and use only bots!
For example: If a wagon stops on top a Passive Provider rail, then its contents will be provided directly to the logistics network just like a passive provider chest.
You can, additionally, determine visually when a regular wagon becomes a Logistics Wagon when its alt-view cargo icons shrink in size.
In order to use Requester Rails, click them to set the logistics requests for any wagon that stops on top of them. You can, of course, copy/paste between Requester Rails just like with regular Requester Chests.
You can even use Requester Rails to automatically fuel up your locomotives! Please be careful to only request valid fuel items into locomotives, as all non-fuel items that cannot be inserted into locomotives will be destroyed. Also note that locomotives cannot use the other three types of rail.

The recipe for all Logistics Rails is merely a single regular rail piece, and when you remove a Logistics Rail, you receive a regular rail, for maximum flexibility.
If this recipe seems to cheap to you, it can be changed in the configuration file.

Known Issues/Quirks:
Any time a Cargo Wagon becomes a Logistics Wagon, its inventory is dumped into a separate invisible entity, and it is in fact that entity that interacts with the logistics network.
When its inventory has been given to the other entity, the wagon's regular inventory is emptied and you are prevented from inserting/removing items by hand, unless you manually stop the train.

Requester Rails have a dummy item (control panel icon) auto-inserted on creation. This allows them to have logistics requests set but not actually request any items until a wagon comes along.
Please do not remove the control panel item. You needn't concern yourself with it, as it will be properly dealt with by the mod code.

Sadly it seems that you cannot quick-replace regular rails with Logistics Rails, but you can rotate the logistics rails by 90° and then place them over the existing rails, then re-place them in the proper orientation.
Replacing rails
Logistics rails can only be placed horizontally or vertically. You really wouldn't want to make a diagonal loading/unloading station anyway... would you?
It is possible to get stuck in a diagonal building mode, however, if you grab some regular Straight Rails, rotate them diagonally, then immediately grab some Logistics Rails.
If this happens to you, fret not, for if you try to place a Logistics Rail diagonally, the mod will automatically return you to orthoganal rail placement.
You are also not allowed to place ghost-diagonals of Logistics Rails.

While regular Straight Rails can overlap, Logistics Rails cannot.

This mod is NOT compatible with other mods that introduce logistics wagons such as 5dim Trains. It is, however, compatible with Bob's mods, Stainless Steel Wagon, and other such wagon mods that don't use control.lua.

I was originally inspired to make this mod by a conversation on IRC between Afforess and Fatmice. Props to you guys for coming up with the idea!
I also extend thanks to TheAIBot for simplifying some duplicated code segments.
Thanks to Choumiko, Logistics Railway is now compatible with Smart Trains (v0.3.77 or greater)!
See the readme for more details and credits.

Please report bugs, should you find any. Enjoy the botswarms. ;)
Version history
Attachments
Logistics Railway_1.0.8.zip
(57.26 KiB) Downloaded 3042 times
Logistics Railway_1.0.7.zip
(54.49 KiB) Downloaded 1400 times
Last edited by Supercheese on Tue Jun 07, 2016 11:43 pm, edited 21 times in total.
Yinan
Fast Inserter
Fast Inserter
Posts: 131
Joined: Sun Feb 14, 2016 2:40 pm
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.0

Post by Yinan »

This sounds absolutely awesome!
I'm gonna have to try it out right when I come back from work today ^^
Mythbrion
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Mar 13, 2016 9:15 am
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.0

Post by Mythbrion »

Awesome idea, I try to avoid inserters wherever possible. :P
CmdrKeen
Long Handed Inserter
Long Handed Inserter
Posts: 98
Joined: Tue Sep 29, 2015 9:03 pm
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.0

Post by CmdrKeen »

Any time a Cargo Wagon becomes a Logistics Wagon, its inventory is dumped into a separate invisible entity, and it is in fact that entity that interacts with the logistics network.
When its inventory has been given to the other entity, the wagon's regular inventory is emptied, and any changes to its regular inventory will not interact with the logistics network.
When the train begins moving again, the invisible entity's inventory is given back to the wagon. However, if the wagon's regular inventory has filled up during this time, any items from the invisible entity will be lost, as the wagon has run out of space.
Although you shouldn't be using any inserters on Logistics Wagons, if there are inserters present, they could accidentally insert items that could be destroyed.
As such, any inserters in the vicinity of Logistics Wagons are automatically disabled in order to prevent this. They are re-enabled when the train begins moving again.
Also, please refrain from manually placing any items into wagons that are on top of Logistics Rails, as this may cause you to lose items if the wagon becomes too full.
you might try

Code: Select all

entity.minable = false 
enity.operable = false 
when the cargo wagons are stationary, and set them back to true when the train starts moving today.
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.1

Post by Supercheese »

CmdrKeen wrote:you might try

Code: Select all

entity.minable = false 
enity.operable = false 
when the cargo wagons are stationary, and set them back to true when the train starts moving today.
Excellent suggestion, I've implemented this in version 1.0.1. This, together with using setbar(0), nicely obviates the need for the forced inserter-disabling.
User avatar
Xterminator
Filter Inserter
Filter Inserter
Posts: 981
Joined: Sun Jun 15, 2014 4:49 pm
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.1

Post by Xterminator »

Man, yet another great mod from you! :D This is a brilliant idea, and makes stations so much cleaner and easier to set up if you are using bots. I am most definitely doing a spotlight on this right away.
Keep up the great work!
Image Image Image
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.1

Post by Supercheese »

Xterminator wrote:Man, yet another great mod from you! :D This is a brilliant idea, and makes stations so much cleaner and easier to set up if you are using bots. I am most definitely doing a spotlight on this right away.
Keep up the great work!
I look forward to it. :)
Outsider
Fast Inserter
Fast Inserter
Posts: 115
Joined: Sat Jan 10, 2015 12:23 am
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.1

Post by Outsider »

I Love the fact that you used rails instead of wagons for this, an awesome idea ;)
Advanced Logistics System - Provides a detailed view of your logistics network and the items within it
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.1

Post by Supercheese »

Outsider wrote:I Love the fact that you used rails instead of wagons for this, an awesome idea ;)
Yep, this way you don't have to change your trains at all, just your stations. :)
Yinan
Fast Inserter
Fast Inserter
Posts: 131
Joined: Sun Feb 14, 2016 2:40 pm
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.1

Post by Yinan »

The only downside have have found so far is that you can't mix them up.
So you either need two stations, one for unloading and one for loading, or you need to do different behaviour for the different wagons and change that from station to station.
rclarke
Manual Inserter
Manual Inserter
Posts: 3
Joined: Thu Mar 03, 2016 4:37 pm
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.2

Post by rclarke »

When I load this mod, It creates the issue where the regular pieces are not able to cross any more.

I have just loaded it into a previous save, so that might be the issue. I can understand the logic rails having these properties, but I dont think it should be happening to the vanilla pieces. Awesome mod otherwise though. ;) Image
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.2

Post by Supercheese »

Ah yes, a bug indeed. That will be fixed in version 1.0.3. Thanks for the report! :)
User avatar
bigyihsuan
Filter Inserter
Filter Inserter
Posts: 299
Joined: Thu Jan 01, 2015 12:57 pm
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.2

Post by bigyihsuan »

For the blue item in the Requester Track, could you have it be a little control panel? It makes more sense, and it's a little detail that could be a really cool.
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.2

Post by Supercheese »

bigyihsuan wrote:For the blue item in the Requester Track, could you have it be a little control panel? It makes more sense, and it's a little detail that could be a really cool.
That's a good idea, I'll see if I can grab a suitable graphic.
Delmain
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Aug 15, 2014 10:39 pm
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.3

Post by Delmain »

Welp, I tried everything I could think of, and I think I have a bug that I have no idea how to track down.

I'm a programmer, but not a lua programmer, so I'm pretty sure I've missed something rather obvious.

In my game, Logistics Railways (any kind) will not work with the third cargo wagon in a chain. I've tried up to four. One, Two, and Four work fine, but Three is just ignored no matter what happens.

I can provide a save and the list of mods I'm currently using, but I can't for the life of me figure this out. I apologize, I am awful at Lua. I tried unpacking and throwing some debugging statements around using write_file and serpent, but I couldn't get any useful data to show up. I'm certain I was just doing it wrong, but who knows.

The save should load up with a little ring with two stops and a train circling it. One stop has 4 requester rails, and the other has a line of active provider rails. On each pass, the first, second, and fourth wagon are loaded, then emptied by bots, and the third is left alone.

E: It's not a clean save. It's my entire base, with a little test area on the bottom. I'm hoping that's not the issue.
Attachments
mods.txt
Mods List
(468 Bytes) Downloaded 255 times
qweasdasfdsf.zip
Save Showing Issue
(7.31 MiB) Downloaded 204 times
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.3

Post by Supercheese »

Delmain wrote:Welp, I tried everything I could think of, and I think I have a bug that I have no idea how to track down.

I'm a programmer, but not a lua programmer, so I'm pretty sure I've missed something rather obvious.

In my game, Logistics Railways (any kind) will not work with the third cargo wagon in a chain. I've tried up to four. One, Two, and Four work fine, but Three is just ignored no matter what happens.

I can provide a save and the list of mods I'm currently using, but I can't for the life of me figure this out. I apologize, I am awful at Lua. I tried unpacking and throwing some debugging statements around using write_file and serpent, but I couldn't get any useful data to show up. I'm certain I was just doing it wrong, but who knows.

The save should load up with a little ring with two stops and a train circling it. One stop has 4 requester rails, and the other has a line of active provider rails. On each pass, the first, second, and fourth wagon are loaded, then emptied by bots, and the third is left alone.

E: It's not a clean save. It's my entire base, with a little test area on the bottom. I'm hoping that's not the issue.
I see the issue, your third wagon there is perched in such a position that it lies exactly between the collision_boxes of the two requester rails and their invisible dummy chests, in such a place that the find_entity command isn't locating the requester rail beneath it. I've fixed this by increasing the size of the collision boxes.
Thanks for the bug report, I'll push version 1.0.4 shortly with the fix. :)
Delmain
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Aug 15, 2014 10:39 pm
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.4

Post by Delmain »

I kind of thought that was the problem, but I couldn't get serpent.block to print anything useful about the wagons, train, or railways themselves when I was trying to debug.

Thanks!
Delmain
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Aug 15, 2014 10:39 pm
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.4

Post by Delmain »

Yeah, I suspected that when I saw that the Oil Tanker Wagon mod's author had to create two connection points so that it would reliably find a pump next to the wagon.

I guess this is another strange artifact of cargo wagons not being a multiple of a piece of rail's length?
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.4

Post by Supercheese »

Delmain wrote:I guess this is another strange artifact of cargo wagons not being a multiple of a piece of rail's length?
It's more because the wagon can have a location off-grid (e.g. {44.011684, 11.5877}) while rails can only have an on-grid location (e.g. {44,12}).
In any event, hopefully the chances of errors similar to the one posted should now be very, very small.
Delmain
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Aug 15, 2014 10:39 pm
Contact:

Re: [MOD 0.12.26] Logistics Railway 1.0.4

Post by Delmain »

Isn't that mostly because a wagon + connection distance isn't an integer? Doesn't particularly matter because your fix covers the issue anyway.

Image

Dat overlapping collision box.

Thanks for the fix!
Post Reply

Return to “Mods”