From 5f72b7ec62a6f2fb8ce6b9d5379f03a3e4126971 Mon Sep 17 00:00:00 2001 From: autocommitter Date: Mon, 22 Apr 2024 14:52:14 +0200 Subject: State at 2020-08-29 --- Crossroads/init_code.lua | 24 +++++++++++++++++++++++- Crossroads/nodes/(1792,-1,1020).lua | 1 + Crossroads/nodes/(1797,21,989).lua | 2 +- Crossroads/nodes/(1798,21,989).lua | 2 +- Crossroads/nodes/(1799,21,989).lua | 2 +- Crossroads/nodes/(2009,4,991).lua | 1 + Crossroads/nodes/(2022,4,991).lua | 1 + Crossroads/nodes/(2254,4,991).lua | 2 +- Hyard/init_code.lua | 1 + Hyard/nodes/(-2585,7,-1632).lua | 2 ++ Hyard/nodes/(-2594,12,-1721).lua | 28 ++++++++++++++++++++++++++++ Hyard/nodes/(-2594,12,-1780).lua | 28 ++++++++++++++++++++++++++++ Hyard/nodes/(-2594,12,-1784).lua | 3 +++ Hyard/nodes/(-2594,12,-1802).lua | 9 +++++++++ Hyard/nodes/(-2595,12,-1837).lua | 2 ++ Hyard/nodes/(-2596,12,-1721).lua | 17 +++++++++++++++++ Hyard/nodes/(-2596,12,-1780).lua | 14 ++++++++++++++ Hyard/nodes/(-2596,12,-1784).lua | 3 +++ Hyard/nodes/(-2596,12,-1830).lua | 15 +++++++++++++++ Hyard/nodes/(-2597,12,-1708).lua | 4 ++++ Hyard/nodes/(-2598,12,-1708).lua | 4 ++++ Hyard/nodes/(-2598,12,-1721).lua | 17 +++++++++++++++++ Hyard/nodes/(-2598,12,-1780).lua | 14 ++++++++++++++ Hyard/nodes/(-2598,12,-1784).lua | 3 +++ Hyard/nodes/(-2600,12,-1708).lua | 4 ++++ Hyard/nodes/(-2600,12,-1721).lua | 17 +++++++++++++++++ Hyard/nodes/(-2600,12,-1780).lua | 14 ++++++++++++++ Hyard/nodes/(-2600,12,-1784).lua | 3 +++ Hyard/nodes/(-2602,12,-1708).lua | 4 ++++ Hyard/nodes/(-2602,12,-1721).lua | 17 +++++++++++++++++ Hyard/nodes/(-2602,12,-1780).lua | 14 ++++++++++++++ Hyard/nodes/(-2602,12,-1784).lua | 3 +++ Hyard/nodes/(-2603,12,-1784).lua | 3 +++ Hyard/nodes/(-2603,9,-1659).lua | 9 +++++++++ Hyard/nodes/(-2604,12,-1708).lua | 4 ++++ Hyard/nodes/(-2604,12,-1721).lua | 17 +++++++++++++++++ Hyard/nodes/(-2604,12,-1780).lua | 14 ++++++++++++++ Hyard/nodes/(-2609,13,-1724).lua | 1 + Hyard/nodes/(-2642,10,-1700).lua | 8 ++++++++ Tyard/init_code.lua | 5 +++++ Tyard/nodes/(-4011,12,-2642).lua | 1 + Tyard/nodes/(-4011,12,-2646).lua | 1 + Tyard/nodes/(-4024,12,-2642).lua | 1 + Tyard/nodes/(-4027,12,-2655).lua | 1 + Tyard/nodes/(-4027,12,-2731).lua | 1 + Tyard/nodes/(-4031,12,-2655).lua | 1 + Tyard/nodes/(-4031,12,-2731).lua | 1 + Tyard/nodes/(-4035,12,-2655).lua | 1 + Tyard/nodes/(-4035,12,-2731).lua | 1 + Tyard/nodes/(-4039,12,-2655).lua | 1 + Tyard/nodes/(-4039,12,-2731).lua | 1 + Tyard/nodes/(-4043,12,-2655).lua | 1 + Tyard/nodes/(-4043,12,-2731).lua | 1 + Tyard/nodes/(-4047,12,-2655).lua | 1 + Tyard/nodes/(-4047,12,-2731).lua | 1 + Tyard/nodes/(-4051,12,-2655).lua | 1 + Tyard/nodes/(-4051,12,-2731).lua | 1 + Tyard/nodes/(-4055,12,-2655).lua | 1 + Tyard/nodes/(-4055,12,-2731).lua | 1 + Tyard/nodes/(-4059,12,-2714).lua | 1 + Tyard/nodes/(-4063,12,-2669).lua | 1 + durt/init_code.lua | 2 +- durt/nodes/(-2147,20,777).lua | 7 +++++++ durt/nodes/(-2153,20,769).lua | 9 +++++++++ durt/nodes/(-3588,8,-2277).lua | 2 +- durt/nodes/(-541,26,2469).lua | 1 + durt/nodes/(-541,26,2472).lua | 1 + durt/nodes/(-541,26,2475).lua | 1 + durt/nodes/(-549,26,2478).lua | 1 + durt/nodes/(-585,26,2478).lua | 1 + durt/nodes/(-612,28,2482).lua | 1 + durt/nodes/(-621,26,2469).lua | 1 + durt/nodes/(-621,26,2472).lua | 1 + durt/nodes/(-621,26,2475).lua | 1 + durt/nodes/(-638,26,2475).lua | 1 + durt/nodes/(-646,26,2469).lua | 6 ++++++ durt/nodes/(-678,20,2478).lua | 2 ++ durt/nodes/(415,17,19).lua | 1 + durt/nodes/(527,-3,-1959).lua | 2 +- durt/nodes/(529,-3,-1954).lua | 2 +- il_timetable/init_code.lua | 2 ++ il_timetable/nodes/(943,14,1025).lua | 1 + il_timetable/nodes/(957,14,1047).lua | 5 ++++- nlvcross/nodes/(-435,20,-328).lua | 2 +- ondemand/nodes/(-543,-5,-772).lua | 3 +++ subway/init_code.lua | 10 +++++++++- subway/nodes/(-1025,10,226).lua | 2 +- subway/nodes/(10,0,-10).lua | 4 ++-- subway/nodes/(787,8,-103).lua | 3 +++ 89 files changed, 417 insertions(+), 15 deletions(-) create mode 100644 Crossroads/nodes/(1792,-1,1020).lua create mode 100644 Crossroads/nodes/(2009,4,991).lua create mode 100644 Crossroads/nodes/(2022,4,991).lua create mode 100644 Hyard/init_code.lua create mode 100644 Hyard/nodes/(-2585,7,-1632).lua create mode 100644 Hyard/nodes/(-2594,12,-1721).lua create mode 100644 Hyard/nodes/(-2594,12,-1780).lua create mode 100644 Hyard/nodes/(-2594,12,-1784).lua create mode 100644 Hyard/nodes/(-2594,12,-1802).lua create mode 100644 Hyard/nodes/(-2595,12,-1837).lua create mode 100644 Hyard/nodes/(-2596,12,-1721).lua create mode 100644 Hyard/nodes/(-2596,12,-1780).lua create mode 100644 Hyard/nodes/(-2596,12,-1784).lua create mode 100644 Hyard/nodes/(-2596,12,-1830).lua create mode 100644 Hyard/nodes/(-2597,12,-1708).lua create mode 100644 Hyard/nodes/(-2598,12,-1708).lua create mode 100644 Hyard/nodes/(-2598,12,-1721).lua create mode 100644 Hyard/nodes/(-2598,12,-1780).lua create mode 100644 Hyard/nodes/(-2598,12,-1784).lua create mode 100644 Hyard/nodes/(-2600,12,-1708).lua create mode 100644 Hyard/nodes/(-2600,12,-1721).lua create mode 100644 Hyard/nodes/(-2600,12,-1780).lua create mode 100644 Hyard/nodes/(-2600,12,-1784).lua create mode 100644 Hyard/nodes/(-2602,12,-1708).lua create mode 100644 Hyard/nodes/(-2602,12,-1721).lua create mode 100644 Hyard/nodes/(-2602,12,-1780).lua create mode 100644 Hyard/nodes/(-2602,12,-1784).lua create mode 100644 Hyard/nodes/(-2603,12,-1784).lua create mode 100644 Hyard/nodes/(-2603,9,-1659).lua create mode 100644 Hyard/nodes/(-2604,12,-1708).lua create mode 100644 Hyard/nodes/(-2604,12,-1721).lua create mode 100644 Hyard/nodes/(-2604,12,-1780).lua create mode 100644 Hyard/nodes/(-2609,13,-1724).lua create mode 100644 Hyard/nodes/(-2642,10,-1700).lua create mode 100644 Tyard/init_code.lua create mode 100644 Tyard/nodes/(-4011,12,-2642).lua create mode 100644 Tyard/nodes/(-4011,12,-2646).lua create mode 100644 Tyard/nodes/(-4024,12,-2642).lua create mode 100644 Tyard/nodes/(-4027,12,-2655).lua create mode 100644 Tyard/nodes/(-4027,12,-2731).lua create mode 100644 Tyard/nodes/(-4031,12,-2655).lua create mode 100644 Tyard/nodes/(-4031,12,-2731).lua create mode 100644 Tyard/nodes/(-4035,12,-2655).lua create mode 100644 Tyard/nodes/(-4035,12,-2731).lua create mode 100644 Tyard/nodes/(-4039,12,-2655).lua create mode 100644 Tyard/nodes/(-4039,12,-2731).lua create mode 100644 Tyard/nodes/(-4043,12,-2655).lua create mode 100644 Tyard/nodes/(-4043,12,-2731).lua create mode 100644 Tyard/nodes/(-4047,12,-2655).lua create mode 100644 Tyard/nodes/(-4047,12,-2731).lua create mode 100644 Tyard/nodes/(-4051,12,-2655).lua create mode 100644 Tyard/nodes/(-4051,12,-2731).lua create mode 100644 Tyard/nodes/(-4055,12,-2655).lua create mode 100644 Tyard/nodes/(-4055,12,-2731).lua create mode 100644 Tyard/nodes/(-4059,12,-2714).lua create mode 100644 Tyard/nodes/(-4063,12,-2669).lua create mode 100644 durt/nodes/(-2147,20,777).lua create mode 100644 durt/nodes/(-2153,20,769).lua create mode 100644 durt/nodes/(-541,26,2469).lua create mode 100644 durt/nodes/(-541,26,2472).lua create mode 100644 durt/nodes/(-541,26,2475).lua create mode 100644 durt/nodes/(-549,26,2478).lua create mode 100644 durt/nodes/(-585,26,2478).lua create mode 100644 durt/nodes/(-612,28,2482).lua create mode 100644 durt/nodes/(-621,26,2469).lua create mode 100644 durt/nodes/(-621,26,2472).lua create mode 100644 durt/nodes/(-621,26,2475).lua create mode 100644 durt/nodes/(-638,26,2475).lua create mode 100644 durt/nodes/(-646,26,2469).lua create mode 100644 durt/nodes/(-678,20,2478).lua create mode 100644 durt/nodes/(415,17,19).lua create mode 100644 il_timetable/nodes/(943,14,1025).lua create mode 100644 ondemand/nodes/(-543,-5,-772).lua create mode 100644 subway/nodes/(787,8,-103).lua diff --git a/Crossroads/init_code.lua b/Crossroads/init_code.lua index ec07d95..62840ef 100644 --- a/Crossroads/init_code.lua +++ b/Crossroads/init_code.lua @@ -193,6 +193,21 @@ function F.checkpoint(name,arrow,opp) end end +function F.atc (cmd, intext, outtext) + if event.type == "train" then + if atc_arrow then + if cmd then + atc_send (cmd) + end + if intext then + atc_set_text_inside (intext) + end + if outtext then + atc_set_text_outside (outtext) + end + end + end +end F.stnlist = { cg = "Colored Grasses", @@ -206,7 +221,8 @@ F.stnlist = { crch = "Crossroads City Hall", crchs = "Crossroads City Hall South", crmtrail = "Crossroads Mountain Railway Terminus", - crnsw = "CR North Station St. 9th Alley", + crnsw = "Crossroads North Station St. 9th Alley", + crnsw2 = "Crossroads C. 2nd St./Station St. 9th Alley", crrathaus = "Crossroads City Hall", crsmacker = "Crossroads Smacker's Station", crwm = "Crossroads West Mountains", @@ -252,6 +268,12 @@ F.lines = { [1] = { {"crsmacker", "R3"}, {"crch", "U1"}, {"crchs", "W"}, {"cras", "N"} }, [2] = { {"cras", "N"}, {"crchs", "E"}, {"crch", "U2"}, {"crsmacker", "R3"} }, }, + ['CRT2'] = { + name = 'CRT 2', + ring = false, + [1] = { {'crch', 'U6'}, {'crbfsw', 'E'}, {'crnsw', 'R1'} }, + [2] = { {'crnsw', 'R1'}, {'crbfsw', 'W'}, {'crch', 'U6'} }, + }, } F.stndet = {} diff --git a/Crossroads/nodes/(1792,-1,1020).lua b/Crossroads/nodes/(1792,-1,1020).lua new file mode 100644 index 0000000..35127ba --- /dev/null +++ b/Crossroads/nodes/(1792,-1,1020).lua @@ -0,0 +1 @@ +F.stn2gen ('crch', 'U6', 'L', true, true) \ No newline at end of file diff --git a/Crossroads/nodes/(1797,21,989).lua b/Crossroads/nodes/(1797,21,989).lua index eb3dcc3..f06c626 100644 --- a/Crossroads/nodes/(1797,21,989).lua +++ b/Crossroads/nodes/(1797,21,989).lua @@ -1 +1 @@ -F.odc('CRT1','1Wcrchn R1Wcrsmacker') \ No newline at end of file +-- stub \ No newline at end of file diff --git a/Crossroads/nodes/(1798,21,989).lua b/Crossroads/nodes/(1798,21,989).lua index 4737454..f06c626 100644 --- a/Crossroads/nodes/(1798,21,989).lua +++ b/Crossroads/nodes/(1798,21,989).lua @@ -1 +1 @@ -F.odc('CRT1','R1Wcrchn 1Wcrchs') \ No newline at end of file +-- stub \ No newline at end of file diff --git a/Crossroads/nodes/(1799,21,989).lua b/Crossroads/nodes/(1799,21,989).lua index 350f81e..f06c626 100644 --- a/Crossroads/nodes/(1799,21,989).lua +++ b/Crossroads/nodes/(1799,21,989).lua @@ -1 +1 @@ -F.odc('CRT1','R1Wcrchn 1Wcras') \ No newline at end of file +-- stub \ No newline at end of file diff --git a/Crossroads/nodes/(2009,4,991).lua b/Crossroads/nodes/(2009,4,991).lua new file mode 100644 index 0000000..3485289 --- /dev/null +++ b/Crossroads/nodes/(2009,4,991).lua @@ -0,0 +1 @@ +F.stn2gen ('crbfsw','E','R') \ No newline at end of file diff --git a/Crossroads/nodes/(2022,4,991).lua b/Crossroads/nodes/(2022,4,991).lua new file mode 100644 index 0000000..62124ef --- /dev/null +++ b/Crossroads/nodes/(2022,4,991).lua @@ -0,0 +1 @@ +F.stn2gen ('crbfsw', 'W', 'L') \ No newline at end of file diff --git a/Crossroads/nodes/(2254,4,991).lua b/Crossroads/nodes/(2254,4,991).lua index 9340cff..99c3448 100644 --- a/Crossroads/nodes/(2254,4,991).lua +++ b/Crossroads/nodes/(2254,4,991).lua @@ -1 +1 @@ -F.kbhf("crnsw","crbfsw","R","M","CRT2 - Crossroads City Hall","1") \ No newline at end of file +F.stn2gen ('crnsw', 'R1', 'R', true, true) \ No newline at end of file diff --git a/Hyard/init_code.lua b/Hyard/init_code.lua new file mode 100644 index 0000000..e8e6d28 --- /dev/null +++ b/Hyard/init_code.lua @@ -0,0 +1 @@ +S.dir = 2 diff --git a/Hyard/nodes/(-2585,7,-1632).lua b/Hyard/nodes/(-2585,7,-1632).lua new file mode 100644 index 0000000..0512e1d --- /dev/null +++ b/Hyard/nodes/(-2585,7,-1632).lua @@ -0,0 +1,2 @@ +set_rc(S.rc) +S.rc = nil \ No newline at end of file diff --git a/Hyard/nodes/(-2594,12,-1721).lua b/Hyard/nodes/(-2594,12,-1721).lua new file mode 100644 index 0000000..952b979 --- /dev/null +++ b/Hyard/nodes/(-2594,12,-1721).lua @@ -0,0 +1,28 @@ +local dir = 2 +local lane = 6 +if S.dir == dir and atc_arrow then + set_route("HYE"..lane, "HEADSHUNT") + local plen = train_length() + local rc = split_at_fc("B0") + local trc = "HY"..rc..dir + S.cars = plen - train_length() + if plen == train_length() and (rc == "" or S.rc:match(trc)) and not (S.rc:match("HYREVERSE")) then + S.exiting = true + end + if rc and rc ~= "" then + set_rc("HY"..rc..dir) + else + set_rc(S.rc) + S.reversing = false + S.exiting = true + end +elseif S.dir == 1 and atc_arrow then +if S.rc:match("HYREVERSE") and S.cars == 0 then + set_route("HYE"..lane, "HEADSHUNT") +S.reversing = true +S.dir = 2 +end +if not S.reversing then +atc_send("B0WD1RS4") +end +end \ No newline at end of file diff --git a/Hyard/nodes/(-2594,12,-1780).lua b/Hyard/nodes/(-2594,12,-1780).lua new file mode 100644 index 0000000..7a257db --- /dev/null +++ b/Hyard/nodes/(-2594,12,-1780).lua @@ -0,0 +1,28 @@ + +local dir = 1 +local lane = 6 +if S.dir == dir and atc_arrow then + set_route("HYD"..lane, "HEADSHUNT1") + local plen = train_length() + local rc = split_at_fc("B0") + local trc = "HY"..rc..dir + S.cars = plen - train_length() + if plen == train_length() and (rc == "" or S.rc:match(trc)) and not (S.rc:match("HYREVERSE")) then + S.exiting = true + end + if rc and rc ~= "" then + set_rc("HY"..rc..dir) + else + set_rc(S.rc) + S.exiting = true + end +elseif S.dir == 2 and atc_arrow then +if S.rc:match("HYREVERSE") and S.cars == 0 then + set_route("HYD"..lane, "HEADSHUNT1") +S.reversing = true +S.dir = 1 +end +if not S.reversing then +atc_send("B0WD1RS4") +end +end \ No newline at end of file diff --git a/Hyard/nodes/(-2594,12,-1784).lua b/Hyard/nodes/(-2594,12,-1784).lua new file mode 100644 index 0000000..31d73ca --- /dev/null +++ b/Hyard/nodes/(-2594,12,-1784).lua @@ -0,0 +1,3 @@ +if not atc_arrow then +set_autocouple() +end \ No newline at end of file diff --git a/Hyard/nodes/(-2594,12,-1802).lua b/Hyard/nodes/(-2594,12,-1802).lua new file mode 100644 index 0000000..cfca16e --- /dev/null +++ b/Hyard/nodes/(-2594,12,-1802).lua @@ -0,0 +1,9 @@ +atc_send("B0") +if S.rc then +interrupt(10, "recheck") +else +atc_send("S4") +S.dir = 2 +S.rc = get_rc() +set_route("HYENTRY2", "PICKUP") +end \ No newline at end of file diff --git a/Hyard/nodes/(-2595,12,-1837).lua b/Hyard/nodes/(-2595,12,-1837).lua new file mode 100644 index 0000000..0512e1d --- /dev/null +++ b/Hyard/nodes/(-2595,12,-1837).lua @@ -0,0 +1,2 @@ +set_rc(S.rc) +S.rc = nil \ No newline at end of file diff --git a/Hyard/nodes/(-2596,12,-1721).lua b/Hyard/nodes/(-2596,12,-1721).lua new file mode 100644 index 0000000..cc285f9 --- /dev/null +++ b/Hyard/nodes/(-2596,12,-1721).lua @@ -0,0 +1,17 @@ +local dir = 2 +local lane = 5 +if S.dir == dir then +if atc_arrow and not S.exiting then +split_off_locomotive("B0") +set_rc("PICKUP") +set_route("HYE"..lane, "HEADSHUNT") +end + +if atc_arrow and S.exiting then +set_rc("EXIT") + set_route("HYE"..lane, "EXIT") +S.exiting = false +end +elseif atc_arrow then +atc_send("B0WD1RS4") +end \ No newline at end of file diff --git a/Hyard/nodes/(-2596,12,-1780).lua b/Hyard/nodes/(-2596,12,-1780).lua new file mode 100644 index 0000000..aaf4293 --- /dev/null +++ b/Hyard/nodes/(-2596,12,-1780).lua @@ -0,0 +1,14 @@ +local dir = 1 +if S.dir == dir then +if atc_arrow and not S.exiting then +split_off_locomotive("B0") +set_rc("PICKUP") +end + +if atc_arrow and S.exiting then +set_rc("EXIT") +S.exiting = false +end +elseif atc_arrow then +atc_send("B0WD1RS4") +end \ No newline at end of file diff --git a/Hyard/nodes/(-2596,12,-1784).lua b/Hyard/nodes/(-2596,12,-1784).lua new file mode 100644 index 0000000..31d73ca --- /dev/null +++ b/Hyard/nodes/(-2596,12,-1784).lua @@ -0,0 +1,3 @@ +if not atc_arrow then +set_autocouple() +end \ No newline at end of file diff --git a/Hyard/nodes/(-2596,12,-1830).lua b/Hyard/nodes/(-2596,12,-1830).lua new file mode 100644 index 0000000..0b5e1ac --- /dev/null +++ b/Hyard/nodes/(-2596,12,-1830).lua @@ -0,0 +1,15 @@ +if S.reversing and atc_arrow then +set_rc(S.rc) +S.exiting = true +S.reversing = false +elseif atc_arrow and S.exiting and S.rc:match("HYREVERSE") then +set_rc("PICKUP") +S.dir = 2 +S.reversing = true +elseif get_rc():match("EXIT") and not S.reversing then + if S.rc:match("HIP") then + set_route("HYEXIT1", "Hippodrome") + else + set_route("HYEXIT1", "Trisiston") +end +end \ No newline at end of file diff --git a/Hyard/nodes/(-2597,12,-1708).lua b/Hyard/nodes/(-2597,12,-1708).lua new file mode 100644 index 0000000..d87f3f9 --- /dev/null +++ b/Hyard/nodes/(-2597,12,-1708).lua @@ -0,0 +1,4 @@ + +if atc_arrow then +set_autocouple() +end \ No newline at end of file diff --git a/Hyard/nodes/(-2598,12,-1708).lua b/Hyard/nodes/(-2598,12,-1708).lua new file mode 100644 index 0000000..d87f3f9 --- /dev/null +++ b/Hyard/nodes/(-2598,12,-1708).lua @@ -0,0 +1,4 @@ + +if atc_arrow then +set_autocouple() +end \ No newline at end of file diff --git a/Hyard/nodes/(-2598,12,-1721).lua b/Hyard/nodes/(-2598,12,-1721).lua new file mode 100644 index 0000000..d19e777 --- /dev/null +++ b/Hyard/nodes/(-2598,12,-1721).lua @@ -0,0 +1,17 @@ +local dir = 2 +local lane = 4 +if S.dir == dir then +if atc_arrow and not S.exiting then +split_off_locomotive("B0") +set_rc("PICKUP") +set_route("HYE"..lane, "HEADSHUNT") +end + +if atc_arrow and S.exiting then +set_rc("EXIT") + set_route("HYE"..lane, "EXIT") +S.exiting = false +end +elseif atc_arrow then +atc_send("B0WD1RS4") +end \ No newline at end of file diff --git a/Hyard/nodes/(-2598,12,-1780).lua b/Hyard/nodes/(-2598,12,-1780).lua new file mode 100644 index 0000000..aaf4293 --- /dev/null +++ b/Hyard/nodes/(-2598,12,-1780).lua @@ -0,0 +1,14 @@ +local dir = 1 +if S.dir == dir then +if atc_arrow and not S.exiting then +split_off_locomotive("B0") +set_rc("PICKUP") +end + +if atc_arrow and S.exiting then +set_rc("EXIT") +S.exiting = false +end +elseif atc_arrow then +atc_send("B0WD1RS4") +end \ No newline at end of file diff --git a/Hyard/nodes/(-2598,12,-1784).lua b/Hyard/nodes/(-2598,12,-1784).lua new file mode 100644 index 0000000..31d73ca --- /dev/null +++ b/Hyard/nodes/(-2598,12,-1784).lua @@ -0,0 +1,3 @@ +if not atc_arrow then +set_autocouple() +end \ No newline at end of file diff --git a/Hyard/nodes/(-2600,12,-1708).lua b/Hyard/nodes/(-2600,12,-1708).lua new file mode 100644 index 0000000..d87f3f9 --- /dev/null +++ b/Hyard/nodes/(-2600,12,-1708).lua @@ -0,0 +1,4 @@ + +if atc_arrow then +set_autocouple() +end \ No newline at end of file diff --git a/Hyard/nodes/(-2600,12,-1721).lua b/Hyard/nodes/(-2600,12,-1721).lua new file mode 100644 index 0000000..8766946 --- /dev/null +++ b/Hyard/nodes/(-2600,12,-1721).lua @@ -0,0 +1,17 @@ +local dir = 2 +local lane = 3 +if S.dir == dir then +if atc_arrow and not S.exiting then +split_off_locomotive("B0") +set_rc("PICKUP") +set_route("HYE"..lane, "HEADSHUNT") +end + +if atc_arrow and S.exiting then +set_rc("EXIT") + set_route("HYE"..lane, "EXIT") +S.exiting = false +end +elseif atc_arrow then +atc_send("B0WD1RS4") +end \ No newline at end of file diff --git a/Hyard/nodes/(-2600,12,-1780).lua b/Hyard/nodes/(-2600,12,-1780).lua new file mode 100644 index 0000000..aaf4293 --- /dev/null +++ b/Hyard/nodes/(-2600,12,-1780).lua @@ -0,0 +1,14 @@ +local dir = 1 +if S.dir == dir then +if atc_arrow and not S.exiting then +split_off_locomotive("B0") +set_rc("PICKUP") +end + +if atc_arrow and S.exiting then +set_rc("EXIT") +S.exiting = false +end +elseif atc_arrow then +atc_send("B0WD1RS4") +end \ No newline at end of file diff --git a/Hyard/nodes/(-2600,12,-1784).lua b/Hyard/nodes/(-2600,12,-1784).lua new file mode 100644 index 0000000..31d73ca --- /dev/null +++ b/Hyard/nodes/(-2600,12,-1784).lua @@ -0,0 +1,3 @@ +if not atc_arrow then +set_autocouple() +end \ No newline at end of file diff --git a/Hyard/nodes/(-2602,12,-1708).lua b/Hyard/nodes/(-2602,12,-1708).lua new file mode 100644 index 0000000..d87f3f9 --- /dev/null +++ b/Hyard/nodes/(-2602,12,-1708).lua @@ -0,0 +1,4 @@ + +if atc_arrow then +set_autocouple() +end \ No newline at end of file diff --git a/Hyard/nodes/(-2602,12,-1721).lua b/Hyard/nodes/(-2602,12,-1721).lua new file mode 100644 index 0000000..3d3cb4e --- /dev/null +++ b/Hyard/nodes/(-2602,12,-1721).lua @@ -0,0 +1,17 @@ +local dir = 2 +local lane = 2 +if S.dir == dir then +if atc_arrow and not S.exiting then +split_off_locomotive("B0") +set_rc("PICKUP") +set_route("HYE"..lane, "HEADSHUNT") +end + +if atc_arrow and S.exiting then +set_rc("EXIT") + set_route("HYE"..lane, "EXIT") +S.exiting = false +end +elseif atc_arrow then +atc_send("B0WD1RS4") +end \ No newline at end of file diff --git a/Hyard/nodes/(-2602,12,-1780).lua b/Hyard/nodes/(-2602,12,-1780).lua new file mode 100644 index 0000000..aaf4293 --- /dev/null +++ b/Hyard/nodes/(-2602,12,-1780).lua @@ -0,0 +1,14 @@ +local dir = 1 +if S.dir == dir then +if atc_arrow and not S.exiting then +split_off_locomotive("B0") +set_rc("PICKUP") +end + +if atc_arrow and S.exiting then +set_rc("EXIT") +S.exiting = false +end +elseif atc_arrow then +atc_send("B0WD1RS4") +end \ No newline at end of file diff --git a/Hyard/nodes/(-2602,12,-1784).lua b/Hyard/nodes/(-2602,12,-1784).lua new file mode 100644 index 0000000..31d73ca --- /dev/null +++ b/Hyard/nodes/(-2602,12,-1784).lua @@ -0,0 +1,3 @@ +if not atc_arrow then +set_autocouple() +end \ No newline at end of file diff --git a/Hyard/nodes/(-2603,12,-1784).lua b/Hyard/nodes/(-2603,12,-1784).lua new file mode 100644 index 0000000..31d73ca --- /dev/null +++ b/Hyard/nodes/(-2603,12,-1784).lua @@ -0,0 +1,3 @@ +if not atc_arrow then +set_autocouple() +end \ No newline at end of file diff --git a/Hyard/nodes/(-2603,9,-1659).lua b/Hyard/nodes/(-2603,9,-1659).lua new file mode 100644 index 0000000..6ef94f8 --- /dev/null +++ b/Hyard/nodes/(-2603,9,-1659).lua @@ -0,0 +1,9 @@ +atc_send("B0") +if S.rc then +interrupt(10, "recheck") +else +atc_send("S4") +S.dir = 1 +S.rc = get_rc() +set_route("HYENTRY1", "PICKUP") +end \ No newline at end of file diff --git a/Hyard/nodes/(-2604,12,-1708).lua b/Hyard/nodes/(-2604,12,-1708).lua new file mode 100644 index 0000000..d87f3f9 --- /dev/null +++ b/Hyard/nodes/(-2604,12,-1708).lua @@ -0,0 +1,4 @@ + +if atc_arrow then +set_autocouple() +end \ No newline at end of file diff --git a/Hyard/nodes/(-2604,12,-1721).lua b/Hyard/nodes/(-2604,12,-1721).lua new file mode 100644 index 0000000..1d2aaa9 --- /dev/null +++ b/Hyard/nodes/(-2604,12,-1721).lua @@ -0,0 +1,17 @@ +local dir = 2 +local lane = 1 +if S.dir == dir then +if atc_arrow and not S.exiting then +split_off_locomotive("B0") +set_rc("PICKUP") +set_route("HYE"..lane, "HEADSHUNT") +end + +if atc_arrow and S.exiting then +set_rc("EXIT") + set_route("HYE"..lane, "EXIT") +S.exiting = false +end +elseif atc_arrow then +atc_send("B0WD1RS4") +end \ No newline at end of file diff --git a/Hyard/nodes/(-2604,12,-1780).lua b/Hyard/nodes/(-2604,12,-1780).lua new file mode 100644 index 0000000..aaf4293 --- /dev/null +++ b/Hyard/nodes/(-2604,12,-1780).lua @@ -0,0 +1,14 @@ +local dir = 1 +if S.dir == dir then +if atc_arrow and not S.exiting then +split_off_locomotive("B0") +set_rc("PICKUP") +end + +if atc_arrow and S.exiting then +set_rc("EXIT") +S.exiting = false +end +elseif atc_arrow then +atc_send("B0WD1RS4") +end \ No newline at end of file diff --git a/Hyard/nodes/(-2609,13,-1724).lua b/Hyard/nodes/(-2609,13,-1724).lua new file mode 100644 index 0000000..c4bad90 --- /dev/null +++ b/Hyard/nodes/(-2609,13,-1724).lua @@ -0,0 +1 @@ +digiline_send("lcd", "Direction: "..S.dir.."\nCurrent FC:"..(S.fc or "").."\nCars in Pickup: "..(S.cars or 0).."\nRC: "..(S.rc or "")) \ No newline at end of file diff --git a/Hyard/nodes/(-2642,10,-1700).lua b/Hyard/nodes/(-2642,10,-1700).lua new file mode 100644 index 0000000..653af4d --- /dev/null +++ b/Hyard/nodes/(-2642,10,-1700).lua @@ -0,0 +1,8 @@ +if S.reversing and atc_arrow then +S.reversing = false +set_rc(S.rc) +elseif atc_arrow and S.exiting and S.rc:match("HYREVERSE") then +--set_rc("PICKUP") +--S.dir = 1 +--S.reversing = true +end \ No newline at end of file diff --git a/Tyard/init_code.lua b/Tyard/init_code.lua new file mode 100644 index 0000000..99b63e4 --- /dev/null +++ b/Tyard/init_code.lua @@ -0,0 +1,5 @@ +-- flag to hard enable RTS: +S.single_dir = true + + +F.EOL = function(direction,lane) if S.yard_active then if S.dir == direction then if atc_arrow then if not S.exiting then --return to PICKUP via headshunt split_off_locomotive("B0WR") set_rc("PICKUP") set_route("TY"..direction.."_"..lane, "HEADSHUNT") else --if S.exiting then loco has already sorted to correct lane for departure --S.exiting set by the pickup track set_rc(S.rc) set_route("TY"..direction.."_"..lane, "EXIT") S.exiting = nil end end else -- preparing for bi-directional. also EOL Bounce atc_send("B0WD1RS4") end end end \ No newline at end of file diff --git a/Tyard/nodes/(-4011,12,-2642).lua b/Tyard/nodes/(-4011,12,-2642).lua new file mode 100644 index 0000000..81a963d --- /dev/null +++ b/Tyard/nodes/(-4011,12,-2642).lua @@ -0,0 +1 @@ +if S.yard_active and atc_arrow then set_autocouple() end \ No newline at end of file diff --git a/Tyard/nodes/(-4011,12,-2646).lua b/Tyard/nodes/(-4011,12,-2646).lua new file mode 100644 index 0000000..3c9efc3 --- /dev/null +++ b/Tyard/nodes/(-4011,12,-2646).lua @@ -0,0 +1 @@ +--arrow points into yard -- config'd for Southbound entrance (North end of yard) local dir = "N" local entrance_signal = "Tyard_Enter_"..dir -- train enters from mainline. stop at signal to be safe if event.train and atc_arrow then atc_send("B0") end if atc_arrow then local rc = get_rc() or "" -- allow for manual working if rc:match("TYARD_NOSHUNT") then return end if S.yard_active then -- send train to "waiting" if can_set_route(entrance_signal,"WAITING") then set_route(entrance_signal,"WAITING") atc_set_text_outside("Waiting for yard to clear") atc_send("S6") else interrupt(5,"recheck") end else -- send train to "pickup" S.yard_active = true step_fc() local rc = get_rc() or "" S.rc = rc --check for RTS if S.single_dir == true or S.rc:match("TY_RTS") then S.dir = dir --working end = entrance dir S.RTS = true set_rc("AROUND_"..S.dir) else --invert S.dir --working end ~= entrance end if dir == "N" then S.dir = "S" else S.dir = "N" end end set_route(entrance_signal,"PICKUP") atc_set_text_outside("Proceeding to Classification Yard") atc_send("S4") end else -- train exiting set_rc(S.rc) S.yard_active = nil S.rc = nil S.dir = nil unset_autocouple() atc_send("SM") end \ No newline at end of file diff --git a/Tyard/nodes/(-4024,12,-2642).lua b/Tyard/nodes/(-4024,12,-2642).lua new file mode 100644 index 0000000..36743ff --- /dev/null +++ b/Tyard/nodes/(-4024,12,-2642).lua @@ -0,0 +1 @@ +if event.channel=="ops" or event.punch then digiline_send("lcd","Active:"..tostring(S.yard_active).."\nRC:"..tostring(S.rc).."\nRTS:"..tostring(S.RTS) .. " Dir:"..tostring(S.dir) .."\nExiting:"..tostring(S.exiting)) end \ No newline at end of file diff --git a/Tyard/nodes/(-4027,12,-2655).lua b/Tyard/nodes/(-4027,12,-2655).lua new file mode 100644 index 0000000..39f9b81 --- /dev/null +++ b/Tyard/nodes/(-4027,12,-2655).lua @@ -0,0 +1 @@ +--North pickup splitter local dir = "N" local lane = 0 --nothing below this line should indicate a hard direction --should be able to convert to function using only above args -------------------------------------------------- if S.yard_active then if atc_arrow then if S.dir == dir then set_route("TY"..dir.."_"..lane, "HEADSHUNT") local plen = train_length() local rc = split_at_fc("B0") local trc = "TY"..dir.."_"..rc if plen == train_length() and (rc == "" or S.rc:match(trc)) then S.exiting = true end if rc and rc ~= "" then set_rc("TY"..dir.."_"..rc) else set_rc(S.rc) S.exiting = true end else -- if S.dir ~= dir if S.RTS then -- loop around to other HS S.RTS = nil set_route("TY"..dir.."_"..lane,"AROUND") split_off_locomotive("B0") set_rc("AROUND_"..S.dir) return else atc_send("B0WRS4") end end end -- nothing to do if train goes against arrow end \ No newline at end of file diff --git a/Tyard/nodes/(-4027,12,-2731).lua b/Tyard/nodes/(-4027,12,-2731).lua new file mode 100644 index 0000000..b04ffad --- /dev/null +++ b/Tyard/nodes/(-4027,12,-2731).lua @@ -0,0 +1 @@ +--South pickup splitter local dir = "S" local lane = 0 --nothing below this line should indicate a hard direction --should be able to convert to function using only above args -------------------------------------------------- if S.yard_active then if atc_arrow then if S.dir == dir then set_route("TY"..dir.."_"..lane, "HEADSHUNT") local plen = train_length() local rc = split_at_fc("B0") local trc = "TY"..dir.."_"..rc if plen == train_length() and (rc == "" or S.rc:match(trc)) then S.exiting = true end if rc and rc ~= "" then set_rc("TY"..dir.."_"..rc) else set_rc(S.rc) S.exiting = true end else -- if S.dir ~= dir if S.RTS then -- loop around to other HS S.RTS = nil set_route("TY"..dir.."_"..lane,"AROUND") split_off_locomotive("B0") set_rc("AROUND_"..S.dir) return else atc_send("B0WRS4") end end end -- nothing to do if train goes against arrow end \ No newline at end of file diff --git a/Tyard/nodes/(-4031,12,-2655).lua b/Tyard/nodes/(-4031,12,-2655).lua new file mode 100644 index 0000000..b6c6d60 --- /dev/null +++ b/Tyard/nodes/(-4031,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",1) \ No newline at end of file diff --git a/Tyard/nodes/(-4031,12,-2731).lua b/Tyard/nodes/(-4031,12,-2731).lua new file mode 100644 index 0000000..c4c1959 --- /dev/null +++ b/Tyard/nodes/(-4031,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",1) \ No newline at end of file diff --git a/Tyard/nodes/(-4035,12,-2655).lua b/Tyard/nodes/(-4035,12,-2655).lua new file mode 100644 index 0000000..3fd7dcb --- /dev/null +++ b/Tyard/nodes/(-4035,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",2) \ No newline at end of file diff --git a/Tyard/nodes/(-4035,12,-2731).lua b/Tyard/nodes/(-4035,12,-2731).lua new file mode 100644 index 0000000..f15a717 --- /dev/null +++ b/Tyard/nodes/(-4035,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",2) \ No newline at end of file diff --git a/Tyard/nodes/(-4039,12,-2655).lua b/Tyard/nodes/(-4039,12,-2655).lua new file mode 100644 index 0000000..592871f --- /dev/null +++ b/Tyard/nodes/(-4039,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",3) \ No newline at end of file diff --git a/Tyard/nodes/(-4039,12,-2731).lua b/Tyard/nodes/(-4039,12,-2731).lua new file mode 100644 index 0000000..af4c22e --- /dev/null +++ b/Tyard/nodes/(-4039,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",3) \ No newline at end of file diff --git a/Tyard/nodes/(-4043,12,-2655).lua b/Tyard/nodes/(-4043,12,-2655).lua new file mode 100644 index 0000000..c86923a --- /dev/null +++ b/Tyard/nodes/(-4043,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",4) \ No newline at end of file diff --git a/Tyard/nodes/(-4043,12,-2731).lua b/Tyard/nodes/(-4043,12,-2731).lua new file mode 100644 index 0000000..9227db4 --- /dev/null +++ b/Tyard/nodes/(-4043,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",4) \ No newline at end of file diff --git a/Tyard/nodes/(-4047,12,-2655).lua b/Tyard/nodes/(-4047,12,-2655).lua new file mode 100644 index 0000000..3ce2888 --- /dev/null +++ b/Tyard/nodes/(-4047,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",5) \ No newline at end of file diff --git a/Tyard/nodes/(-4047,12,-2731).lua b/Tyard/nodes/(-4047,12,-2731).lua new file mode 100644 index 0000000..e953f0e --- /dev/null +++ b/Tyard/nodes/(-4047,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",5) \ No newline at end of file diff --git a/Tyard/nodes/(-4051,12,-2655).lua b/Tyard/nodes/(-4051,12,-2655).lua new file mode 100644 index 0000000..9e4298b --- /dev/null +++ b/Tyard/nodes/(-4051,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",6) \ No newline at end of file diff --git a/Tyard/nodes/(-4051,12,-2731).lua b/Tyard/nodes/(-4051,12,-2731).lua new file mode 100644 index 0000000..2fc4fc5 --- /dev/null +++ b/Tyard/nodes/(-4051,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",6) \ No newline at end of file diff --git a/Tyard/nodes/(-4055,12,-2655).lua b/Tyard/nodes/(-4055,12,-2655).lua new file mode 100644 index 0000000..4113ece --- /dev/null +++ b/Tyard/nodes/(-4055,12,-2655).lua @@ -0,0 +1 @@ +F.EOL("N",7) \ No newline at end of file diff --git a/Tyard/nodes/(-4055,12,-2731).lua b/Tyard/nodes/(-4055,12,-2731).lua new file mode 100644 index 0000000..edb2ef8 --- /dev/null +++ b/Tyard/nodes/(-4055,12,-2731).lua @@ -0,0 +1 @@ +F.EOL("S",7) \ No newline at end of file diff --git a/Tyard/nodes/(-4059,12,-2714).lua b/Tyard/nodes/(-4059,12,-2714).lua new file mode 100644 index 0000000..f89a6ec --- /dev/null +++ b/Tyard/nodes/(-4059,12,-2714).lua @@ -0,0 +1 @@ +--waiting lane -- config'd for the southbound-waiting lane -- train nose points south, using a north signal local dir = "N" local waiting_signal = "TY_WAITING_"..dir if S.yard_active then if atc_id then atc_send("B0") interrupt(10,"recheck") end else -- send train to "headshunt" if not atc_id then return end S.yard_active = true step_fc() local rc = get_rc() or "" S.rc = rc --check for RTS if S.single_dir == true or S.rc:match("TY_RTS") then S.dir = dir --working end = entrance dir S.RTS = true -- to direct train to PICKUP lane. AROUND_dir will be set by the pickup track else --invert S.dir --working end ~= entrance end if dir == "N" then S.dir = "S" else S.dir = "N" end end set_rc("PICKUP") set_route(waiting_signal,"HEADSHUNT") atc_set_text_outside("Proceeding to Classification Yard") atc_send("S0WRS4") end \ No newline at end of file diff --git a/Tyard/nodes/(-4063,12,-2669).lua b/Tyard/nodes/(-4063,12,-2669).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/Tyard/nodes/(-4063,12,-2669).lua @@ -0,0 +1 @@ +-- \ No newline at end of file diff --git a/durt/init_code.lua b/durt/init_code.lua index 831063c..b0b017a 100644 --- a/durt/init_code.lua +++ b/durt/init_code.lua @@ -1 +1 @@ -S.lines = { S23 = { termini = { N = "Arc", S = "Rew" }, stations = { Rew = { name = "Redwood", doors = "L", next_station = { N = "Thc", S = false }, }, Thc = { name = "Tanh Cliffs", doors = "L", next_station = { N = "Noi", S = "Rew" }, }, Noi = { name = "No Idea", doors = "L", next_station = { N = "Lzf", S = "Thc" }, }, Lzf = { name = "Laza's Field", doors = "L", next_station = { N = "Bbh", S = "Noi" }, }, Bbh = { name = "Bamboo Hills", doors = "L", next_station = { N = "Arc", S = "Lzf" }, }, Arc = { name = "Arcadius", doors = "L", next_station = { N = false, S = "Bbh" }, } }, monitoring = { N = {}, S = {} } }, U21 = { termini = { E = "Tro", W = "Dbl" }, stations = { Dbl = { name = "Dubulti", doors = "R", next_station = { E = "Pav", W = "Ghd" } }, Pav = { name = "Pence Avenue", doors = "L", next_station = { E = "Ghd", W = "Dbl" } }, Ghd = { name = "Greenhat Mountain", doors = "L", next_station = { E = "Acm", W = "Dbl" } }, Acm = { name = "Acacia Mountains", doors = "L", next_station = { E = "Ghb", W = "Ghd" } }, Ghb = { name = "Green Hill Beach", doors = "L", next_station = { E = "Ged", W = "Acm" } }, Ged = { name = "Green Edge", doors = "L", next_station = { E = "Dri", W = "Ghb" } }, Dri = { name = "Dry Island", doors = "L", next_station = { E = "Gcl", W = "Ged" } }, Gcl = { name = "Green Cliffs", doors = "R", next_station = { E ="Sfs", W = "Dri" } }, Sfs = { name = "South Forest", doors = "R", next_station = { E = "Jms", W = "Gcl" } }, Jms = { name = "Jude Milhon Street", doors = "R", next_station = { E = "Bam", W = "Sfs" } }, Bam = { name = "Bamboo Hills", doors = "R", next_station = { E = "Cli", W = "Jms" } }, Cli = { name = "Clown Island", doors = "R", next_station = { E = "Wat", W = "Bam" } }, Wat = { name = "Something in the Water", doors = "L", next_station = { E = "Duf", W = "Cli" } }, Duf = { name = "Duff Rd", doors = "R", next_station = { E = "Tro", W = "Wat" } }, Tro = { name = "Turtle Rock", doors = "L", next_station = { E = false, W = "Duf" }, } }, monitoring = { E = {}, W = {}, S = {}, N = {} } } } S.runarounds = { ["TheStacks"] = {}, ["M27_Quarry_runaround"] = {}, } --------------------------------------------------------------------- --defining the functions F.arrive = function(stn_code,dir,line) S.lines[line].monitoring[dir][stn_code] = atc_id atc_send("B0 W O"..S.lines[line].stations[stn_code].doors) atc_set_text_inside("Arrived at:\n"..S.lines[line].stations[stn_code].name.."\n \nNext Station:\n"..S.lines[line].stations[S.lines[line].stations[stn_code].next_station[dir]].name) end F.depart = function(stn_code,dir,line) local pos = stn_code..dir local inside_text = "Next Stop:\n"..S.lines[line].stations[S.lines[line].stations[stn_code].next_station[dir]].name if can_set_route(pos,stn_code.."->"..S.lines[line].stations[stn_code].next_station[dir]) then set_route(pos,stn_code.."->"..S.lines[line].stations[stn_code].next_station[dir]) atc_send("OC SM") S.lines[line].monitoring[dir][stn_code] = nil S.lines[line].monitoring[dir][S.lines[line].stations[stn_code].next_station[dir]] = atc_id else -- Wait another 5s before trying again inside_text = inside_text.."\nWaiting to depart..." interrupt(5, "depart") end atc_set_text_inside(inside_text) end F.set_desto = function(dir, line) atc_set_text_outside("LINE " .. line .."\n---> " .. S.lines[line].stations[S.lines[line].termini[dir]].name) end --------------------------------------------------------------------- --LuaATC track functions F.station = function(stn_code,dir,line) -- temp until all SF LuaAtc tracks are changed------------------------- if line == nil or line == "1" then line = "U21" end --------------------------------------------------------------------- if event.train then F.arrive(stn_code,dir,line) interrupt(10,"depart") elseif event.int and event.msg=="depart" then F.depart(stn_code,dir,line) end end F.terminus = function(stn_code, newdir, line) if event.train then S.lines[line].monitoring[newdir][stn_code] = atc_id atc_send("B0 W R O"..S.lines[line].stations[stn_code].doors) atc_set_text_inside("Arrived at:\n"..S.lines[line].stations[stn_code].name.."\n \nNext Station:\n"..S.lines[line].stations[S.lines[line].stations[stn_code].next_station[newdir]].name) atc_set_text_outside("LINE " .. line .."\n---> " .. S.lines[line].stations[S.lines[line].termini[newdir]].name) interrupt(10, "depart") end if event.int and event.msg == "depart" then F.depart(stn_code, newdir,line) end end \ No newline at end of file +S.lines = { S23 = { termini = { N = "Arc", S = "Rew" }, stations = { Rew = { name = "Redwood", doors = "L", next_station = { N = "Thc", S = false }, }, Thc = { name = "Tanh Cliffs", doors = "L", next_station = { N = "Noi", S = "Rew" }, }, Noi = { name = "No Idea", doors = "L", next_station = { N = "Lzf", S = "Thc" }, }, Lzf = { name = "Laza's Field", doors = "L", next_station = { N = "Bbh", S = "Noi" }, }, Bbh = { name = "Bamboo Hills", doors = "L", next_station = { N = "Arc", S = "Lzf" }, }, Arc = { name = "Arcadius", doors = "L", next_station = { N = false, S = "Bbh" }, } }, monitoring = { N = {}, S = {} } }, U21 = { termini = { E = "Tro", W = "Dbl" }, stations = { Dbl = { name = "Dubulti", doors = "R", next_station = { E = "Pav", W = "Ghd" } }, Pav = { name = "Pence Avenue", doors = "L", next_station = { E = "Ghd", W = "Dbl" } }, Ghd = { name = "Greenhat Mountain", doors = "L", next_station = { E = "Acm", W = "Dbl" } }, Acm = { name = "Acacia Mountains", doors = "L", next_station = { E = "Ghb", W = "Ghd" } }, Ghb = { name = "Green Hill Beach", doors = "L", next_station = { E = "Ged", W = "Acm" } }, Ged = { name = "Green Edge", doors = "L", next_station = { E = "Dri", W = "Ghb" } }, Dri = { name = "Dry Island", doors = "L", next_station = { E = "Gcl", W = "Ged" } }, Gcl = { name = "Green Cliffs", doors = "R", next_station = { E ="Sfs", W = "Dri" } }, Sfs = { name = "South Forest", doors = "R", next_station = { E = "Jms", W = "Gcl" } }, Jms = { name = "Jude Milhon Street", doors = "R", next_station = { E = "Bam", W = "Sfs" } }, Bam = { name = "Bamboo Hills", doors = "R", next_station = { E = "Cli", W = "Jms" } }, Cli = { name = "Clown Island", doors = "R", next_station = { E = "Wat", W = "Bam" } }, Wat = { name = "Something in the Water", doors = "L", next_station = { E = "Duf", W = "Cli" } }, Duf = { name = "Duff Rd", doors = "R", next_station = { E = "Tro", W = "Wat" } }, Tro = { name = "Turtle Rock", doors = "L", next_station = { E = false, W = "Duf" }, } }, monitoring = { E = {}, W = {}, S = {}, N = {} } } } S.runarounds = { ["TheStacks"] = {}, ["M27_Quarry_runaround"] = {}, ["M27_Breaker_Factory"] = {}, } --------------------------------------------------------------------- --defining the functions F.arrive = function(stn_code,dir,line) S.lines[line].monitoring[dir][stn_code] = atc_id atc_send("B0 W O"..S.lines[line].stations[stn_code].doors) atc_set_text_inside("Arrived at:\n"..S.lines[line].stations[stn_code].name.."\n \nNext Station:\n"..S.lines[line].stations[S.lines[line].stations[stn_code].next_station[dir]].name) end F.depart = function(stn_code,dir,line) local pos = stn_code..dir local inside_text = "Next Stop:\n"..S.lines[line].stations[S.lines[line].stations[stn_code].next_station[dir]].name if can_set_route(pos,stn_code.."->"..S.lines[line].stations[stn_code].next_station[dir]) then set_route(pos,stn_code.."->"..S.lines[line].stations[stn_code].next_station[dir]) atc_send("OC SM") S.lines[line].monitoring[dir][stn_code] = nil S.lines[line].monitoring[dir][S.lines[line].stations[stn_code].next_station[dir]] = atc_id else -- Wait another 5s before trying again inside_text = inside_text.."\nWaiting to depart..." interrupt(5, "depart") end atc_set_text_inside(inside_text) end F.set_desto = function(dir, line) atc_set_text_outside("LINE " .. line .."\n---> " .. S.lines[line].stations[S.lines[line].termini[dir]].name) end --------------------------------------------------------------------- --LuaATC track functions F.station = function(stn_code,dir,line) -- temp until all SF LuaAtc tracks are changed------------------------- if line == nil or line == "1" then line = "U21" end --------------------------------------------------------------------- if event.train then F.arrive(stn_code,dir,line) interrupt(10,"depart") elseif event.int and event.msg=="depart" then F.depart(stn_code,dir,line) end end F.terminus = function(stn_code, newdir, line) if event.train then S.lines[line].monitoring[newdir][stn_code] = atc_id atc_send("B0 W R O"..S.lines[line].stations[stn_code].doors) atc_set_text_inside("Arrived at:\n"..S.lines[line].stations[stn_code].name.."\n \nNext Station:\n"..S.lines[line].stations[S.lines[line].stations[stn_code].next_station[newdir]].name) atc_set_text_outside("LINE " .. line .."\n---> " .. S.lines[line].stations[S.lines[line].termini[newdir]].name) interrupt(10, "depart") end if event.int and event.msg == "depart" then F.depart(stn_code, newdir,line) end end \ No newline at end of file diff --git a/durt/nodes/(-2147,20,777).lua b/durt/nodes/(-2147,20,777).lua new file mode 100644 index 0000000..467f0f9 --- /dev/null +++ b/durt/nodes/(-2147,20,777).lua @@ -0,0 +1,7 @@ +if event.type == "train" then + rc = get_rc() + if rc:find("apprentice_leave") ~= nil then + rc = rc:gsub("apprentice_leave", "apprentice_unload") + end + set_rc(rc) +end \ No newline at end of file diff --git a/durt/nodes/(-2153,20,769).lua b/durt/nodes/(-2153,20,769).lua new file mode 100644 index 0000000..27ed074 --- /dev/null +++ b/durt/nodes/(-2153,20,769).lua @@ -0,0 +1,9 @@ +if event.type == "train" then + local rc = get_rc() + if rc:find("apprentice_unload") ~= nil then + rc = rc:gsub("apprentice_unload", "apprentice_load") + elseif rc:find("apprentice_load") ~= nil then + rc = rc:gsub("apprentice_load", "apprentice_leave") + end + set_rc(rc) +end \ No newline at end of file diff --git a/durt/nodes/(-3588,8,-2277).lua b/durt/nodes/(-3588,8,-2277).lua index 0858265..4e7fb2e 100644 --- a/durt/nodes/(-3588,8,-2277).lua +++ b/durt/nodes/(-3588,8,-2277).lua @@ -1 +1 @@ ---train splitter track mainline_line = "Maverick2797_diamonds" mainline_rc = "autorun FREIGHT" text_outside = "DURT Logs to Diamonds Conversion Train" loading_stopper_sig = POS(-3594,9,-2277) split_around = function() if ((atc_speed==0) and can_set_route(loading_stopper_sig,"Shunt Around Via Loop")) then split_at_index(2,"") atc_send("S4") set_route(loading_stopper_sig,"Shunt Around Via Loop") return else interrupt(2,"split_around") return end end if event.train then if not atc_arrow then atc_send("B1S1") return end if get_rc() == "split_around" then atc_send("B0") split_around() return else --rejoined from splitting or arriving train atc_send("B0S0WD2RS1") set_line(mainline_line) set_rc(mainline_rc) atc_set_text_outside(text_outside) atc_set_text_inside("Loading Cargo") return end end if event.type=="int" then if event.message=="split_around" then split_around() return end return end \ No newline at end of file +--train splitter track mainline_line = "Maverick2797_diamonds" mainline_rc = "autorun FREIGHT" text_outside = "DURT Logs to Diamonds Conversion Train" loading_stopper_sig = POS(-3594,9,-2277) split_around = function() if ((atc_speed==0) and can_set_route(loading_stopper_sig,"Shunt Around Via Loop")) then set_autocouple() split_at_index(2,"S0") atc_send("S4") set_route(loading_stopper_sig,"Shunt Around Via Loop") return else interrupt(2,"split_around") return end end if event.train then if not atc_arrow then atc_send("B1S1") return end if get_rc() == "split_around" then atc_send("B0") split_around() return else --rejoined from splitting or arriving train atc_send("B0S0WD2RS1") set_line(mainline_line) set_rc(mainline_rc) atc_set_text_outside(text_outside) atc_set_text_inside("Loading Cargo") unset_autocouple() return end end if event.type=="int" then if event.message=="split_around" then split_around() return end return end \ No newline at end of file diff --git a/durt/nodes/(-541,26,2469).lua b/durt/nodes/(-541,26,2469).lua new file mode 100644 index 0000000..ea080ea --- /dev/null +++ b/durt/nodes/(-541,26,2469).lua @@ -0,0 +1 @@ +-- arrow points towards loco HS for Bounce local lane = 1 if S.yard_active then if atc_arrow and S.exiting then set_rc("EXIT") set_route("CANNERY_W"..lane, "EXIT") atc_send("B0WRD1SM") else atc_send("B0WD1RS4") end end \ No newline at end of file diff --git a/durt/nodes/(-541,26,2472).lua b/durt/nodes/(-541,26,2472).lua new file mode 100644 index 0000000..d5d7bd4 --- /dev/null +++ b/durt/nodes/(-541,26,2472).lua @@ -0,0 +1 @@ +-- arrow points towards loco HS for Bounce local lane = 2 if S.yard_active then if atc_arrow and S.exiting then set_rc("EXIT") set_route("CANNERY_W"..lane, "EXIT") atc_send("B0WRD1SM") else atc_send("B0WD1RS4") end end \ No newline at end of file diff --git a/durt/nodes/(-541,26,2475).lua b/durt/nodes/(-541,26,2475).lua new file mode 100644 index 0000000..58c5e8b --- /dev/null +++ b/durt/nodes/(-541,26,2475).lua @@ -0,0 +1 @@ +-- arrow points towards loco HS for Bounce local lane = 3 if S.yard_active then if atc_arrow and S.exiting then set_rc("EXIT") set_route("CANNERY_W"..lane, "EXIT") atc_send("B0WRD1SM") else atc_send("B0WD1RS4") end end \ No newline at end of file diff --git a/durt/nodes/(-549,26,2478).lua b/durt/nodes/(-549,26,2478).lua new file mode 100644 index 0000000..90eb7a9 --- /dev/null +++ b/durt/nodes/(-549,26,2478).lua @@ -0,0 +1 @@ +--LOCO SPLITTER local lane = 4 if S.yard_active then if not S.first_pass then S.first_pass = true set_route("CANNERY_E"..lane,"HEADSHUNT") split_off_locomotive("B0") set_rc("AROUND") else -- has collected wagons, now bounce back to sorting splitter atc_send("B0WRD1S4") end end \ No newline at end of file diff --git a/durt/nodes/(-585,26,2478).lua b/durt/nodes/(-585,26,2478).lua new file mode 100644 index 0000000..23d349b --- /dev/null +++ b/durt/nodes/(-585,26,2478).lua @@ -0,0 +1 @@ +--arrow points west towards working HS local lane = 4 if S.yard_active == true then if atc_arrow then set_route("CANNERY_W"..lane, "HEADSHUNT") -- turnouts should already be set by the train returning from HS local plen = train_length() local rc = split_at_fc("B0") local trc = "CAN_"..rc if plen == train_length() and (rc == "" or S.rc:match(trc)) then S.exiting = true end if rc and rc ~= "" then set_rc("CAN_"..rc) else set_rc(S.rc) S.exiting = true end end end \ No newline at end of file diff --git a/durt/nodes/(-612,28,2482).lua b/durt/nodes/(-612,28,2482).lua new file mode 100644 index 0000000..399a841 --- /dev/null +++ b/durt/nodes/(-612,28,2482).lua @@ -0,0 +1 @@ +if event.channel=="ops" or event.punch then digiline_send("lcd","Yard Active:"..tostring(S.yard_active).."\nRC:"..tostring(S.rc).."\nfirst_pass:"..tostring(S.first_pass).."\nexiting:"..tostring(S.exiting)) end \ No newline at end of file diff --git a/durt/nodes/(-621,26,2469).lua b/durt/nodes/(-621,26,2469).lua new file mode 100644 index 0000000..80f4e52 --- /dev/null +++ b/durt/nodes/(-621,26,2469).lua @@ -0,0 +1 @@ +-- arrow points towards Sorting HS for Bounce local lane = 1 if S.yard_active == true then if (atc_arrow and not S.exiting) then split_off_locomotive("B0WR") set_route("CANNERY_W"..lane,"HEADSHUNT") set_rc("PICKUP") elseif atc_arrow and S.exiting then set_route("CANNERY_W"..lane,"EXIT") end end \ No newline at end of file diff --git a/durt/nodes/(-621,26,2472).lua b/durt/nodes/(-621,26,2472).lua new file mode 100644 index 0000000..de4552e --- /dev/null +++ b/durt/nodes/(-621,26,2472).lua @@ -0,0 +1 @@ +-- arrow points towards Sorting HS for Bounce local lane = 2 if S.yard_active == true then if (atc_arrow and not S.exiting) then split_off_locomotive("B0WR") set_route("CANNERY_W"..lane,"HEADSHUNT") set_rc("PICKUP") elseif atc_arrow and S.exiting then set_route("CANNERY_W"..lane,"EXIT") end end \ No newline at end of file diff --git a/durt/nodes/(-621,26,2475).lua b/durt/nodes/(-621,26,2475).lua new file mode 100644 index 0000000..35e4773 --- /dev/null +++ b/durt/nodes/(-621,26,2475).lua @@ -0,0 +1 @@ +-- arrow points towards Sorting HS for Bounce local lane = 3 if S.yard_active == true then if (atc_arrow and not S.exiting) then split_off_locomotive("B0WR") set_route("CANNERY_W"..lane,"HEADSHUNT") set_rc("PICKUP") elseif atc_arrow and S.exiting then set_route("CANNERY_W"..lane,"EXIT") end end \ No newline at end of file diff --git a/durt/nodes/(-638,26,2475).lua b/durt/nodes/(-638,26,2475).lua new file mode 100644 index 0000000..2b808a1 --- /dev/null +++ b/durt/nodes/(-638,26,2475).lua @@ -0,0 +1 @@ +--Yard Exit --arrow points away from yard if S.yard_active == true then if atc_arrow then --exiting yard after shunt sequence set_rc(S.rc) S.yard_active = nil S.rc = nil S.first_pass = nil S.exiting = nil unset_autocouple() end end \ No newline at end of file diff --git a/durt/nodes/(-646,26,2469).lua b/durt/nodes/(-646,26,2469).lua new file mode 100644 index 0000000..1158ddb --- /dev/null +++ b/durt/nodes/(-646,26,2469).lua @@ -0,0 +1,6 @@ +-- +if S.yard_active then + if atc_arrow then + set_autocouple() + end +end \ No newline at end of file diff --git a/durt/nodes/(-678,20,2478).lua b/durt/nodes/(-678,20,2478).lua new file mode 100644 index 0000000..7b0b847 --- /dev/null +++ b/durt/nodes/(-678,20,2478).lua @@ -0,0 +1,2 @@ +-- approach siding atc_send("B0") if S.yard_active then interrupt(10, "recheck") else atc_send("S4") S.rc = get_rc() step_fc() S.yard_active = true set_route("CANNERY_WAITING", "APPROACH YARD") +set_route("CANNERY_APPROACH","PICKUP") end \ No newline at end of file diff --git a/durt/nodes/(415,17,19).lua b/durt/nodes/(415,17,19).lua new file mode 100644 index 0000000..be6f093 --- /dev/null +++ b/durt/nodes/(415,17,19).lua @@ -0,0 +1 @@ +if event.punch or (event.channel=="clock" and event.msg=="pulse")then local line = "U21" local info = S.lines[line].monitoring digiline_send("status_update",info) end \ No newline at end of file diff --git a/durt/nodes/(527,-3,-1959).lua b/durt/nodes/(527,-3,-1959).lua index f137323..e7213ad 100644 --- a/durt/nodes/(527,-3,-1959).lua +++ b/durt/nodes/(527,-3,-1959).lua @@ -5,7 +5,7 @@ if atc_arrow then atc_set_text_inside("DEPOT") else atc_send("SM") - set_line("1") + set_line("21") 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 index da5fd9f..f734da7 100644 --- a/durt/nodes/(529,-3,-1954).lua +++ b/durt/nodes/(529,-3,-1954).lua @@ -1,6 +1,6 @@ if atc_arrow then atc_send("SM") - set_line("1") + set_line("21") atc_set_text_outside("Line 21\n---> Turtle Rock") atc_set_text_inside("Next stop: Clown Island") else diff --git a/il_timetable/init_code.lua b/il_timetable/init_code.lua index 919b007..313075b 100644 --- a/il_timetable/init_code.lua +++ b/il_timetable/init_code.lua @@ -18,6 +18,7 @@ function F.stop_sd(st_name, doors, departcommand, minstoptime, d_int, d_off) end function F.stop_sd_sched(st_name, doors, departcommand, minstoptime, d_int, d_off) + depart = false if event.train then local time_now = rwt.now() local next_dep_time = rwt.next_rpt(rwt.add(time_now, minstoptime), d_int, d_off) @@ -29,6 +30,7 @@ function F.stop_sd_sched(st_name, doors, departcommand, minstoptime, d_int, d_of atc_send("OCD1"..departcommand) digiline_send("monitor", "Last Departure: | "..rwt.to_string(rwt.now(), true)) atc_set_text_inside("") + depart = true end end diff --git a/il_timetable/nodes/(943,14,1025).lua b/il_timetable/nodes/(943,14,1025).lua new file mode 100644 index 0000000..b94fa87 --- /dev/null +++ b/il_timetable/nodes/(943,14,1025).lua @@ -0,0 +1 @@ +setstate("Ehl6ARSPreventer", "cr") \ 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 1db46f4..74760fd 100644 --- a/il_timetable/nodes/(957,14,1047).lua +++ b/il_timetable/nodes/(957,14,1047).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", "SM", 10, 60, 0) \ No newline at end of file +F.stop_sd_sched("Ehlodex", "R", "SM", 10, 60, 0) +if depart then + setstate("Ehl6ARSPreventer", "st") +end \ No newline at end of file diff --git a/nlvcross/nodes/(-435,20,-328).lua b/nlvcross/nodes/(-435,20,-328).lua index f16a73d..b67d370 100644 --- a/nlvcross/nodes/(-435,20,-328).lua +++ b/nlvcross/nodes/(-435,20,-328).lua @@ -1,2 +1,2 @@ -F.on("MOriStn", "R2") +--F.on("MOriStn", "R2") F.off("LovelaceAve", 2) \ No newline at end of file diff --git a/ondemand/nodes/(-543,-5,-772).lua b/ondemand/nodes/(-543,-5,-772).lua new file mode 100644 index 0000000..6fc7189 --- /dev/null +++ b/ondemand/nodes/(-543,-5,-772).lua @@ -0,0 +1,3 @@ +depart=false +F.stn("Wbb3N", "Rsi3N", "Leo3N", "L") +F.stat("Line 3", false) \ No newline at end of file diff --git a/subway/init_code.lua b/subway/init_code.lua index 2eb400e..ebe0781 100644 --- a/subway/init_code.lua +++ b/subway/init_code.lua @@ -304,26 +304,34 @@ F.stat=function(line, 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)..")".. - " RTT: "..math.floor(a_rtt).."("..(time - time_rt)..")" + " Tmx:"..math.floor(a_tbtmax).."("..c_tbtmax..")".. + " R:"..math.floor(a_rtt).."("..(time - time_rt)..")" ) time_lt = time if atc_id == reftrain then diff --git a/subway/nodes/(-1025,10,226).lua b/subway/nodes/(-1025,10,226).lua index 6c765e1..83dd2b8 100644 --- a/subway/nodes/(-1025,10,226).lua +++ b/subway/nodes/(-1025,10,226).lua @@ -1,2 +1,2 @@ F.stn_return("Ahr3N", "Ahz3R", "Ahr3S", "L", "Ahz3ES", "cr") -F.lineset("3", "N") \ No newline at end of file +F.lineset("3", "S") \ No newline at end of file diff --git a/subway/nodes/(10,0,-10).lua b/subway/nodes/(10,0,-10).lua index 0585cbf..bc56a91 100644 --- a/subway/nodes/(10,0,-10).lua +++ b/subway/nodes/(10,0,-10).lua @@ -1,6 +1,6 @@ -- digiline_send("l14e", "SIS Variant 2 - v1.4 | No info avaliable") -local appr_time = 20 +local appr_time = 15 local dnnapprt=15 if not appr_tmr then appr_tmr = 0 end local setint = false @@ -87,7 +87,7 @@ if dd_line and nwt then end digiline_send("l14e", line1.." | "..line2.." | "..line3.." | ----------- | "..line4) -digiline_send("l14eint", "in_stn: "..(in_stn or "-").." "..appr_tmr.."s".." | n_appr: "..(n_appr or "-").." | n_wait: "..(n_wait or "-").. " | "..event.type.." | "..(event.message or "-")) +digiline_send("l14eint", "in_st:"..(in_stn or "-").." "..appr_tmr.."s".." | n_appr: "..(n_appr or "-").." | n_wait: "..(n_wait or "-").. " | "..event.type.." | "..(event.message or "-")) if (appr_tmr > 0 or nnwaiting) and setint then interrupt(5, "appr") diff --git a/subway/nodes/(787,8,-103).lua b/subway/nodes/(787,8,-103).lua new file mode 100644 index 0000000..34d04ad --- /dev/null +++ b/subway/nodes/(787,8,-103).lua @@ -0,0 +1,3 @@ +--F.stn_return("Dam2N", "Dam2R", "Dam2S", "R", "Dam2ES", "cr", 6, nil, 20) +F.stat("Line 2", false) +atc_set_text_outside("Line 2 - Chasm of Segfault") \ No newline at end of file -- cgit v1.2.3