summaryrefslogtreecommitdiff
path: root/il_timetable
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-04-22 14:52:38 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-04-22 14:52:38 +0200
commitcfa65d94f1bc9d9e9efe13791711a9ad044a4a67 (patch)
treebdecc9982a58cb88367e4e8b1fcd9cfa1f95573e /il_timetable
parentf3da24b214b3337ad63ebd885da29d5b789d4738 (diff)
downloadluaatc_envs-cfa65d94f1bc9d9e9efe13791711a9ad044a4a67.tar.gz
luaatc_envs-cfa65d94f1bc9d9e9efe13791711a9ad044a4a67.tar.bz2
luaatc_envs-cfa65d94f1bc9d9e9efe13791711a9ad044a4a67.zip
State at 2021-04-04
Diffstat (limited to 'il_timetable')
-rw-r--r--il_timetable/init_code.lua453
-rw-r--r--il_timetable/nodes/(-1023,21,-108).lua1
-rw-r--r--il_timetable/nodes/(-1023,21,-150).lua1
-rw-r--r--il_timetable/nodes/(-1023,21,-190).lua1
-rw-r--r--il_timetable/nodes/(-1023,21,-88).lua1
-rw-r--r--il_timetable/nodes/(-1477,9,-83).lua29
-rw-r--r--il_timetable/nodes/(-1481,3,1160).lua10
-rw-r--r--il_timetable/nodes/(-2091,9,-4569).lua1
-rw-r--r--il_timetable/nodes/(-640,14,-426).lua3
-rw-r--r--il_timetable/nodes/(1103,23,3014).lua8
-rw-r--r--il_timetable/nodes/(1103,23,3027).lua8
-rw-r--r--il_timetable/nodes/(1106,19,3007).lua6
-rw-r--r--il_timetable/nodes/(1106,23,1943).lua9
-rw-r--r--il_timetable/nodes/(1107,16,1951).lua5
-rw-r--r--il_timetable/nodes/(142,8,164).lua1
-rw-r--r--il_timetable/nodes/(1524,21,2656).lua4
-rw-r--r--il_timetable/nodes/(159,11,846).lua28
-rw-r--r--il_timetable/nodes/(1604,-1,7982).lua10
-rw-r--r--il_timetable/nodes/(1618,-1,7982).lua10
-rw-r--r--il_timetable/nodes/(1725,28,2912).lua1
-rw-r--r--il_timetable/nodes/(1730,26,2915).lua12
-rw-r--r--il_timetable/nodes/(1730,26,2926).lua5
-rw-r--r--il_timetable/nodes/(1734,26,2922).lua10
-rw-r--r--il_timetable/nodes/(1899,19,8223).lua4
-rw-r--r--il_timetable/nodes/(1932,8,9112).lua19
-rw-r--r--il_timetable/nodes/(1936,7,9131).lua11
-rw-r--r--il_timetable/nodes/(1953,19,8220).lua4
-rw-r--r--il_timetable/nodes/(1971,5,7353).lua8
-rw-r--r--il_timetable/nodes/(1973,42,8384).lua9
-rw-r--r--il_timetable/nodes/(1973,5,6132).lua8
-rw-r--r--il_timetable/nodes/(1976,5,7914).lua8
-rw-r--r--il_timetable/nodes/(1977,3,7354).lua4
-rw-r--r--il_timetable/nodes/(1980,3,6129).lua4
-rw-r--r--il_timetable/nodes/(1980,3,7922).lua4
-rw-r--r--il_timetable/nodes/(1980,41,8381).lua5
-rw-r--r--il_timetable/nodes/(1980,41,8395).lua10
-rw-r--r--il_timetable/nodes/(2648,13,4352).lua4
-rw-r--r--il_timetable/nodes/(286,4,206).lua27
-rw-r--r--il_timetable/nodes/(767,10,3484).lua10
-rw-r--r--il_timetable/nodes/(790,8,-109).lua5
-rw-r--r--il_timetable/nodes/(941,18,-571).lua5
-rw-r--r--il_timetable/nodes/(957,14,1047).lua6
-rw-r--r--il_timetable/nodes/(960,14,1067).lua3
-rw-r--r--il_timetable/nodes/(972,14,1053).lua5
44 files changed, 777 insertions, 3 deletions
diff --git a/il_timetable/init_code.lua b/il_timetable/init_code.lua
index 313075b..e44819e 100644
--- a/il_timetable/init_code.lua
+++ b/il_timetable/init_code.lua
@@ -37,4 +37,455 @@ end
function F.timedisplay()
digiline_send("time", "Time: | "..rwt.to_string(rwt.now(),true).." | "..os.date("%H:%M:%S"))
schedule(rwt.next_rpt(rwt.now(),5,0), "")
-end \ No newline at end of file
+end
+
+-- Stat counter and timetaking utilities
+-- Stat from subway
+F.stat=function(line, init)
+--statistics
+-- init
+if init then
+reftrain = atc_id
+a_tbt = 30
+a_tbtmax = 30
+a_rtt = 500
+a_not = 0
+c_not = 0
+c_tbtmax = 0
+time_lt = os.time()
+time_rt=os.time()
+end
+if not a_tbtmax then a_tbtmax = 30 end
+if not c_tbtmax then c_tbtmax = 0 end
+--real code
+if event.train then
+local time = os.time()
+c_not = c_not + 1
+a_tbt = (a_tbt + (time - time_lt)) / 2
+c_tbtmax = math.max(c_tbtmax, (time - time_lt))
+if atc_id == reftrain then
+ a_rtt = (a_rtt*0.2 + (time - time_rt)*0.8)
+ a_not = c_not
+ c_not = 0
+ a_tbtmax = (a_tbtmax + c_tbtmax) / 2
+ c_tbtmax = 0
+end
+ digiline_send("stats", "Stat: "..line..
+ " NoT:"..a_not.."("..c_not..")"..
+ " TbT:"..math.floor(a_tbt).."("..(time-time_lt)..")"..
+ " Tmx:"..math.floor(a_tbtmax).."("..c_tbtmax..")"..
+ " R:"..math.floor(a_rtt).."("..(time - time_rt)..")"
+ )
+time_lt = time
+if atc_id == reftrain then
+ time_rt = time
+end
+end
+end
+
+S.timetake = {}
+function F.timetake_start(ttname)
+ if not atc_id then return end
+ local nouw = rwt.to_secs(rwt.now())
+ if not S.timetake[ttname] then
+ S.timetake[ttname] = {}
+ end
+ S.timetake[ttname][atc_id] = nouw
+end
+
+--L100
+function F.timetake_end(ttname)
+ if not atc_id then return end
+ if not S.timetake[ttname] or not S.timetake[ttname][atc_id] then
+ digiline_send("timetake", "No start time for "..atc_id)
+ return
+ end
+ local first = S.timetake[ttname][atc_id]
+ local nouw = rwt.to_secs(rwt.now())
+ local tdiff = nouw - first
+ local cavg = S.timetake[ttname].avg
+ local cmax = S.timetake[ttname].max
+ local cmin = S.timetake[ttname].min
+ if cavg and cmax and cmin then
+ S.timetake[ttname].avg = tdiff*0.1 + cavg*0.9
+ S.timetake[ttname].min = math.min(tdiff, cmin)
+ S.timetake[ttname].max = math.max(tdiff, cmax)
+ else
+ S.timetake[ttname].avg = tdiff
+ S.timetake[ttname].min = tdiff
+ S.timetake[ttname].max = tdiff
+ end
+ digiline_send("timetake", ttname..
+ " this:"..tdiff..
+ " min:"..math.floor(S.timetake[ttname].min)..
+ " avg:"..math.floor(S.timetake[ttname].avg)..
+ " max:"..math.floor(S.timetake[ttname].max)
+ )
+
+end
+
+--== Timetable prototype (TTP) ===
+--[[ table structures:
+F.ttp - static timetable data - see below
+S.ttp[tt_name] = { - dynamic tt data
+ recording_train = <id of the train that is recording travel times, or nil>
+ travel_times = {
+ <station name> = <time in seconds from initial departure at first station of the line to departure at this station>
+ }
+ station_order = { <station 1>, <station 2>...}
+}
+S.ttt[train_id] = { - trains
+ timetable = <timetable ID that the train is currently using>,
+ initial_dep = <departure at first station of the line>,
+ location = <Station where the train was last seen>,
+ desired_dep = <Departure time as in timetable>,
+ planned_dep = <real departure time calculated as the train reaches station>,
+ actual_dep = <actual departure time at last station. is nil while train is stopped>,
+ last_delay = <last known delay of the train - calculated every departure>,
+ }
+}
+]]
+
+local STOP_TIME = 10
+local DEPCMD="A1OCD1SM"
+local RDEPCMD="RA1OCD1SM"
+
+if not S.ttp then S.ttp = {} end
+if not S.ttt then S.ttt = {} end
+F.ttp={
+ CFE_N = {
+ outside_text = "[CFE] Warmoneaye\nvia Ehlodex, Personhood West, Crystal Farms",
+ inside_line_desc = "CFE to Warmoneaye",
+ stn_display = "CFE Warmoneaye",
+ },
+ CFE_S = {
+ outside_text = "[CFE] Origin\nvia Crystal Farms, Personhood West, Ehlodex",
+ inside_line_desc = "CFE to Origin",
+ stn_display = "CFE Origin",
+ },
+ NRG_E = {
+ outside_text = "[NRG] Azena Transirejo",
+ inside_line_desc = "NRG to Azena Transirejo",
+ stn_display = "NRG Azena Transirejo",
+ },
+ NRG_W = {
+ outside_text = "[NRG] New Roses Gardens",
+ inside_line_desc = "NRG to New Roses Gardens",
+ stn_display = "NRG New Roses Gardens",
+ },
+ NX_S = {
+ outside_text = "[NX] Trisiston\nvia Personhood West, Ehlodex, South Forest, Melinka",
+ inside_line_desc = "NX to Trisiston",
+ stn_display = "NX Trisiston",
+ },
+ E1_S = {
+ outside_text = "[E1] Melinka\nvia The Cube, Ehlodex, Spawn Main, Mom Junction",
+ inside_line_desc = "E1 to Melinka",
+ stn_display = "E1 Melinka",
+ },
+ testing = {
+ outside_text = "[testing] Sued via Mitte",
+ inside_line_desc = "[testing] Sued",
+ },
+
+}
+
+--[[
+Timetable entry point. The train finalizes its last timetable and
+registers itself on the given timetable instance. It departs at the next time slot
+(given by interval and offset).
+F.ttp_begin({
+ stn = "Warmoneaye", -- station name
+ tt = "CFE_S", -- timetable ID
+ depint = "05;00", --departure slot interval
+ depoff = "00;00", --departure slot offset
+ doorside = "L",
+ reverse = true,
+ only_lines = nil, --if given a table, only trains where only_lines[get_line()] is true are considered
+ force_tt_reset = false, -- force reset of travel times for this timetable
+})
+]]
+-- Make train depart at the next time slot, and save its start time
+function F.ttp_begin(p)
+ __approach_callback_mode = 1
+
+ if not F.ttp[p.tt] then error("No TT instance "..p.tt) end
+ if not atc_id or not atc_arrow then return end
+ if p.only_lines and not p.only_lines[get_line()] then return end
+ if not S.ttp[p.tt] then S.ttp[p.tt] = {} end
+ local tti = S.ttp[p.tt]
+--L150
+ if event.approach and not event.has_entered then
+ -- make the train stop
+ atc_set_ars_disable(true)
+ atc_set_lzb_tsr(2)
+ atc_set_text_inside("Next stop: "..p.stn.."\nTerminal Station.\nThis train continues as "..F.ttp[p.tt].inside_line_desc)
+ end
+ if event.train then
+ -- train arrived, planning departure
+ atc_send("B0 W O"..p.doorside)
+
+ local time_now = rwt.now()
+ -- Train might have had another TT before, do the cleanup from ttp_end here.
+ local trno = S.ttt[atc_id]
+ if trno then
+ local ttio = S.ttp[trno.timetable]
+ if ttio.recording_train == atc_id then
+ ttio.travel_times[p.stn] = rwt.diff(trno.initial_dep, time_now)
+ ttio.station_order[#ttio.station_order+1] = p.stn
+ end
+ end
+ local next_dep_time = rwt.next_rpt(rwt.add(time_now, 10), p.depint, p.depoff)
+ schedule(next_dep_time, "departure")
+ S.ttt[atc_id] = {
+ timetable = p.tt,
+ initial_dep = next_dep_time,
+ location = p.stn,
+ desired_dep = next_dep_time,
+ planned_dep = next_dep_time,
+ last_delay = 0,
+ }
+ -- if no travel times are available yet, set this train as recording
+ if not tti.travel_times or p.force_tt_reset then
+ tti.travel_times = {}
+ tti.station_order = {p.stn}
+ tti.recording_train = atc_id
+ elseif tti.recording_train == atc_id then
+ tti.recording_train = nil
+ end
+ atc_set_text_outside(F.ttp[p.tt].outside_text)
+ atc_set_text_inside(p.stn.."\nAa: "
+ ..rwt.to_string(time_now, true).." Da: "
+ ..rwt.to_string(next_dep_time, true))
+ end
+ if event.schedule then
+ -- departure. save actual departure time in tt
+ S.ttt[atc_id].actual_dep = rwt.now()
+ local delay = rwt.diff(S.ttt[atc_id].desired_dep, S.ttt[atc_id].actual_dep)
+ atc_set_text_inside(F.ttp[p.tt].inside_line_desc
+ .."\nDelay:"..rwt.to_string(delay, true))
+ S.ttt[atc_id].last_delay = delay
+ if p.reverse then
+ atc_send(RDEPCMD)
+ else
+ atc_send(DEPCMD)
+ end
+ end
+end
+--[[
+Generic stop on timetable. Any train that has a TT instance registered
+stops here, waits STOP_TIME and continues. Behavior can be altered by options:
+F.ttp_stop({
+ stn = "Personhood West", -- station name
+ doorside = "L",
+ only_lines = nil, --if given a table, only trains where only_lines[get_line()] is true are considered
+ end_of_tt = { TT_ID = true },
+ -- if present and key is true for a TT identifier, this is the last station on this timetable. Trains will stop recording timetable and be deregistered.
+ departure = { TT_ID = RWT relative to initial departure }
+ -- If present, override desired departure time. Defaults to travel time + STOP_TIME if not provided
+})
+]]function F.ttp_stop(p)
+ -- set my approach callback mode
+ __approach_callback_mode = 1
+ if not atc_id or not atc_arrow then return end
+ if not S.ttt[atc_id] then return end
+ if p.only_lines and not p.only_lines[get_line()] then return end
+ local trn = S.ttt[atc_id]
+ local tt = trn.timetable
+ if not F.ttp[tt] then
+ S.ttt[atc_id] = nil
+ end
+ local tti = S.ttp[tt]
+ if event.approach and not event.has_entered then
+ -- make the train stop
+ atc_set_ars_disable(true)
+ atc_set_lzb_tsr(2)
+ atc_set_text_inside("Next stop: "..p.stn)
+ end
+ if event.train then
+ -- train arrived, planning departure
+ atc_send("B0 W O"..p.doorside)
+ local time_now = rwt.now()
+ -- update our location and determine desired and planned departure
+--L200
+ local next_dep_time = rwt.add(time_now, STOP_TIME)
+ trn.location = p.stn
+ trn.desired_dep = nil
+ trn.actual_dep = nil
+
+ -- calculate desired departure nouw
+ if p.departure and p.departure[tt] then
+ trn.desired_dep = rwt.add(trn.initial_dep or 0,
+ p.departure[tt])
+ elseif tti.travel_times[p.stn] then
+ trn.desired_dep = rwt.add(trn.initial_dep or 0,
+ tti.travel_times[p.stn] + STOP_TIME)
+ end
+
+ if trn.desired_dep then
+ -- if we had a source for desired departure, update planned daparture time
+ if rwt.to_secs(next_dep_time) < rwt.to_secs(trn.desired_dep) then
+ -- don't depart before the planned departure time
+ next_dep_time = trn.desired_dep
+ end
+ atc_set_text_inside(p.stn.."\nAa "
+ ..rwt.to_string(time_now, true).." Dd"
+ ..rwt.to_string(trn.desired_dep, true).." Da"
+ ..rwt.to_string(next_dep_time, true))
+ else
+ atc_set_text_inside(p.stn.."\nAa "
+ ..rwt.to_string(time_now, true).." Dd ? Da"
+ ..rwt.to_string(next_dep_time, true))
+ end
+
+ if tti.recording_train == atc_id then
+ -- we are recording. save travel time
+ tti.travel_times[p.stn] = rwt.diff(trn.initial_dep or 0, time_now)
+ tti.station_order[#tti.station_order+1] = p.stn
+ atc_set_text_inside(p.stn.."\nRec TT "
+ ..rwt.to_string(tti.travel_times[p.stn], true).." Da"
+ ..rwt.to_string(next_dep_time, true))
+ end
+
+ trn.planned_dep = next_dep_time
+ schedule(next_dep_time, "departure")
+ end
+ if event.schedule then
+ -- departure. save actual departure time in tt
+ trn.actual_dep = rwt.now()
+ local delay = rwt.diff(trn.desired_dep or trn.actual_dep, trn.actual_dep)
+ atc_set_text_inside(F.ttp[tt].inside_line_desc
+ .."\nDelay:"..rwt.to_string(delay, true))
+ S.ttt[atc_id].last_delay = delay
+ atc_send(DEPCMD)
+ if p.end_of_tt and p.end_of_tt[tt] then
+ -- end of timetable. Deregister train
+ if tti.recording_train == atc_id then
+ tti.recording_train = nil
+ end
+ S.ttt[atc_id] = nil
+ end
+ end
+end
+
+
+function F.ttp_info_times(tt, starttime)
+ --L307
+ local ttf = F.ttp[tt]
+ local tti = S.ttp[tt]
+ local p = {}
+ if tti.recording_train then
+ p[#p+1] = ("recording "..tti.recording_train)
+ end
+ p[#p+1] = ("Di "..rwt.to_string(starttime, true).." "..tti.station_order[1])
+ for i=2,#tti.station_order do
+ local ap = rwt.add(starttime, tti.travel_times[tti.station_order[i]])
+ p[#p+1] = ("Ap "..rwt.to_string(ap, true)..
+ " Dp "..rwt.to_string(rwt.add(ap, STOP_TIME), true)..
+ " "..tti.station_order[i])
+ end
+ return p
+end
+function F.ttp_info_trains(tt, starttime)
+ --L307
+ local ttf = F.ttp[tt]
+ local tti = S.ttp[tt]
+ local p = {}
+ for tid,trn in pairs(S.ttt) do
+ if trn.timetable==tt then
+ if trn.actual_dep then
+ p[#p+1] = ("Trn "..tid..
+ " after "..trn.location..
+ " Dd "..rwt.to_string(trn.desired_dep, true)..
+ " Da "..rwt.to_string(trn.actual_dep, true)..
+ " Delay "..rwt.to_string(trn.last_delay))
+ else
+ p[#p+1] = ("Trn "..tid..
+ " at "..trn.location..
+ " Dd "..rwt.to_string(trn.desired_dep, true)..
+ " Delay "..rwt.to_string(trn.last_delay))
+ end
+ end
+ end
+ return p
+end
+
+
+
+--[[F.ttp_station_display({
+ lines = {"CFE_S", "NX_S", "E1_S"},
+ departure = {},
+ station = "The Cube",
+ title = "The Cube (Track 2)",
+ interval = 30,
+ display1 = "display1",
+ display2 = "display2",
+}]]
+function F.ttp_station_display(p)
+--L425
+-- { dep, text }
+local next_trains = {}
+local function is_past_station(tstn, stnorder)
+ for _,s in ipairs(stnorder) do
+ if s==p.station then return true end
+ if s==tstn then return false end
+ end
+ return true
+end
+local function add_train(deptime, line)
+ local tent = {dep = deptime, text =
+ rwt.to_string(deptime,true).." "..F.ttp[line].stn_display}
+ for i,ntrn in ipairs(next_trains) do
+ if rwt.diff(ntrn.dep, deptime)<0 then
+ table.insert(next_trains, i, tent)
+ return
+ end
+ end
+ table.insert(next_trains, tent)
+end
+
+for _,line in ipairs(p.lines) do
+ local fttp = F.ttp[line]
+ local sttp = S.ttp[line]
+ -- find all trains on this line
+ for id, train in pairs(S.ttt) do
+ if train.timetable == line then
+ if train.location == p.station and not train.actual_dep then
+ -- the train is currently standing at this station
+ add_train(train.planned_dep, line)
+ elseif not is_past_station(train.location, sttp.station_order) then
+ -- train is still approaching, calculate arrival time
+ local trav_dep = rwt.add(train.initial_dep, (sttp.travel_times[p.station] or 0) + STOP_TIME)
+ local act_dep = rwt.add(trav_dep, train.last_delay)
+ if p.departure and p.departure[line] then
+ local plan_dep = rwt.add(train.initial_dep, p.departure[line])
+ if rwt.to_secs(act_dep) < rwt.to_secs(plan_dep) then
+ act_dep = plan_dep
+ end
+ end
+ add_train(act_dep, line)
+ end
+ end
+ end
+end
+
+-- make output
+local i
+local text1 = p.title .. " * "..rwt.to_string(rwt.now(), true).." * "
+for i=1,3 do
+ if next_trains[i] then
+ text1 = text1 .. "\n".. next_trains[i].text
+ end
+end
+digiline_send(p.display1, text1)
+if p.display2 then
+ local text2 = ""
+ for i=4,7 do
+ if next_trains[i] then
+ text2 = text2 .. next_trains[i].text .. "\n"
+ end
+ end
+ digiline_send(p.display2, text2)
+end
+schedule_in(p.interval or 30,"foo")
+end
diff --git a/il_timetable/nodes/(-1023,21,-108).lua b/il_timetable/nodes/(-1023,21,-108).lua
new file mode 100644
index 0000000..51ee459
--- /dev/null
+++ b/il_timetable/nodes/(-1023,21,-108).lua
@@ -0,0 +1 @@
+F.ttp_stop("testing", "Mitte 1", "L") \ No newline at end of file
diff --git a/il_timetable/nodes/(-1023,21,-150).lua b/il_timetable/nodes/(-1023,21,-150).lua
new file mode 100644
index 0000000..ea2b0c2
--- /dev/null
+++ b/il_timetable/nodes/(-1023,21,-150).lua
@@ -0,0 +1 @@
+F.ttp_stop("testing", "Mitte 2", "L") \ No newline at end of file
diff --git a/il_timetable/nodes/(-1023,21,-190).lua b/il_timetable/nodes/(-1023,21,-190).lua
new file mode 100644
index 0000000..c524004
--- /dev/null
+++ b/il_timetable/nodes/(-1023,21,-190).lua
@@ -0,0 +1 @@
+F.ttp_end("testing", "Sued", "L", 2) \ No newline at end of file
diff --git a/il_timetable/nodes/(-1023,21,-88).lua b/il_timetable/nodes/(-1023,21,-88).lua
new file mode 100644
index 0000000..62a70b4
--- /dev/null
+++ b/il_timetable/nodes/(-1023,21,-88).lua
@@ -0,0 +1 @@
+F.ttp_begin("testing", "Nord", "01;00", "00;30", "L") \ No newline at end of file
diff --git a/il_timetable/nodes/(-1477,9,-83).lua b/il_timetable/nodes/(-1477,9,-83).lua
new file mode 100644
index 0000000..21d7954
--- /dev/null
+++ b/il_timetable/nodes/(-1477,9,-83).lua
@@ -0,0 +1,29 @@
+if event.train then
+st_name = "Shouwroom"
+flip = not flip
+end
+
+doors = "L"
+ if event.train then
+ local time_now = rwt.now()
+ local next_dep_time = rwt.next_rpt(rwt.add(time_now, 10), 240, 0)
+if flip then
+ atc_set_text_outside("4 - Schwarzschild Street")
+ digiline_send("monitor", "4 Schwarzschild St . "..rwt.to_string(next_dep_time, true))
+ set_rc("SC")
+else
+ digiline_send("monitor", "4 NYE Square "..rwt.to_string(next_dep_time, true))
+ atc_set_text_outside("4 - NYE Square")
+ set_rc("NY")
+end
+ atc_set_text_inside(st_name.."\nDeparture: "..rwt.to_string(next_dep_time, true))
+ atc_send("B0 W O"..doors)
+ schedule(next_dep_time, "depart")
+ elseif event.schedule then
+ atc_send("OCD1SM")
+ set_route("shrdep", "*")
+ digiline_send("monitor", "Last Departure: | "..rwt.to_string(rwt.now(), true))
+ atc_set_text_inside("")
+ depart = true
+ end
+-- \ No newline at end of file
diff --git a/il_timetable/nodes/(-1481,3,1160).lua b/il_timetable/nodes/(-1481,3,1160).lua
new file mode 100644
index 0000000..8055b7a
--- /dev/null
+++ b/il_timetable/nodes/(-1481,3,1160).lua
@@ -0,0 +1,10 @@
+if atc_arrow then
+if flip then
+ atc_set_text_outside("4 - Schwarzschild Street")
+ set_rc("SC")
+else
+ atc_set_text_outside("4 - NYE Square")
+ set_rc("NY")
+end
+flip = not flip
+end \ No newline at end of file
diff --git a/il_timetable/nodes/(-2091,9,-4569).lua b/il_timetable/nodes/(-2091,9,-4569).lua
new file mode 100644
index 0000000..293832f
--- /dev/null
+++ b/il_timetable/nodes/(-2091,9,-4569).lua
@@ -0,0 +1 @@
+F.stop_sd_sched("Melinka", "L", "RSM", 10, 120, 0)
diff --git a/il_timetable/nodes/(-640,14,-426).lua b/il_timetable/nodes/(-640,14,-426).lua
new file mode 100644
index 0000000..0a32291
--- /dev/null
+++ b/il_timetable/nodes/(-640,14,-426).lua
@@ -0,0 +1,3 @@
+if event.train then
+ F.timetake_end("E1-Psh-Ehl")
+end \ No newline at end of file
diff --git a/il_timetable/nodes/(1103,23,3014).lua b/il_timetable/nodes/(1103,23,3014).lua
new file mode 100644
index 0000000..0ea53b2
--- /dev/null
+++ b/il_timetable/nodes/(1103,23,3014).lua
@@ -0,0 +1,8 @@
+F.ttp_station_display({
+ lines = {"CFE_S", "NX_S"},
+ departure = {CFE_S="15;00", NX_S="02;30"},
+ station = "Personhood West",
+ title = "PH West - Track 4",
+ interval = 30,
+ display1 = "track4",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1103,23,3027).lua b/il_timetable/nodes/(1103,23,3027).lua
new file mode 100644
index 0000000..0ea53b2
--- /dev/null
+++ b/il_timetable/nodes/(1103,23,3027).lua
@@ -0,0 +1,8 @@
+F.ttp_station_display({
+ lines = {"CFE_S", "NX_S"},
+ departure = {CFE_S="15;00", NX_S="02;30"},
+ station = "Personhood West",
+ title = "PH West - Track 4",
+ interval = 30,
+ display1 = "track4",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1106,19,3007).lua b/il_timetable/nodes/(1106,19,3007).lua
new file mode 100644
index 0000000..ff8b71e
--- /dev/null
+++ b/il_timetable/nodes/(1106,19,3007).lua
@@ -0,0 +1,6 @@
+F.ttp_stop({
+ stn = "Personhood West",
+ doorside = "R",
+-- end_of_tt = {CFE_S=true, NX_S=true},
+ departure = {CFE_S="15;00", NX_S="02;30"},
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1106,23,1943).lua b/il_timetable/nodes/(1106,23,1943).lua
new file mode 100644
index 0000000..84a52d0
--- /dev/null
+++ b/il_timetable/nodes/(1106,23,1943).lua
@@ -0,0 +1,9 @@
+F.ttp_station_display({
+ lines = {"CFE_S", "NX_S", "E1_S"},
+ departure = {},
+ station = "The Cube",
+ title = "The Cube (Track 2)",
+ interval = 15,
+ display1 = "display1",
+ display2 = "display2",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1107,16,1951).lua b/il_timetable/nodes/(1107,16,1951).lua
new file mode 100644
index 0000000..1d7d775
--- /dev/null
+++ b/il_timetable/nodes/(1107,16,1951).lua
@@ -0,0 +1,5 @@
+F.ttp_stop({
+ stn = "The Cube",
+ doorside = "R",
+ end_of_tt = {CFE_S=true,NX_S=true,E1_S=true},
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(142,8,164).lua b/il_timetable/nodes/(142,8,164).lua
new file mode 100644
index 0000000..acced81
--- /dev/null
+++ b/il_timetable/nodes/(142,8,164).lua
@@ -0,0 +1 @@
+atc_set_text_outside("[CFE] Warmoneaye\nvia Ehlodex, Personhood West, Crystal Farms") \ No newline at end of file
diff --git a/il_timetable/nodes/(1524,21,2656).lua b/il_timetable/nodes/(1524,21,2656).lua
new file mode 100644
index 0000000..9b7580d
--- /dev/null
+++ b/il_timetable/nodes/(1524,21,2656).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "Personhood South",
+ doorside = "R",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(159,11,846).lua b/il_timetable/nodes/(159,11,846).lua
new file mode 100644
index 0000000..49e1131
--- /dev/null
+++ b/il_timetable/nodes/(159,11,846).lua
@@ -0,0 +1,28 @@
+if event.train then
+st_name = "Schwarzschild Street"
+set_line("4")
+flip = not flip
+end
+
+doors = "L"
+ if event.train then
+ local time_now = rwt.now()
+ local next_dep_time = rwt.next_rpt(rwt.add(time_now, 10), 120, 0)
+if flip then
+ atc_set_text_outside("4 - Showroom")
+ digiline_send("monitor", "4 Showroom "..rwt.to_string(next_dep_time, true))
+ set_rc("SH")
+else
+ digiline_send("monitor", "4 Ice Mountain "..rwt.to_string(next_dep_time, true))
+ atc_set_text_outside("4 - Ice Mountain")
+ set_rc("IM")
+end
+ atc_set_text_inside(st_name.."\nDeparture: "..rwt.to_string(next_dep_time, true))
+ atc_send("B0 W O"..doors)
+ schedule(next_dep_time, "depart")
+ elseif event.schedule then
+ atc_send("OCD1SM")
+ digiline_send("monitor", "Last Departure: | "..rwt.to_string(rwt.now(), true))
+ atc_set_text_inside("")
+ depart = true
+ end
diff --git a/il_timetable/nodes/(1604,-1,7982).lua b/il_timetable/nodes/(1604,-1,7982).lua
new file mode 100644
index 0000000..1326eab
--- /dev/null
+++ b/il_timetable/nodes/(1604,-1,7982).lua
@@ -0,0 +1,10 @@
+F.ttp_begin({
+ stn = "New Roses Gardens", -- station name
+ tt = "NRG_E", -- timetable ID
+ depint = "10;00", --departure slot interval
+ depoff = "01;30", --departure slot offset
+ doorside = "L",
+ reverse = true,
+ only_lines = nil,
+ force_tt_reset = false, -- force reset of travel times for this timetable
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1618,-1,7982).lua b/il_timetable/nodes/(1618,-1,7982).lua
new file mode 100644
index 0000000..c1b0bce
--- /dev/null
+++ b/il_timetable/nodes/(1618,-1,7982).lua
@@ -0,0 +1,10 @@
+F.ttp_begin({
+ stn = "New Roses Gardens", -- station name
+ tt = "NRG_E", -- timetable ID
+ depint = "10;00", --departure slot interval
+ depoff = "06;30", --departure slot offset
+ doorside = "R",
+ reverse = true,
+ only_lines = nil,
+ force_tt_reset = false, -- force reset of travel times for this timetable
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1725,28,2912).lua b/il_timetable/nodes/(1725,28,2912).lua
new file mode 100644
index 0000000..6c2907f
--- /dev/null
+++ b/il_timetable/nodes/(1725,28,2912).lua
@@ -0,0 +1 @@
+F.timedisplay() \ No newline at end of file
diff --git a/il_timetable/nodes/(1730,26,2915).lua b/il_timetable/nodes/(1730,26,2915).lua
new file mode 100644
index 0000000..44b483e
--- /dev/null
+++ b/il_timetable/nodes/(1730,26,2915).lua
@@ -0,0 +1,12 @@
+-- d_int: Departure every n seconds (epoch modulo)
+-- d_off: Departure time offset
+-- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off)
+F.stop_sd_sched("Personhood Main", "L", "RSM", 10, 120, 70)
+atc_set_text_outside("E1: Personhood <-> Spawn <-> Melinka Town")
+if event.train then
+ F.stat("E1", false)
+ F.timetake_end("E1-Ehl-Psh")
+end
+if depart then
+ F.timetake_start("E1-Psh-Ehl")
+end
diff --git a/il_timetable/nodes/(1730,26,2926).lua b/il_timetable/nodes/(1730,26,2926).lua
new file mode 100644
index 0000000..b2341c2
--- /dev/null
+++ b/il_timetable/nodes/(1730,26,2926).lua
@@ -0,0 +1,5 @@
+-- d_int: Departure every n seconds (epoch modulo)
+-- d_off: Departure time offset
+-- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off)
+atc_set_text_outside("E11 - Oasis")
+F.stop_sd_sched("Personhood Main Station", "R", "RSM", 10, 300, 0) \ No newline at end of file
diff --git a/il_timetable/nodes/(1734,26,2922).lua b/il_timetable/nodes/(1734,26,2922).lua
new file mode 100644
index 0000000..36913b1
--- /dev/null
+++ b/il_timetable/nodes/(1734,26,2922).lua
@@ -0,0 +1,10 @@
+F.ttp_begin({
+ stn = "Personhood Main", -- station name
+ tt = "E1_S", -- timetable ID
+ depint = "02;30", --departure slot interval
+ depoff = "00;00", --departure slot offset
+ doorside = "R",
+ reverse = true,
+ only_lines = { E1 = true },
+ force_tt_reset = false,
+})
diff --git a/il_timetable/nodes/(1899,19,8223).lua b/il_timetable/nodes/(1899,19,8223).lua
new file mode 100644
index 0000000..c07fbb8
--- /dev/null
+++ b/il_timetable/nodes/(1899,19,8223).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "Krasnograd",
+ doorside = "R",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1932,8,9112).lua b/il_timetable/nodes/(1932,8,9112).lua
new file mode 100644
index 0000000..ab5f43e
--- /dev/null
+++ b/il_timetable/nodes/(1932,8,9112).lua
@@ -0,0 +1,19 @@
+--S.ttp["CFE_S"].travel_times["Personhood West"] = 890
+
+lines = F.ttp_info_times("CFE_S", "00;00")
+linestr = F.ttp_info_trains("CFE_S", "00;00")
+local li = lines
+for i=1,#linestr do li[#li+1] = linestr[i] end
+print(" CFE\n"..table.concat(li, "\n"))
+
+lines = F.ttp_info_times("NX_S", "00;00")
+linestr = F.ttp_info_trains("NX_S", "00;00")
+li = lines
+for i=1,#linestr do li[#li+1] = linestr[i] end
+print(" NX\n"..table.concat(li, "\n"))
+
+lines = F.ttp_info_times("E1_S", "00;00")
+linestr = F.ttp_info_trains("E1_S", "00;00")
+li = lines
+for i=1,#linestr do li[#li+1] = linestr[i] end
+print(" E1\n"..table.concat(li, "\n")) \ No newline at end of file
diff --git a/il_timetable/nodes/(1936,7,9131).lua b/il_timetable/nodes/(1936,7,9131).lua
new file mode 100644
index 0000000..815f30a
--- /dev/null
+++ b/il_timetable/nodes/(1936,7,9131).lua
@@ -0,0 +1,11 @@
+F.ttp_begin({
+ stn = "Warmoneaye", -- station name
+ tt = "CFE_S", -- timetable ID
+ depint = "05;00", --departure slot interval
+ depoff = "00;00", --departure slot offset
+ doorside = "L",
+ reverse = true,
+ only_lines = nil,
+ force_tt_reset = false,
+})
+F.stat("CFE") \ No newline at end of file
diff --git a/il_timetable/nodes/(1953,19,8220).lua b/il_timetable/nodes/(1953,19,8220).lua
new file mode 100644
index 0000000..c07fbb8
--- /dev/null
+++ b/il_timetable/nodes/(1953,19,8220).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "Krasnograd",
+ doorside = "R",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1971,5,7353).lua b/il_timetable/nodes/(1971,5,7353).lua
new file mode 100644
index 0000000..d9f6da9
--- /dev/null
+++ b/il_timetable/nodes/(1971,5,7353).lua
@@ -0,0 +1,8 @@
+F.ttp_station_display({
+ lines = {"CFE_S"},
+ departure = {},
+ station = "Crystal Farms",
+ title = "Crystal Farms",
+ interval = 60,
+ display1 = "disp1",
+})
diff --git a/il_timetable/nodes/(1973,42,8384).lua b/il_timetable/nodes/(1973,42,8384).lua
new file mode 100644
index 0000000..8fe1919
--- /dev/null
+++ b/il_timetable/nodes/(1973,42,8384).lua
@@ -0,0 +1,9 @@
+F.ttp_station_display({
+ lines = {"CFE_S", "NRG_W", "NRG_E"},
+ departure = {},
+ station = "Azena Transirejo",
+ title = "Azena Transirejo",
+ interval = 30,
+ display1 = "display1",
+ display2 = "display2",
+})
diff --git a/il_timetable/nodes/(1973,5,6132).lua b/il_timetable/nodes/(1973,5,6132).lua
new file mode 100644
index 0000000..451a05c
--- /dev/null
+++ b/il_timetable/nodes/(1973,5,6132).lua
@@ -0,0 +1,8 @@
+F.ttp_station_display({
+ lines = {"CFE_S"},
+ departure = {},
+ station = "Grootshad - X Nihilo",
+ title = "Grootshad-XNihilo",
+ interval = 60,
+ display1 = "disp1",
+})
diff --git a/il_timetable/nodes/(1976,5,7914).lua b/il_timetable/nodes/(1976,5,7914).lua
new file mode 100644
index 0000000..313ac90
--- /dev/null
+++ b/il_timetable/nodes/(1976,5,7914).lua
@@ -0,0 +1,8 @@
+F.ttp_station_display({
+ lines = {"CFE_S"},
+ departure = {},
+ station = "Malvarma Akvo",
+ title = "Malvarma Akvo",
+ interval = 60,
+ display1 = "disp1",
+})
diff --git a/il_timetable/nodes/(1977,3,7354).lua b/il_timetable/nodes/(1977,3,7354).lua
new file mode 100644
index 0000000..61e267f
--- /dev/null
+++ b/il_timetable/nodes/(1977,3,7354).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "Crystal Farms",
+ doorside = "R",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1980,3,6129).lua b/il_timetable/nodes/(1980,3,6129).lua
new file mode 100644
index 0000000..438b60f
--- /dev/null
+++ b/il_timetable/nodes/(1980,3,6129).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "Grootshad - X Nihilo",
+ doorside = "R",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1980,3,7922).lua b/il_timetable/nodes/(1980,3,7922).lua
new file mode 100644
index 0000000..9e91259
--- /dev/null
+++ b/il_timetable/nodes/(1980,3,7922).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "Malvarma Akvo",
+ doorside = "R",
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1980,41,8381).lua b/il_timetable/nodes/(1980,41,8381).lua
new file mode 100644
index 0000000..bad022d
--- /dev/null
+++ b/il_timetable/nodes/(1980,41,8381).lua
@@ -0,0 +1,5 @@
+F.ttp_stop({
+ stn = "Azena Transirejo",
+ doorside = "R",
+ only_lines = {CFE=true}
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(1980,41,8395).lua b/il_timetable/nodes/(1980,41,8395).lua
new file mode 100644
index 0000000..c763b43
--- /dev/null
+++ b/il_timetable/nodes/(1980,41,8395).lua
@@ -0,0 +1,10 @@
+F.ttp_begin({
+ stn = "Azena Transirejo", -- station name
+ tt = "NRG_W", -- timetable ID
+ depint = "05;00", --departure slot interval
+ depoff = "00;30", --departure slot offset
+ doorside = "L",
+ reverse = true,
+ only_lines = {["CFE-NRG"] = true},
+ force_tt_reset = false, -- force reset of travel times for this timetable
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(2648,13,4352).lua b/il_timetable/nodes/(2648,13,4352).lua
new file mode 100644
index 0000000..565febb
--- /dev/null
+++ b/il_timetable/nodes/(2648,13,4352).lua
@@ -0,0 +1,4 @@
+F.ttp_stop({
+ stn = "GRUB Valley (GVMER)",
+ doorside = "R"
+}) \ No newline at end of file
diff --git a/il_timetable/nodes/(286,4,206).lua b/il_timetable/nodes/(286,4,206).lua
new file mode 100644
index 0000000..8713687
--- /dev/null
+++ b/il_timetable/nodes/(286,4,206).lua
@@ -0,0 +1,27 @@
+if event.train then
+st_name = "NYE Square"
+flip = not flip
+end
+
+doors = "L"
+ if event.train then
+ local time_now = rwt.now()
+ local next_dep_time = rwt.next_rpt(rwt.add(time_now, 10), 240, 0)
+if flip then
+ atc_set_text_outside("4 - Showroom")
+ digiline_send("monitor", "4 Showroom "..rwt.to_string(next_dep_time, true))
+ set_rc("SH")
+else
+ digiline_send("monitor", "4 Ice Mountain "..rwt.to_string(next_dep_time, true))
+ atc_set_text_outside("4 - Ice Mountain")
+ set_rc("IM")
+end
+ atc_set_text_inside(st_name.."\nDeparture: "..rwt.to_string(next_dep_time, true))
+ atc_send("B0 W O"..doors)
+ schedule(next_dep_time, "depart")
+ elseif event.schedule then
+ atc_send("OCD1SM")
+ digiline_send("monitor", "Last Departure: | "..rwt.to_string(rwt.now(), true))
+ atc_set_text_inside("")
+ depart = true
+ end
diff --git a/il_timetable/nodes/(767,10,3484).lua b/il_timetable/nodes/(767,10,3484).lua
new file mode 100644
index 0000000..1b4f884
--- /dev/null
+++ b/il_timetable/nodes/(767,10,3484).lua
@@ -0,0 +1,10 @@
+F.ttp_begin({
+ stn = "Stopsleyhood Town Hall", -- station name
+ tt = "NX_S", -- timetable ID
+ depint = "05;00", --departure slot interval
+ depoff = "00;00", --departure slot offset
+ doorside = "L",
+ reverse = false,
+ only_lines = { XN = true },
+ force_tt_reset = false,
+})
diff --git a/il_timetable/nodes/(790,8,-109).lua b/il_timetable/nodes/(790,8,-109).lua
new file mode 100644
index 0000000..78cf1f7
--- /dev/null
+++ b/il_timetable/nodes/(790,8,-109).lua
@@ -0,0 +1,5 @@
+-- d_int: Departure every n seconds (epoch modulo)
+-- d_off: Departure time offset
+-- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off)
+atc_set_text_outside("Line 1 - Palm Bay")
+F.stop_sd_sched("Szymon's Dam Regional", "L", "RSM", 10, 120, 0) \ No newline at end of file
diff --git a/il_timetable/nodes/(941,18,-571).lua b/il_timetable/nodes/(941,18,-571).lua
new file mode 100644
index 0000000..38f1073
--- /dev/null
+++ b/il_timetable/nodes/(941,18,-571).lua
@@ -0,0 +1,5 @@
+atc_set_text_outside("Line 1 - Palm Bay")
+-- d_int: Departure every n seconds (epoch modulo)
+-- d_off: Departure time offset
+-- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off)
+F.stop_sd_sched("Windy Mountains", "R", "RSM", 10, 240, 60) \ No newline at end of file
diff --git a/il_timetable/nodes/(957,14,1047).lua b/il_timetable/nodes/(957,14,1047).lua
index 74760fd..d28a823 100644
--- a/il_timetable/nodes/(957,14,1047).lua
+++ b/il_timetable/nodes/(957,14,1047).lua
@@ -2,6 +2,10 @@
-- d_off: Departure time offset
-- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off)
F.stop_sd_sched("Ehlodex", "R", "SM", 10, 60, 0)
+
+if event.train then
+ F.timetake_end("E1-Psh-Ehl")
+end
if depart then
- setstate("Ehl6ARSPreventer", "st")
+ F.timetake_start("E1-Ehl-Spn")
end \ No newline at end of file
diff --git a/il_timetable/nodes/(960,14,1067).lua b/il_timetable/nodes/(960,14,1067).lua
new file mode 100644
index 0000000..43e2d7d
--- /dev/null
+++ b/il_timetable/nodes/(960,14,1067).lua
@@ -0,0 +1,3 @@
+if event.train then
+F.timetake_start("E1-Ehl-Psh")
+end \ No newline at end of file
diff --git a/il_timetable/nodes/(972,14,1053).lua b/il_timetable/nodes/(972,14,1053).lua
index fde413c..c316b90 100644
--- a/il_timetable/nodes/(972,14,1053).lua
+++ b/il_timetable/nodes/(972,14,1053).lua
@@ -1,4 +1,7 @@
-- d_int: Departure every n seconds (epoch modulo)
-- d_off: Departure time offset
-- function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off)
-F.stop_sd_sched("Ehlodex", "R", "RSM", 10, 240, 75) \ No newline at end of file
+F.stop_sd_sched("Ehlodex", "R", "RSM", 10, 240, 65)
+if event.train then
+atc_set_text_outside("S12 - Spawn Main Station\nvia Schwarzschild Street, Anju Crossing")
+end \ No newline at end of file