This is a space for me to list my musings and findings, so I don't forget anything important.
There will need to be two different branches in the global structure: a working copy with a lot of temporary data, and the result section that the GUI uses. For the other events, they will not do anything at the time they are fired, but they will add data to the working table that will be processed on the next LTN update cycle.
__lualib
data
flags
players
[index]
flags
dictionary
gui
working_data
This table is what the GUI will read.
depots
available_trains (int)
num_trains (int)
stations
(array of station_id)
trains
(array of train_id)
stations
[station_id]
-- from LTN
activeDeliveries,
entity,
input,
output,
lampControl,
errorCode,
isDepot,
network_id,
maxTraincars,
minTraincars,
trainLimit,
provideThreshold,
provideStackThreshold,
providePriority,
requestThreshold,
requestStackThreshold,
requestPriority,
lockedSlots,
noWarnings,
parkedTrain,
parkedTrainID,
parkedTrainFacesStop,
-- added by us
trains
(array of train_id)
provided
(dictionary of name -> count)
requested
(dictionary of name -> count)
status
name (string)
count (int)
inventory
provided
[network_id]
(dictionary of name -> count)
requested
[network_id]
(dictionary of name -> count)
in_transit
[network_id]
(dictionary of name -> count)
trains
[train_id]
-- common
force
train
network_id
state
-- en route
from
to
started
shipment
(dictionary or name -> count)
-- parked at the depot
capacity
fluid_capacity
surface
-- returning to depot
returning_to_depot (boolean)
history
(TBD)
alerts
(TBD)
-- lookup tables - included in output
network_to_stations
(dictionary of network_id -> array of train_id)
material_locations
[material_name]
stations
(array of station_id)
trains
(array of train_id)
-- working data - excluded from output
provided_by_stop
requested_by_stop
deliveries
available_trains
station_ids
num_stations
-- iteration data - excluded from output
step (int)
index (int)
This table is also used to set the default contents of the GUI when created.