Dual Rail Planner

by Envian

Gives a rail planner which can place two directional rails.

Utilities
5 months ago
2.0
502
Trains

g Swappable Left/Right Placement

5 months ago

Love the idea, this looks really useful!
Have you considered allowing the user to swap the side the track is placed, so they can make the sharp left/right turns?

5 months ago

I did look into "moving" the rail planner as a player is placing it, however (from what I could find in the documentation) this is not possible. The planner that places long stretches of track is completely inaccessible to the LUA api. The most I can do with it is add a rail item to the player's cursor, and remove it when I want the planner to be cancelled.

I did also float the idea of switching sides if you make a turn too sharp, so that after a sharp left turn your planner is on the "left" hand side of the track. However I found a few problems with this:

  1. It adds a lot of complexity to the code base.
  2. Its complex to use since you need to be aware of which side you are currently building.
  3. It can result in unexpected behavior if you are planning a long path.
  4. It won't help in many scenarios, such as U turns.

While I haven't looked into if this would work, I did also consider making use of the legacy 45° turn rails that cannot be normally added any more since they can make turns 2 tiles (1 rail width) tighter. I decided against this though, since it doesn't solve all the problems, and the factorio devs have said they plan on dropping support in the future.

Unfortunately I don't think the problem of sharp turns can be solved with a mod - at least with the current API, while maintaining an easy to use interface. My best bet as a mod author is to mitigate the issue, where I have a few plans in the pipeline. Alternatively, maybe I can convince the factorio devs to make the two lane planner a standard feature that doesn't allow for sharp turns. Honestly that'd be great.

5 months ago

I should add - I do plan to add support for left hand drive, so the "opposite" rail is added to the right of the placed track. While this is a bit down the pipeline, I hadn't considered that this could help with sharp left turns (or long left turns along a lake / other geological feature), so I'll keep this in mind when diving down that rabbit hole.

5 months ago

Been using this in a modded play-through without major issue so far. Do you think it would be possible for the planner mark trees and rocks close to and between the rails for deconstruction?

5 months ago

Hey, glad to hear you aren't having any issues.

While clearing out trees and rocks around the rails isn't completely outside the scope of what I may do with this mod, its definitely a low priority at this time.

New response