[0.17.39][API request] Access stopped train (or nil) from train stop entity
Posted: Wed May 15, 2019 4:38 pm
Hi,
Imagine I have a train stop entity and I want to know if a train is stopped at the station, and if so, I want the LuaTrain.
As of now, starting from the entity I have to do this:
Kind regards
lovely_santa
Imagine I have a train stop entity and I want to know if a train is stopped at the station, and if so, I want the LuaTrain.
As of now, starting from the entity I have to do this:
- TrainStopEntity.connected_rail
- RailEntity.trains_in_block
- If it has an amount > 0; search the surface around it to find a loco/cargo/arty/fluid wagon
- TrainEntity.train to extract the train
- Check if the train is in the station (schedule), or just happen to be stopped (eg. in manual) next to the stop
Kind regards
lovely_santa