LuaTrain.go_to_station()
Posted: Mon Oct 15, 2018 7:42 pm
Exactly what it looks like - a function to call on a LuaTrain to send it to a given station.
Code: Select all
/c _=game.player.selected.train _.schedule={current=1,records={{station='NE Iron Plate'}}} _.manual_mode=false
No, because I am not interested in deleting the train's normal schedule.quyxkh wrote: Tue Oct 16, 2018 1:56 am Doesdo what you want?Code: Select all
/c _=game.player.selected.train _.schedule={current=1,records={{station='NE Iron Plate'}}} _.manual_mode=false
Will the new station appears into the ScheduleRecords array?
See, https://lua-api.factorio.com/0.17.0-pre ... to_station - the station is given by a schedule index, so it must already be in the schedule.Fractaliste wrote: Tue Jan 15, 2019 4:07 pm Will the new station appears into the ScheduleRecords array?
Yes but it's on the C++ side so you don't have to do what the post further up is doing: copying the entire schedule, setting automatic mode etc.Optera wrote: Tue Jan 15, 2019 5:06 pm Isn't this implementation the same as setting the current schedule record?
e.g. if you know you want to send it to the 2nd station in the schedule records:
train.schedule.current = 2
Is was this way I initially understand the new LuaTrain.go_to_station() functionnality.Optera wrote: Tue Jan 15, 2019 6:05 pm This function would be really sleek if it took a backer_name as parameter.
Set the index to the corresponding entry or add a new entry for it, potentially with additional parameter taking an list of WaitCondition in case a new entry is generated.
And it was how I intended it.Fractaliste wrote: Thu Jan 17, 2019 1:55 pmIs was this way I initially understand the new LuaTrain.go_to_station() functionnality.Optera wrote: Tue Jan 15, 2019 6:05 pm This function would be really sleek if it took a backer_name as parameter.
Set the index to the corresponding entry or add a new entry for it, potentially with additional parameter taking an list of WaitCondition in case a new entry is generated.