Skip to content
Snippets Groups Projects

ATL timetable information system

Timetable information system for Minetest railway stations using advtrains lua automation tools

This repository contains all the boilerplate and example code required to run a multi-station train schedule information system, as used on the minetest.kif.rocks server. Consisting of one environment initialisation code, defining the base data structure and a lot of functions, and short snippets to paste into ATC rails or controllers, it is optimized to be easily deployable to many stations without copying too much code around.

How it works

The environment defines data structures for the lines and which platform they stop at when coming from a certain direction (S.lines). They are intended to form a single source of truth about which train lines exist and where they are to expect in each station. Besides the lines the environment also specifies which stations exist consisting of which platforms (S.stations). While this information is barely used in the code, it forms a useful reference when filling out the S.lines table and counts towards the idea of a single source of truth.

Besides these stationary tables S.arrivals is dynamically build up and cleared out whenever a train comes near or leaves a station. For each station it contains information about which line that came from which direction (entry point) will stop at which platform (calculated from S.lines) and whether the train is expected, currently at the platform, or has already departed (but not left the station area yet). This table can then be used to display arrivals on information systems.

S.arrivals is updated from ATC rails at the platform and further away from the station, which each use a single line to pass the station, entry point or platform and all relevant variables to the environment defined function.