Updated 13 october 2017
Slightly modified the layout. It is now compatible with the awesome Grid Rails book by /u/kythzu.
I was looking for a safe level crossing but couldn't find anything that was good enough for me. What I found was either buggy or still allowed me to cross when there was a train approaching.
So I built this.
Advantages
- red/green lights announce trains
- no train can cross while a player is inside
- no player can cross when a train is announced
- trains can always stop for you
- you can make it relatively safe in multiplayer
- compatible with the awesome Grid Rails book by /u/kythzu
How it works
I'm not sure that I need it but I used an RS latch to "lock" the crossing so that no train can ever enter it while there's a player inside. The latch is set when the player approaches to crossing, but only when no trains are announced. The latch is reset when the player leaves the crossing.
The rail signals are open unless the RS latch is set. The gates are synchronised and the gates on the track prevent you from accidentally getting on the tracks.
Left side / right side
I'm from Belgium. Trains drive on the left side here so that's what I built. It is however very easy to modify the blueprint for right sided driving: just create new signals on the other sides of the tracks, hook up a red logic wire, copy the logic from the old signal to the new one and then remove the old one.
Multiplayer
I mentioned multiplayer. I also mentioned trains can always stop. This is of course only true when it's an automatically running train. You can still drive a train and ignore every signal. This only matters in multiplayer so suppose some maniac is driving the train, the only thing you can really do is get enough advance warning so you can GTFO ASAP.
You can do this by hooking up more rail signals further up the track and setting them to read, then change the red output signal to 'T'. This will lock the crossing and turn on the red lights as soon as a train enters that track segment. If you still don't have enough time to get out just hook up another signal. Don't change the green and yellow output signals though, this could lock down your crossing too soon (or always if you set green to 'T').
