Extends the AdminBridge GameScript JSON channel (the same relay used by list_vehicles/get_timetable) with station support: - list_stations(): enumerate stations, fire-and-forget like list_vehicles(). - get_station(): authoritative per-cargo snapshot of a station's live state, with both the real-time waiting amount (GSStation.GetCargoWaiting) and the planned cargodist link-graph flow (GetCargoPlanned), plus rating. - get_station_cargo(): break one cargo type down by source station and by next hop (the cargodist routing destination) for both waiting and planned amounts, with optional from_station/via_station filters. All three use stock GameScript API (no server patch, unlike timetables). Refactors the shared GS request/reply correlation out of get_timetable and get_station into a _gs_query() helper. Companion handlers must be added to the server-side AdminBridge GameScript (not tracked in this repo). Includes unit + e2e tests, a worked demo in main_admin.py, and protocol docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Internal Package: openttd
This directory contains the core implementation of the OpenTTD network client.
Modules
__init__.py: Exposes the high-levelOpenTTDClientAPI.client.py: Implementation of theOpenTTDClientclass. Manages the connection lifecycle, PAKE state, map synchronization, and keep-alive.protocol.py: Implementation of theOpenTTDProtocolclass. Handles low-level binary packet serialization, AEAD stream encryption, and static packet parsing.
Design Goals
- Encapsulation: The user should never need to manually handle bytes or encryption keys.
- Robustness: Gracefully handle server errors and unknown packet types.
- Efficiency: Use
asynciofor non-blocking I/O andmonocypherfor fast cryptographic operations.