Page 1 of 1

[2.0.37] LuaSchedule::add_record can not add permanent rail stops

Posted: Fri Feb 28, 2025 3:24 am
by hgschmie
(not sure if this is a bug or an API limitation)

Adding a temporary rail stop:

Code: Select all

> for i = 1, train_schedule.get_record_count() do print(serpent.line(train_schedule.get_record{ schedule_index = i })) end
(nil)
> train_schedule.add_record { rail = rail, temporary = true }
(nil)
> for i = 1, train_schedule.get_record_count() do print(serpent.line(train_schedule.get_record{ schedule_index = i })) end
{allows_unloading = true, created_by_interrupt = false, rail = "[LuaEntity: legacy-straight-rail at [gps=227.0,-1.0]]", temporary = true, wait_conditions = {{compare_type = "and", ticks = 300, type = "time"}}}
(nil)
Doing the same thing for a permanent stop:

Code: Select all

> for i = 1, train_schedule.get_record_count() do print(serpent.line(train_schedule.get_record{ schedule_index = i })) end
(nil)
> train_schedule.add_record { rail = rail }
(nil)
> for i = 1, train_schedule.get_record_count() do print(serpent.line(train_schedule.get_record{ schedule_index = i })) end
{allows_unloading = true, created_by_interrupt = false, station = "", temporary = false, wait_conditions = {}}
(nil)
The created record will not work (there is no stop called ""). This should either error out, or not add a record.

Re: [2.0.37] LuaSchedule::add_record can not add permanent rail stops

Posted: Fri Feb 28, 2025 1:33 pm
by Rseding91
See 127180 which will be able to do that. I have no idea what will break by doing that but we'll find out I guess :)