This is an old revision of the document!
Add a system of choosing which doors to open on a train.
Currently, all doors change on a train when given a command to change door state, but this may not be the intended behaviour in a short station.
For a real-life example of needing to choose doors, take the DLR, where some stations are too short to accommodate the full length of the train. To open doors on carriages not aligned to the platform would be very dangerous as bleary-eyed commuters with their eyes on their phone would fall onto the track and may:
The problem above is very serious and could lead to a lawsuit causing a Minetest server to be taken down for not caring for its players. As such, 56i proposes door indexes. A simple addition to an ATC command can help prevent needless death.
When writing a door command, optionally an index can be added, which has two units: Carriages (C) or metres (D). The index and unit go side by side.
Take for example the command OL20D
. This instructs the train to open the Left doors until index 20 in metres. This means, in other words, all doors on the train open left until 20 m down the train, where the doors are not changed from their current state.
Keeping a door command on its own (OL
) acts upon the entire train, ensuring backwards compatibility.
The carriage index is similar to the distance index, but acts upon carriage numbers, opening doors until a specific carriage down the train.
Station tracks are tightly linked to this proposal. Station tracks often control the doors, and it is prudent to modify them.
Station tracks issue an ATC command to open the doors, but check the number of platform nodes opposite of the track direction and use that as the distance index to act upon. The command is OCOxyD
for the opening doors part, where x is the side and y is the number of platform nodes.
Here is one possible algorithm for the door index:
This relies on a carriage index algorithm existing, but this should be relatively simple to implement by copying some code and writing some others, given that trains need to count their carriages for the train_length()
LuaATC command.