diff options
author | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:51:45 +0200 |
---|---|---|
committer | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:51:45 +0200 |
commit | 0b14726c5539782a60d2f4beaed2cfca74a50f7a (patch) | |
tree | 1de6e16c565f7bb9806552fc587d7eac870b6b00 /durt | |
download | luaatc_envs-0b14726c5539782a60d2f4beaed2cfca74a50f7a.tar.gz luaatc_envs-0b14726c5539782a60d2f4beaed2cfca74a50f7a.tar.bz2 luaatc_envs-0b14726c5539782a60d2f4beaed2cfca74a50f7a.zip |
State at 2019-12-13
Diffstat (limited to 'durt')
37 files changed, 135 insertions, 0 deletions
diff --git a/durt/init_code.lua b/durt/init_code.lua new file mode 100644 index 0000000..6e97a28 --- /dev/null +++ b/durt/init_code.lua @@ -0,0 +1 @@ +S.termini = {
E = "Tro",
W = "Dbl"
}
S.stations = {
Dbl = "Dubulti",
Pav = "Pence Avenue",
Ghd = "Greenhat Mountain",
Acm = "Acacia Mountains",
Ghb = "Green Hill Beach",
Ged = "Green Edge",
Dri = "Dry Island",
Gcl = "Green Cliffs",
Sfs = "South Forest",
Jms = "Jude Milhon Street",
Bam = "Bamboo Hills",
Cli = "Clown Island",
Wat = "Something in the Water",
Duf = "Duff Rd",
Tro = "Turtle Rock"
}
S.next_station = {
E = {
Dbl = "Pav",
Pav = "Ghd",
Ghd = "Acm",
Acm = "Ghb",
Ghb = "Ged",
Ged = "Dri",
Dri = "Gcl",
Gcl = "Sfs",
Sfs = "Jms",
Jms = "Bam",
Bam = "Cli",
Cli = "Wat",
Wat = "Duf",
Duf = "Tro"
},
W = {
Tro = "Duf",
Duf = "Wat",
Wat = "Cli",
Cli = "Bam",
Bam = "Jms",
Jms = "Sfs",
Sfs = "Gcl",
Gcl = "Dri",
Dri = "Ged",
Ged = "Ghb",
Ghb = "Acm",
Acm = "Ghd",
Ghd = "Dbl",
}
}
S.doors = {
Tro = "L",
Duf = "R",
Wat = "L",
Cli = "R",
Bam = "R",
Jms = "R",
Sfs = "R",
Gcl = "R",
Dri = "L",
Ged = "L",
Ghb = "L",
Acm = "L",
Ghd = "L",
Dbl = "R",
Pav = "L"
}
F.arrive = function(stn_code)
atc_send("B0 W O"..S.doors[stn_code])
atc_set_text_inside(S.stations[stn_code])
end
F.leave = function(stn_code, dir)
-- Try to set departure route e.g. StaW->Stb
local pos = stn_code .. dir
local route = stn_code .. "->" .. S.next_station[dir][stn_code]
if can_set_route(pos, route) then
set_route(pos, route)
atc_set_text_inside("Next stop:\n" .. S.stations[S.next_station[dir][stn_code]])
atc_send("OC SM")
return
end
-- Wait another 5s before trying again
atc_set_text_inside("Waiting to depart...")
interrupt(5, "depart")
end
F.set_desto = function(dir, line)
atc_set_text_outside("LINE " .. line ..
"\n---> " .. S.stations[S.termini[dir]])
end
F.station = function(stn_code, dir)
if event.train then
F.arrive(stn_code)
interrupt(10, "depart")
end
if event.int and event.msg == "depart" then
F.leave(stn_code, dir)
end
end
F.terminus = function(stn_code, newdir, line)
if event.train then
atc_set_text_inside(S.stations[stn_code])
atc_send("B0 W R O"..S.doors[stn_code])
F.set_desto(newdir, line)
interrupt(10, "depart")
end
if event.int and event.msg == "depart" then
F.leave(stn_code, newdir)
end
end
\ No newline at end of file diff --git a/durt/nodes/(-131,2,-2018).lua b/durt/nodes/(-131,2,-2018).lua new file mode 100644 index 0000000..90da6e2 --- /dev/null +++ b/durt/nodes/(-131,2,-2018).lua @@ -0,0 +1 @@ +F.station("Pav","E")
\ No newline at end of file diff --git a/durt/nodes/(-149,8,-2209).lua b/durt/nodes/(-149,8,-2209).lua new file mode 100644 index 0000000..c5bdaaf --- /dev/null +++ b/durt/nodes/(-149,8,-2209).lua @@ -0,0 +1 @@ +F.station("Acm","E")
\ No newline at end of file diff --git a/durt/nodes/(-151,8,-2196).lua b/durt/nodes/(-151,8,-2196).lua new file mode 100644 index 0000000..602ea01 --- /dev/null +++ b/durt/nodes/(-151,8,-2196).lua @@ -0,0 +1 @@ +F.station("Acm","W")
\ No newline at end of file diff --git a/durt/nodes/(-168,7,-2053).lua b/durt/nodes/(-168,7,-2053).lua new file mode 100644 index 0000000..f64a829 --- /dev/null +++ b/durt/nodes/(-168,7,-2053).lua @@ -0,0 +1 @@ +F.station("Ghd","E")
\ No newline at end of file diff --git a/durt/nodes/(-170,7,-2040).lua b/durt/nodes/(-170,7,-2040).lua new file mode 100644 index 0000000..c17ee1f --- /dev/null +++ b/durt/nodes/(-170,7,-2040).lua @@ -0,0 +1 @@ +F.station("Ghd","W")
\ No newline at end of file diff --git a/durt/nodes/(-1728,10,-1823).lua b/durt/nodes/(-1728,10,-1823).lua new file mode 100644 index 0000000..cb8727f --- /dev/null +++ b/durt/nodes/(-1728,10,-1823).lua @@ -0,0 +1,2 @@ +atc_set_text_inside("S23 -> Bamboo Hills") +atc_set_text_outside("S23 -> Bamboo Hills")
\ No newline at end of file diff --git a/durt/nodes/(-20,8,-2319).lua b/durt/nodes/(-20,8,-2319).lua new file mode 100644 index 0000000..c788356 --- /dev/null +++ b/durt/nodes/(-20,8,-2319).lua @@ -0,0 +1 @@ +F.station("Ghb","E")
\ No newline at end of file diff --git a/durt/nodes/(-2227,8,290).lua b/durt/nodes/(-2227,8,290).lua new file mode 100644 index 0000000..6e6f7ef --- /dev/null +++ b/durt/nodes/(-2227,8,290).lua @@ -0,0 +1,3 @@ +local msg = "S23 -> Redwood" +atc_set_text_outside(msg) +atc_set_text_inside(msg)
\ No newline at end of file diff --git a/durt/nodes/(-2227,8,292).lua b/durt/nodes/(-2227,8,292).lua new file mode 100644 index 0000000..75c39d7 --- /dev/null +++ b/durt/nodes/(-2227,8,292).lua @@ -0,0 +1,75 @@ +-- + +local delta = 4*60+20 -- HERE IS THE VALUE + +local owdata = S.BaHi_T6 +local numval = 5 +local switchbox_cp = { x=-2221,y=14,z=297} + +function save_delay(d) + if not owndata then + owndata = { false, false, false, false, false, false, false, false, } + end + for i=numval,2,-1 do + owndata[i] = owndata[i-1] + end + owndata[1] = d +end + +function delay_text() + if not owndata then + return "" + end + local rg = "" + for i=1,numval do + h = owndata[i] + if not h then h = "" end + rg = rg .. h .." " + end + return rg +end + +if event.type == "train" then + if atc_arrow then + atc_send("B0WOL") -- D20OCD3S2") +-- setstate("BaHi_T5_S2","st") +-- setstate("BaHi_T5_S1","st") + + if not S.BaHi_T6 then + S.BaHi_T6 = os.time() + end +-- interrupt(1,"departure") +-- else + now = os.time() + tempdist = now-S.BaHi_T6 + save_delay(tempdist) + delaystr = delay_text() + output = "last: "..S.BaHi_T6 .. "\nnow: " .. now .. "\ndelta: " .. tempdist.. "\n"..delta .. " " .. delaystr + digiline_send("lcd",output) + interrupt_pos( switchbox_cp, { action = "display", data = output } ) + if tempdist > delta then + interrupt(15,"departure") + else + interrupt(-tempdist+delta,"departure") + end +-- end + end + return +end + +if event.type == "int" then + if event.msg == "departure" then + -- setstate("BaHi_T5_S2","st") + -- setstate("BaHi_T5_S1","st") + atc_set_text_inside("S23 -> Redwood") + atc_send("ROCD3S2") + now = os.time() + delaystr = delay_text() +-- digiline_send("lcd","last: \nnow: " .. now .. "\ndelta: " .. tempdist.. "\n"..delta .. " " .. delaystr) + output = "last: " .. now .. " \n \n \n"..delta.." "..delaystr + digiline_send("lcd",output ) + interrupt_pos( switchbox_cp, { action = "display", data = output } ) + S.BaHi_T6 = now + end + return +end
\ No newline at end of file diff --git a/durt/nodes/(-35,8,-2323).lua b/durt/nodes/(-35,8,-2323).lua new file mode 100644 index 0000000..401821c --- /dev/null +++ b/durt/nodes/(-35,8,-2323).lua @@ -0,0 +1 @@ +F.station("Ghb","W")
\ No newline at end of file diff --git a/durt/nodes/(-73,2,-1984).lua b/durt/nodes/(-73,2,-1984).lua new file mode 100644 index 0000000..569eab1 --- /dev/null +++ b/durt/nodes/(-73,2,-1984).lua @@ -0,0 +1,2 @@ +F.set_desto("E", 21) +F.station("Dbl", "E")
\ No newline at end of file diff --git a/durt/nodes/(139,8,-2054).lua b/durt/nodes/(139,8,-2054).lua new file mode 100644 index 0000000..da88c32 --- /dev/null +++ b/durt/nodes/(139,8,-2054).lua @@ -0,0 +1 @@ +F.station("Gcl","W")
\ No newline at end of file diff --git a/durt/nodes/(151,8,-2046).lua b/durt/nodes/(151,8,-2046).lua new file mode 100644 index 0000000..24a6c0b --- /dev/null +++ b/durt/nodes/(151,8,-2046).lua @@ -0,0 +1 @@ +F.station("Gcl","E")
\ No newline at end of file diff --git a/durt/nodes/(258,2,-2054).lua b/durt/nodes/(258,2,-2054).lua new file mode 100644 index 0000000..23e79be --- /dev/null +++ b/durt/nodes/(258,2,-2054).lua @@ -0,0 +1 @@ +F.station("Sfs","W")
\ No newline at end of file diff --git a/durt/nodes/(273,2,-2046).lua b/durt/nodes/(273,2,-2046).lua new file mode 100644 index 0000000..36cbad2 --- /dev/null +++ b/durt/nodes/(273,2,-2046).lua @@ -0,0 +1 @@ +F.station("Sfs","E")
\ No newline at end of file diff --git a/durt/nodes/(363,-3,-2026).lua b/durt/nodes/(363,-3,-2026).lua new file mode 100644 index 0000000..a15195a --- /dev/null +++ b/durt/nodes/(363,-3,-2026).lua @@ -0,0 +1 @@ +F.station("Jms","W")
\ No newline at end of file diff --git a/durt/nodes/(377,-3,-2018).lua b/durt/nodes/(377,-3,-2018).lua new file mode 100644 index 0000000..a06c323 --- /dev/null +++ b/durt/nodes/(377,-3,-2018).lua @@ -0,0 +1 @@ +F.station("Jms","E")
\ No newline at end of file diff --git a/durt/nodes/(501,-3,-2026).lua b/durt/nodes/(501,-3,-2026).lua new file mode 100644 index 0000000..708c331 --- /dev/null +++ b/durt/nodes/(501,-3,-2026).lua @@ -0,0 +1 @@ +F.station("Bam","W")
\ No newline at end of file diff --git a/durt/nodes/(515,-3,-2018).lua b/durt/nodes/(515,-3,-2018).lua new file mode 100644 index 0000000..ef7d6a4 --- /dev/null +++ b/durt/nodes/(515,-3,-2018).lua @@ -0,0 +1 @@ +F.station("Bam","E")
\ No newline at end of file diff --git a/durt/nodes/(519,-3,-1944).lua b/durt/nodes/(519,-3,-1944).lua new file mode 100644 index 0000000..51d69b4 --- /dev/null +++ b/durt/nodes/(519,-3,-1944).lua @@ -0,0 +1 @@ +atc_set_text_inside(atc_id)
\ No newline at end of file diff --git a/durt/nodes/(523,-3,-1936).lua b/durt/nodes/(523,-3,-1936).lua new file mode 100644 index 0000000..51d69b4 --- /dev/null +++ b/durt/nodes/(523,-3,-1936).lua @@ -0,0 +1 @@ +atc_set_text_inside(atc_id)
\ No newline at end of file diff --git a/durt/nodes/(523,-3,-1942).lua b/durt/nodes/(523,-3,-1942).lua new file mode 100644 index 0000000..51d69b4 --- /dev/null +++ b/durt/nodes/(523,-3,-1942).lua @@ -0,0 +1 @@ +atc_set_text_inside(atc_id)
\ No newline at end of file diff --git a/durt/nodes/(525,-3,-1940).lua b/durt/nodes/(525,-3,-1940).lua new file mode 100644 index 0000000..51d69b4 --- /dev/null +++ b/durt/nodes/(525,-3,-1940).lua @@ -0,0 +1 @@ +atc_set_text_inside(atc_id)
\ No newline at end of file diff --git a/durt/nodes/(527,-3,-1959).lua b/durt/nodes/(527,-3,-1959).lua new file mode 100644 index 0000000..f137323 --- /dev/null +++ b/durt/nodes/(527,-3,-1959).lua @@ -0,0 +1,11 @@ +if atc_arrow then + atc_send("B1") + set_line("X") + atc_set_text_outside("NOT IN SERVICE") + atc_set_text_inside("DEPOT") +else + atc_send("SM") + set_line("1") + atc_set_text_outside("Line 21\n---> South Forest") + atc_set_text_inside("Next stop: Bamboo Hills") +end
\ No newline at end of file diff --git a/durt/nodes/(529,-3,-1954).lua b/durt/nodes/(529,-3,-1954).lua new file mode 100644 index 0000000..da5fd9f --- /dev/null +++ b/durt/nodes/(529,-3,-1954).lua @@ -0,0 +1,11 @@ +if atc_arrow then + atc_send("SM") + set_line("1") + atc_set_text_outside("Line 21\n---> Turtle Rock") + atc_set_text_inside("Next stop: Clown Island") +else + atc_send("B1") + set_line("X") + atc_set_text_outside("NOT IN SERVICE") + atc_set_text_inside("DEPOT") +end
\ No newline at end of file diff --git a/durt/nodes/(596,-3,-1963).lua b/durt/nodes/(596,-3,-1963).lua new file mode 100644 index 0000000..ef232c3 --- /dev/null +++ b/durt/nodes/(596,-3,-1963).lua @@ -0,0 +1 @@ +F.station("Cli","W")
\ No newline at end of file diff --git a/durt/nodes/(608,-3,-1957).lua b/durt/nodes/(608,-3,-1957).lua new file mode 100644 index 0000000..37f35ff --- /dev/null +++ b/durt/nodes/(608,-3,-1957).lua @@ -0,0 +1 @@ +F.station("Cli","E")
\ No newline at end of file diff --git a/durt/nodes/(686,-3,-1961).lua b/durt/nodes/(686,-3,-1961).lua new file mode 100644 index 0000000..94c23fb --- /dev/null +++ b/durt/nodes/(686,-3,-1961).lua @@ -0,0 +1 @@ +F.station("Wat","W")
\ No newline at end of file diff --git a/durt/nodes/(698,-3,-1959).lua b/durt/nodes/(698,-3,-1959).lua new file mode 100644 index 0000000..f646518 --- /dev/null +++ b/durt/nodes/(698,-3,-1959).lua @@ -0,0 +1 @@ +F.station("Wat","E")
\ No newline at end of file diff --git a/durt/nodes/(74,8,-2124).lua b/durt/nodes/(74,8,-2124).lua new file mode 100644 index 0000000..4589804 --- /dev/null +++ b/durt/nodes/(74,8,-2124).lua @@ -0,0 +1 @@ +F.station("Dri","E")
\ No newline at end of file diff --git a/durt/nodes/(74,8,-2297).lua b/durt/nodes/(74,8,-2297).lua new file mode 100644 index 0000000..02cba9c --- /dev/null +++ b/durt/nodes/(74,8,-2297).lua @@ -0,0 +1 @@ +F.station("Ged","E")
\ No newline at end of file diff --git a/durt/nodes/(770,6,-1938).lua b/durt/nodes/(770,6,-1938).lua new file mode 100644 index 0000000..af2e64f --- /dev/null +++ b/durt/nodes/(770,6,-1938).lua @@ -0,0 +1 @@ +F.station("Duf", "W")
\ No newline at end of file diff --git a/durt/nodes/(78,8,-2139).lua b/durt/nodes/(78,8,-2139).lua new file mode 100644 index 0000000..d16d287 --- /dev/null +++ b/durt/nodes/(78,8,-2139).lua @@ -0,0 +1 @@ +F.station("Dri","W")
\ No newline at end of file diff --git a/durt/nodes/(78,8,-2312).lua b/durt/nodes/(78,8,-2312).lua new file mode 100644 index 0000000..6a061ac --- /dev/null +++ b/durt/nodes/(78,8,-2312).lua @@ -0,0 +1 @@ +F.station("Ged","W")
\ No newline at end of file diff --git a/durt/nodes/(782,6,-1930).lua b/durt/nodes/(782,6,-1930).lua new file mode 100644 index 0000000..56e8aa5 --- /dev/null +++ b/durt/nodes/(782,6,-1930).lua @@ -0,0 +1 @@ +F.station("Duf","E")
\ No newline at end of file diff --git a/durt/nodes/(839,6,-1864).lua b/durt/nodes/(839,6,-1864).lua new file mode 100644 index 0000000..85f60e1 --- /dev/null +++ b/durt/nodes/(839,6,-1864).lua @@ -0,0 +1 @@ +F.terminus("Tro", "W", 21)
\ No newline at end of file |