A few comments:
- LuaSchedule::add_record should either return the index at which the record was inserted *or* have a parameter that allows defining where the record goes in the schedule. Currently I do
Code: Select all
schedule.add_record { ... }
local index = schedule.get_record_count() -- last index is the new record
schedule.drag_record(index, desired_index) -- move record around
- add_wait_condition and change_wait_condition
Currently, add_wait_condition adds a generic "WaitConditionType" record, which then subsequently needs to be modified. So my code looks like this:
Code: Select all
schedule.add_wait_condition({ schedule_index = index }, 1, 'inactivity') -- see https://forums.factorio.com/viewtopic.php?t=127153
schedule.change_wait_condition({ schedule_index = index }, 1, { type = 'inactivity', ticks = number_of_ticks, })
- retrieving the schedule is hard compared to the old API:
Code: Select all
local records = {}
local record_count = schedule.get_record_count()
if record_count then
for i = 1, record_count, 1 do
table.insert(records, schedule.get_record { schedule_index = i })
end
end
return records