summaryrefslogtreecommitdiff
path: root/il_timetable/init_code.lua
diff options
context:
space:
mode:
Diffstat (limited to 'il_timetable/init_code.lua')
-rw-r--r--il_timetable/init_code.lua48
1 files changed, 43 insertions, 5 deletions
diff --git a/il_timetable/init_code.lua b/il_timetable/init_code.lua
index 9357130..5b6f9c5 100644
--- a/il_timetable/init_code.lua
+++ b/il_timetable/init_code.lua
@@ -150,8 +150,8 @@ local STOP_TIME = 10
local STOPCMD="B0WO"
local DEPCMD="A1OCD1SM"
local RDEPCMD="RA1OCD1SM"
-local DYNAMIC_THR = 10
-local DYNAMIC_EN = false
+local DYNAMIC_THR = 15
+local DYNAMIC_EN = true
if not S.ttp then S.ttp = {} end
if not S.ttt then S.ttt = {} end
@@ -229,13 +229,33 @@ F.ttp={
E16_E = {
outside_text = "[E16] Cat-o-Land (By The Way)\nC&C Rail",
inside_line_desc = "E16 to Cat-o-Land (By The Way)",
- stn_display = "E16 Cat-o-Land ",
+ stn_display = "E16 By The Way ",
},
E16_W = {
outside_text = "[E16] Personhood\nC&C Rail",
inside_line_desc = "E16 to Personhood",
stn_display = "E16 Personhood ",
},
+ KVE_N = {
+ outside_text = "[KVE] Kangasvarkaa Express\n->Kangasvarkaan Rata",
+ inside_line_desc = "KVE to Kangasvarkaa",
+ stn_display = "KVE Kangasvarkaa",
+ },
+ KVE_S = {
+ outside_text = "[KVE] Kangasvarkaa Express\n->Spawn Main Station",
+ inside_line_desc = "KVE to Spawn Main Station",
+ stn_display = "KVE Spawn Main ",
+ },
+ DTLE1_N = {
+ outside_text = "[DTLE1] Banana Place",
+ inside_line_desc = "Dario Train Lines Express 1 (DTLE1) to Banana Place",
+ stn_display = "DTLE1 Banana Pl.",
+ },
+ DTLE1_S = {
+ outside_text = "[DTLE1] Morija North",
+ inside_line_desc = "Dario Train Lines Express 1 (DTLE1) to Morija North",
+ stn_display = "DTLE1 Morija N. ",
+ },
}
--[[
@@ -281,11 +301,19 @@ function F.ttp_begin(p)
-- Train might have had another TT before, do the cleanup from ttp_end here.
local trno = S.ttt[atc_id]
if trno then
+ local tto = trno.timetable
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
- print(atc_id,"for",p.tt,"at",p.stn,"-> travel time",rwt.to_string(ttio.travel_times[p.stn]),"-route end")
+ print(atc_id,"for",tto,"at",p.stn,"-> travel time",rwt.to_string(ttio.travel_times[p.stn]),"-route end")
+ elseif DYNAMIC_EN and ttio.travel_times[p.stn] then
+ -- if we are too early then change travel time
+ local new_trav = rwt.diff(trno.initial_dep, time_now)
+ if new_trav < ttio.travel_times[p.stn] - DYNAMIC_THR then
+ print(atc_id,tto,"arrived at terminus",p.stn,"early, TT",ttio.travel_times[p.stn],"->",new_trav)
+ ttio.travel_times[p.stn] = new_trav
+ end
end
end
local next_dep_time = rwt.next_rpt(rwt.add(time_now, 10), p.depint, p.depoff)
@@ -509,6 +537,7 @@ end
display2 = "d2",
display3 = "d3",
show_trainid = false,
+ twohalf = false, -- special mode for Cat-O-Land, renders 2 1/2 width to .. and ..r
}]]
function F.ttp_station_display(p)
--L425
@@ -526,7 +555,7 @@ local function add_train(deptime, line, train, tid)
rwt.to_string(deptime,true)
.." "..(p.show_trainid and tid.." " or "")
..F.ttp[line].stn_display
- .." +"..train.last_delay}
+ ..(p.twohalf and "" or " +"..train.last_delay)}
for i,ntrn in ipairs(next_trains) do
if rwt.diff(ntrn.dep, deptime)<0 then
table.insert(next_trains, i, tent)
@@ -570,6 +599,15 @@ for i=1,3 do
end
end
digiline_send(p.display1, text1)
+if p.twohalf then
+ local text1r = " "..p.title .. " * "..rwt.to_string(rwt.now(), true).." * "
+ for i=1,3 do
+ if next_trains[i] then
+ text1r = text1r .. "\n ".. next_trains[i].text
+ end
+ end
+ digiline_send(p.display1.."r", text1r)
+end
if p.display2 then
local text2 = ""
for i=4,7 do