Can not add a temp stop to a train schedule without losing the train group
Posted: Thu Feb 13, 2025 2:50 am
according to FFF-389, it is possible to modify the schedule of a train within a train group by adding a temp stop without affecting the train group as a whole:
So any changes to the schedule of one member of the group will update the whole group. Importantly, this ignores the temporary stops, as they are part of the state of the individual trains (so hijacking a train to chauffeur you somewhere won't break anything).
In code, there is the TrainSchedule object which is part of the LuaTrain. It contains an array of ScheduleRecord elements (records). But this does not work:
The record array is not modified. Probably because it is some fancy interface into the engine. The only thing that works is creating a copy of train.schedule, modify the schedule and re-assign it to the train.schedule attribute. But now the train group is gone (because the train has a new schedule so it is no longer part of the train group).
This seems to be a bug/limitation. I would have expected to be able to insert temporary stop records into a train schedule without losing the train group. Alternatively, assign a new schedule and as long as it contains only temp stop differences, the train would still be in the train group.
So any changes to the schedule of one member of the group will update the whole group. Importantly, this ignores the temporary stops, as they are part of the state of the individual trains (so hijacking a train to chauffeur you somewhere won't break anything).
In code, there is the TrainSchedule object which is part of the LuaTrain. It contains an array of ScheduleRecord elements (records). But this does not work:
Code: Select all
table.insert(train.schedule.records, train.schedule.current + 1, my_fancy_temp_record)
This seems to be a bug/limitation. I would have expected to be able to insert temporary stop records into a train schedule without losing the train group. Alternatively, assign a new schedule and as long as it contains only temp stop differences, the train would still be in the train group.