diff options
author | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:52:38 +0200 |
---|---|---|
committer | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:52:38 +0200 |
commit | cfa65d94f1bc9d9e9efe13791711a9ad044a4a67 (patch) | |
tree | bdecc9982a58cb88367e4e8b1fcd9cfa1f95573e /durt | |
parent | f3da24b214b3337ad63ebd885da29d5b789d4738 (diff) | |
download | luaatc_envs-cfa65d94f1bc9d9e9efe13791711a9ad044a4a67.tar.gz luaatc_envs-cfa65d94f1bc9d9e9efe13791711a9ad044a4a67.tar.bz2 luaatc_envs-cfa65d94f1bc9d9e9efe13791711a9ad044a4a67.zip |
State at 2021-04-04
Diffstat (limited to 'durt')
42 files changed, 147 insertions, 6 deletions
diff --git a/durt/init_code.lua b/durt/init_code.lua index c264a3a..af89c7c 100644 --- a/durt/init_code.lua +++ b/durt/init_code.lua @@ -11,4 +11,59 @@ S.M27_tracking = {} -- -3602,18,-3961 Willow Tunnel <-> Djnc
-- -3602.18.-3961 Djnc<->Dcaves -- -2345,15,-1336 Tanh Depot
-- -1986,13,-1699 x2 Foundry entry -F.M27_tracking = function(id)
if not event.train then return end
local rc = get_rc() or ""
if not rc:match("M27_tracking") then return end
S.M27_tracking.last = S.M27_tracking.now
S.M27_tracking.now = id
end
---------------------------------------------------------------------
--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 +F.M27_tracking = function(id)
if not event.train then return end
local rc = get_rc() or ""
if not rc:match("M27_tracking") then return end
S.M27_tracking.last = S.M27_tracking.now
S.M27_tracking.now = id
end + +--Atlac Yard Operations +if event.init then + local list_of_yards = { + ["WOA"] = {} + } + S.yards = S.yards or list_of_yards +end + +F.yard_road_count = function(yard,section_id,monitoring_light)
if not S.yards[yard][section_id] then S.yards[yard][section_id] = {['car_count'] = 0} end
local car_count = S.yards[yard][section_id].car_count
if event.train then
if atc_arrow then --arrow points into section, add to length
car_count = car_count + train_length()
else -- subtract from
car_count = car_count - train_length()
end
if car_count > 0 then -- light = on
setstate(monitoring_light,"on")
else
car_count = 0
setstate(monitoring_light,"off")
end
S.yards[yard][section_id].car_count = car_count
end
end + + +--stats counter from subway/il_timetable +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 +
---------------------------------------------------------------------
--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/(-1924,13,-1696).lua b/durt/nodes/(-1924,13,-1696).lua new file mode 100644 index 0000000..74c05cc --- /dev/null +++ b/durt/nodes/(-1924,13,-1696).lua @@ -0,0 +1 @@ +__approach_callback_mode = 1
if not atc_id or not atc_arrow then return end
if event.approach and not event.has_entered then
atc_set_lzb_tsr(2)
end
if event.train and atc_arrow then
atc_send("S1")
end
\ No newline at end of file diff --git a/durt/nodes/(-1987,13,-1700).lua b/durt/nodes/(-1987,13,-1700).lua index 00818fd..fc6a367 100644 --- a/durt/nodes/(-1987,13,-1700).lua +++ b/durt/nodes/(-1987,13,-1700).lua @@ -1 +1,4 @@ +if event.train and atc_arrow and atc_speed == 1 then + atc_send("SM") +end F.M27_tracking("Exit Foundry")
\ No newline at end of file diff --git a/durt/nodes/(-2084,9,918).lua b/durt/nodes/(-2084,9,918).lua index ae8e76f..dbf9fcf 100644 --- a/durt/nodes/(-2084,9,918).lua +++ b/durt/nodes/(-2084,9,918).lua @@ -1 +1 @@ -if event.type=="digiline" then
if event.channel ~= "trainctl" then return end
if event.msg == "send" then
setstate(POS(-2085,11,918),"green")
if atc_id and atc_arrow then
atc_send("B5S5")
elseif atc_id and atc_arrow == false then
atc_send("B0S0WRS5")
end
interrupt(10,"clear_signal")
return
elseif event.msg == "open" then
setstate(POS(-2085,11,918),"green")
return
elseif event.msg == "close" then
setstate(POS(-2085,11,918),"red")
return
end
return
end
if event.type=="int" then
if event.msg=="clear_signal" then
setstate(POS(-2085,11,918),"red")
end
return
end
\ No newline at end of file +if event.type=="digiline" then
if event.channel ~= "trainctl" then return end
if event.msg == "send" then
setstate(POS(-2085,11,918),"green")
setstate(POS(-2084,9,915),"on")
if atc_id and atc_arrow then
atc_send("S0B0WRD1RB5S5")
elseif atc_id and atc_arrow == false then
atc_send("B0S0WRS5")
end
interrupt(10,"clear_signal")
return
elseif event.msg == "open" then
setstate(POS(-2085,11,918),"green")
setstate(POS(-2084,9,915),"on")
return
elseif event.msg == "close" then
setstate(POS(-2085,11,918),"red")
setstate(POS(-2084,9,915),"off")
return
end
return
end
if event.type=="int" then
if event.msg=="clear_signal" then
setstate(POS(-2085,11,918),"red")
end
return
end
\ No newline at end of file diff --git a/durt/nodes/(-2213,8,898).lua b/durt/nodes/(-2213,8,898).lua new file mode 100644 index 0000000..3d93bd0 --- /dev/null +++ b/durt/nodes/(-2213,8,898).lua @@ -0,0 +1 @@ +if event.type=="digiline" then
if event.channel ~= "trainctl" then return end
if event.msg == "send" then
if atc_id and atc_arrow then
atc_send("S0WRS4")
elseif atc_id and atc_arrow == false then
atc_send("S4")
end
end
end
\ No newline at end of file diff --git a/durt/nodes/(-2732,11,891).lua b/durt/nodes/(-2732,11,891).lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/durt/nodes/(-2732,11,891).lua diff --git a/durt/nodes/(-2734,11,891).lua b/durt/nodes/(-2734,11,891).lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/durt/nodes/(-2734,11,891).lua diff --git a/durt/nodes/(-3525,8,-2281).lua b/durt/nodes/(-3525,8,-2281).lua index 6bb5ea1..cb3c02c 100644 --- a/durt/nodes/(-3525,8,-2281).lua +++ b/durt/nodes/(-3525,8,-2281).lua @@ -1,3 +1,8 @@ if event.train then - if not atc_arrow then atc_send("S1B1") end + if not atc_arrow then + atc_send("S1B1") + set_autocouple() + else + digiline_send("lcd",atc_id) + end end
\ No newline at end of file diff --git a/durt/nodes/(-3544,8,-2277).lua b/durt/nodes/(-3544,8,-2277).lua index e6d9f27..37c1019 100644 --- a/durt/nodes/(-3544,8,-2277).lua +++ b/durt/nodes/(-3544,8,-2277).lua @@ -1 +1 @@ -
--East End of Loading Road
local siding_id = "TreeFarm"
local control_interface = POS(-3553,18,-2261)
local loading_sig = POS(-3539,9,-2279)
local exit_route = "Exit to Mainline"
local accelerator_loop_diverge_sig = POS(-3602,9,-2282)
if event.type=="ext_int" then
if not atc_id then
interrupt_pos(control_interface,"No Train at Signal")
return
elseif atc_speed ~= 0 then
interrupt_pos(control_interface,"Train Still Moving")
return
end
if event.message == "shuffle" then
if can_set_route(loading_sig,"Loop Around") then
set_route(loading_sig,"Loop Around")
set_route(accelerator_loop_diverge_sig,"Loading Road")
atc_send("S8")
else
interrupt_pos(control_interface,"Unable to set route")
end
elseif event.message == "depart" then
atc_set_text_outside("Preparing to Depart")
interrupt_pos(control_interface,"Preparing to Depart")
interrupt(5,"depart")
else
interrupt_pos(control_interface,"Unknown Command:||"..tostring(event.msg))
end
end
if event.type=="int" then
if event.message == "depart" then
set_route(loading_sig,"Exit to Mainline")
atc_send("SM")
atc_set_text_inside("-- Manifest --\nCargo: Logs and Leaves\nOrigin: Auto Logging Plantation")
atc_set_text_outside("")
end
end
\ No newline at end of file +----------------------------------------------
--East End of Loading Road
local siding_id = "TreeFarm"
local control_interface = POS(-3553,18,-2261)
local loading_sig = POS(-3539,9,-2279)
local exit_route = "Exit to Mainline"
local accelerator_loop_diverge_sig = POS(-3602,9,-2282)
if event.type=="ext_int" then
if not atc_id then
interrupt_pos(control_interface,"No Train at Signal")
return
elseif atc_speed ~= 0 then
interrupt_pos(control_interface,"Train Still Moving")
return
end
if event.message == "shuffle" then
if can_set_route(loading_sig,"Loop Around") then
set_route(loading_sig,"Loop Around")
set_route(accelerator_loop_diverge_sig,"Loading Road (Left)")
atc_send("S8")
else
interrupt_pos(control_interface,"Unable to set route")
end
elseif event.message == "depart" then
atc_set_text_outside("Preparing to Depart")
interrupt_pos(control_interface,"Preparing to Depart")
interrupt_safe(5,"depart")
else
interrupt_pos(control_interface,"Unknown Command:||"..tostring(event.msg))
end
end
if event.type=="int" then
if event.message == "depart" then
set_route(loading_sig,"Exit to Mainline")
atc_send("SM")
atc_set_text_inside("-- Manifest --\nCargo: Logs and Leaves\nOrigin: Auto Logging Plantation")
atc_set_text_outside("Maverick2797 Organic Diamonds\nFrom Tree to Shiny!")
unset_autocouple()
end
end
\ No newline at end of file diff --git a/durt/nodes/(-3552,16,-2275).lua b/durt/nodes/(-3552,16,-2275).lua new file mode 100644 index 0000000..4225d33 --- /dev/null +++ b/durt/nodes/(-3552,16,-2275).lua @@ -0,0 +1 @@ +digiline_send("","Active: "..tostring(S.TreeFarm.yard_active))
\ No newline at end of file diff --git a/durt/nodes/(-3588,8,-2277).lua b/durt/nodes/(-3588,8,-2277).lua index 0cb4557..c0fbf23 100644 --- a/durt/nodes/(-3588,8,-2277).lua +++ b/durt/nodes/(-3588,8,-2277).lua @@ -1 +1,2 @@ -
--West End of Loading Road
local siding_id = "TreeFarm"
local control_interface = POS(-3553,18,-2261)
local hs_sig = POS(-3594,9,-2277)
local hs_route = "Shunt Around Via Loop"
if not S[siding_id] then S[siding_id] = {} end
if not atc_arrow then atc_send("B1") end
if not S[siding_id].yard_active then
if atc_arrow then
S[siding_id].yard_active = true
S[siding_id].info = {
['rc'] = get_rc() or "",
['line'] = get_line() or ""
}
-- set_rc("AROUND")
split_off_locomotive("B0WR")
set_autocouple()
set_route(hs_sig,hs_route)
atc_send("S4")
end
else
if atc_arrow then -- train has rejoined
atc_send("B0WD2RS1") -- reverse and load train
set_rc(S[siding_id].info.rc)
set_line(S[siding_id].info.line)
unset_autocouple()
interrupt_pos(control_interface,"Train Shunted||Now Loading")
S[siding_id].info.rc = nil
S[siding_id].info.line = nil
S[siding_id].yard_active = nil
end
end
\ No newline at end of file +------------------------------------------------------------------
--West End of Loading Road
local siding_id = "TreeFarm"
local control_interface = POS(-3553,18,-2261)
local hs_sig = POS(-3594,9,-2277)
local hs_route = "Shunt Around Via Loop"
if not S[siding_id] then S[siding_id] = {} end
if not atc_arrow then atc_send("B1") end
if not S[siding_id].yard_active then
if atc_arrow then
S[siding_id].yard_active = true
S[siding_id].info = {
['rc'] = get_rc() or "",
['line'] = get_line() or ""
}
-- set_rc("AROUND") + step_fc()
split_off_locomotive("B0WR")
set_route(hs_sig,hs_route)
atc_send("S4")
end
else
if atc_arrow then -- train has rejoined
atc_send("B0WD2RS1") -- reverse and load train
set_rc(S[siding_id].info.rc)
set_line(S[siding_id].info.line)
unset_autocouple()
interrupt_pos(control_interface,"Train Shunted||Now Loading")
S[siding_id].info.rc = nil
S[siding_id].info.line = nil
S[siding_id].yard_active = nil
end
end
\ No newline at end of file diff --git a/durt/nodes/(-3761,12,-3554).lua b/durt/nodes/(-3761,12,-3554).lua new file mode 100644 index 0000000..118b1c4 --- /dev/null +++ b/durt/nodes/(-3761,12,-3554).lua @@ -0,0 +1,2 @@ +-- +F.M27_tracking("EV_S<-->Sinensis")
\ No newline at end of file diff --git a/durt/nodes/(-585,26,2478).lua b/durt/nodes/(-585,26,2478).lua index 23d349b..f79b2c9 100644 --- a/durt/nodes/(-585,26,2478).lua +++ b/durt/nodes/(-585,26,2478).lua @@ -1 +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 +--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",3)
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/(-716,3,1873).lua b/durt/nodes/(-716,3,1873).lua new file mode 100644 index 0000000..fad9270 --- /dev/null +++ b/durt/nodes/(-716,3,1873).lua @@ -0,0 +1,3 @@ +__approach_callback_mode = 1
if event.approach and not event.has_entered then
atc_set_ars_disable(true)
atc_set_lzb_tsr(1)
end + +if event.train and atc_arrow then
atc_send("S1")
end
\ No newline at end of file diff --git a/durt/nodes/(-716,3,1892).lua b/durt/nodes/(-716,3,1892).lua new file mode 100644 index 0000000..bb8cdaf --- /dev/null +++ b/durt/nodes/(-716,3,1892).lua @@ -0,0 +1 @@ +__approach_callback_mode = 1
if event.approach and not event.has_entered then
atc_set_ars_disable(true)
atc_set_lzb_tsr(1)
end
if event.train and atc_arrow then
atc_set_ars_disable(false)
atc_send("SM")
end
\ No newline at end of file diff --git a/durt/nodes/(-733,3,1854).lua b/durt/nodes/(-733,3,1854).lua new file mode 100644 index 0000000..fad9270 --- /dev/null +++ b/durt/nodes/(-733,3,1854).lua @@ -0,0 +1,3 @@ +__approach_callback_mode = 1
if event.approach and not event.has_entered then
atc_set_ars_disable(true)
atc_set_lzb_tsr(1)
end + +if event.train and atc_arrow then
atc_send("S1")
end
\ No newline at end of file diff --git a/durt/nodes/(-734,3,1828).lua b/durt/nodes/(-734,3,1828).lua new file mode 100644 index 0000000..bb8cdaf --- /dev/null +++ b/durt/nodes/(-734,3,1828).lua @@ -0,0 +1 @@ +__approach_callback_mode = 1
if event.approach and not event.has_entered then
atc_set_ars_disable(true)
atc_set_lzb_tsr(1)
end
if event.train and atc_arrow then
atc_set_ars_disable(false)
atc_send("SM")
end
\ No newline at end of file diff --git a/durt/nodes/(1817,11,9226).lua b/durt/nodes/(1817,11,9226).lua new file mode 100644 index 0000000..a749beb --- /dev/null +++ b/durt/nodes/(1817,11,9226).lua @@ -0,0 +1 @@ +F.yard_road_count("WOA","WOA_ass_W","WOA_ass_W")
\ No newline at end of file diff --git a/durt/nodes/(1819,11,9227).lua b/durt/nodes/(1819,11,9227).lua new file mode 100644 index 0000000..43153e0 --- /dev/null +++ b/durt/nodes/(1819,11,9227).lua @@ -0,0 +1 @@ +F.yard_road_count("WOA","WOA_ass_C","WOA_ass_C")
\ No newline at end of file diff --git a/durt/nodes/(1819,11,9233).lua b/durt/nodes/(1819,11,9233).lua new file mode 100644 index 0000000..c833ab1 --- /dev/null +++ b/durt/nodes/(1819,11,9233).lua @@ -0,0 +1 @@ +F.yard_road_count("WOA","WOA_ass_E","WOA_ass_E")
\ No newline at end of file diff --git a/durt/nodes/(1852,8,9034).lua b/durt/nodes/(1852,8,9034).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/durt/nodes/(1852,8,9034).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/durt/nodes/(1854,11,9164).lua b/durt/nodes/(1854,11,9164).lua new file mode 100644 index 0000000..a749beb --- /dev/null +++ b/durt/nodes/(1854,11,9164).lua @@ -0,0 +1 @@ +F.yard_road_count("WOA","WOA_ass_W","WOA_ass_W")
\ No newline at end of file diff --git a/durt/nodes/(1856,11,9165).lua b/durt/nodes/(1856,11,9165).lua new file mode 100644 index 0000000..43153e0 --- /dev/null +++ b/durt/nodes/(1856,11,9165).lua @@ -0,0 +1 @@ +F.yard_road_count("WOA","WOA_ass_C","WOA_ass_C")
\ No newline at end of file diff --git a/durt/nodes/(1864,11,9161).lua b/durt/nodes/(1864,11,9161).lua new file mode 100644 index 0000000..c833ab1 --- /dev/null +++ b/durt/nodes/(1864,11,9161).lua @@ -0,0 +1 @@ +F.yard_road_count("WOA","WOA_ass_E","WOA_ass_E")
\ No newline at end of file diff --git a/durt/nodes/(1865,17,9141).lua b/durt/nodes/(1865,17,9141).lua new file mode 100644 index 0000000..ab7f545 --- /dev/null +++ b/durt/nodes/(1865,17,9141).lua @@ -0,0 +1 @@ +turnouts = {
{1870,11,9122},-- Southern headshunt/Goods Shed
{1863,11,9122},--Southern Roads
{1857,11,9122},
{1851,11,9122},
{1845,11,9122},
{1782,11,9222},--NW Roads
{1782,11,9216},
{1782,11,9210},
{1782,11,9204},
{1868,11,9157}, --Eastern Assembly Roads
{1860,11,9161},
{1817,11,9237},
{1817,11,9231},
{1822,11,9251}, --Northern Wye
{1817,11,9238},
{1806,11,9243},
}
routes = {
-- max# of routes = 32 (1-31 + R0)
--southern headshunt
{['matrix']={"1st"}, ['name']="Goods Shed Headshunt"}, --1
{['matrix']={"1cr"}, ['name']="West Assembly Yard"}, --2
--southern road access
{['matrix']={"2cr"}, ['name']="East S1"}, --3
{['matrix']={"2st","3cr"}, ['name']="East S2"}, --4
{['matrix']={"2st","3st","4cr"}, ['name']="East S3"}, --5
{['matrix']={"2st","3st","4st","5cr"}, ['name']="East S4"}, --6
{['matrix']={"2st","3st","4st","5st"}, ['name']="East S5"}, --7
--NW road access
{['matrix']={"6cr"}, ['name']="East N1"}, --8
{['matrix']={"6st","7cr"}, ['name']="East N2"}, --9
{['matrix']={"6st","7st","8cr"}, ['name']="East N3"}, --10
{['matrix']={"6st","7st","8st","9cr"}, ['name']="East N4"}, --11
{['matrix']={"6st","7st","8st","9st"}, ['name']="East N5"}, --12
--Eastern Assembly Roads
{['matrix']={"10st","12cr"}, ['name']="Assembly East"}, --13
{['matrix']={"10cr","11cr","12st","13cr"}, ['name']="Assembly Central"}, --14
{['matrix']={"10cr","11st","12st","13st"}, ['name']="Assembly West"}, --15
--Norther Wye
{['matrix']={"15st","14cr"}, ['name']="Assembly<->Station"}, --16
{['matrix']={"15cr","16cr"}, ['name']="Yard Loopback"}, --17
{['matrix']={"14st","16st"}, ['name']="Bypass Yard"}, --18
--testing routes
{['matrix']={"1cr","2cr","3cr","4cr","5cr"}, ['name']="[TEST]Southern Cr"}, --19
{['matrix']={"1st","2st","3st","4st","5st"}, ['name']="[TEST]Southern St"}, --20
{['matrix']={"6st","7st","8st","9st"}, ['name']="[TEST]Northern St"}, --21
{['matrix']={"6cr","7cr","8cr","9cr"}, ['name']="[TEST]Northern Cr"}, --22
}
local display = "tl1"
local debug_screen = "tl2"
function tableLength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
if event.type=="digiline" then
if event.channel=="track_control" then
local r = event.msg
if r > tableLength(routes) then
digiline_send(display,"Input ["..r.."] exceeds #routes||"..tableLength(routes))
-- digiline_send(debug_screen,"Input ["..r.."] exceeds #routes ("..tableLength(routes)..")")
return
elseif r == 0 then
digiline_send(display,"Input 0 is not defined")
-- digiline_send(debug_screen,"Input 0 is not defined")
return
end
route = routes[r]
-- a = ""
for _,v in pairs(route.matrix) do
local tid = tonumber(v:match("%d+"))
local tpos = turnouts[tid]
local turnout = {}
turnout.x = tpos[1]
turnout.y = tpos[2]
turnout.z = tpos[3]
local cmd = v:match("%a+")
-- a = a..string.format("%s %d,%d,%d\n",cmd,turnout.x,turnout.y,turnout.z)
setstate(turnout,cmd)
end
local verbose = table.concat(route.matrix," ")
digiline_send(display,"Route "..r.." set||"..verbose.."||"..route.name)
-- digiline_send(debug_screen,a)
return
end
if event.channel=="input" then --show debug info
if event.msg=="rwt_get" then
digiline_send("rwt_get",rwt.now())
elseif event.msg=="debug" then
digiline_send(debug_screen,"#turnouts: "..tableLength(turnouts).."\n#routes: "..tableLength(routes))
elseif event.msg=="occupancy_refresh" then
local m = ""
for k,v in pairs(S.yards.WOA) do
m = m..k..": "..v.car_count.."||"
end
digiline_send(debug_screen,m)
end
end
end
\ No newline at end of file diff --git a/durt/nodes/(1866,11,9122).lua b/durt/nodes/(1866,11,9122).lua new file mode 100644 index 0000000..577ba71 --- /dev/null +++ b/durt/nodes/(1866,11,9122).lua @@ -0,0 +1 @@ +__approach_callback_mode = 2
if event.approach and not event.has_entered then
atc_set_lzb_tsr(1)
end
\ No newline at end of file diff --git a/durt/nodes/(1874,11,9122).lua b/durt/nodes/(1874,11,9122).lua new file mode 100644 index 0000000..fdee831 --- /dev/null +++ b/durt/nodes/(1874,11,9122).lua @@ -0,0 +1 @@ +F.yard_road_count("WOA","hs","WOA_hs")
\ No newline at end of file diff --git a/durt/nodes/(1904,7,9133).lua b/durt/nodes/(1904,7,9133).lua new file mode 100644 index 0000000..22bd87c --- /dev/null +++ b/durt/nodes/(1904,7,9133).lua @@ -0,0 +1 @@ +local yard_id = "WOA"
__approach_callback_mode = 1
if event.approach and not event.has_entered then
atc_set_ars_disable(true)
atc_set_lzb_tsr(1)
end
if event.train and atc_arrow then
atc_send("S1")
S.yards[yard_id].last_pass2 = S.yards[yard_id].last_pass1 or rwt.now()
S.yards[yard_id].last_pass1 = rwt.now()
S.yards[yard_id].last_id = atc_id
end
if event.train then
local init = false
if not S.WOA_stats then
S.WOA_stats = true
init = true
end
F.stat("WOA_mine",init)
end
\ No newline at end of file diff --git a/durt/nodes/(1907,9,9129).lua b/durt/nodes/(1907,9,9129).lua new file mode 100644 index 0000000..6e01750 --- /dev/null +++ b/durt/nodes/(1907,9,9129).lua @@ -0,0 +1,2 @@ +local yard_id = "WOA"
if event.schedule then
local now = rwt.now()
local last = S.yards[yard_id].last_pass1
local dtime = rwt.diff(last,now)
local rtt = rwt.diff(S.yards[yard_id].last_pass2,last)
digiline_send("lcd",string.format("Now: %s |Last Pass: %s |ID: %s Delta: %s |TBT: %s ",rwt.to_string(now),rwt.to_string(last),S.yards.WOA.last_id,rwt.to_string(dtime),rwt.to_string(rtt)))
schedule(rwt.next_rpt(rwt.now(), "0;05", 0))
end
if event.punch then
schedule(rwt.next_rpt(rwt.now(), "0;05", 0)) + if S.WOA_stats == true then S.WOA_stats = false end
end
\ No newline at end of file diff --git a/durt/nodes/(1909,8,9115).lua b/durt/nodes/(1909,8,9115).lua new file mode 100644 index 0000000..224bafc --- /dev/null +++ b/durt/nodes/(1909,8,9115).lua @@ -0,0 +1,5 @@ +do return end + + + +local foundry_track = POS(-1962,13,-1709)
local warmoneaye_track = POS(1918,7,9099)
if event.ext_int then
if type(event.msg) == "string" then digiline_send("lcd",event.msg) end
if type(event.msg) == "table" then
local m = event.msg
local location = m.location
local message = m.msg
digiline_send(location,message)
return
end
end
if event.digiline then
if event.channel=="send" then
-- interrupt_pos(foundry_track,"send")
interrupt_pos(warmoneaye_track,"send")
end
end
if event.punch then
digiline_send("Foundry","test")
digiline_send("Warmoneaye","test")
end
\ No newline at end of file diff --git a/durt/nodes/(1914,7,9096).lua b/durt/nodes/(1914,7,9096).lua new file mode 100644 index 0000000..bb8cdaf --- /dev/null +++ b/durt/nodes/(1914,7,9096).lua @@ -0,0 +1 @@ +__approach_callback_mode = 1
if event.approach and not event.has_entered then
atc_set_ars_disable(true)
atc_set_lzb_tsr(1)
end
if event.train and atc_arrow then
atc_set_ars_disable(false)
atc_send("SM")
end
\ No newline at end of file diff --git a/durt/nodes/(1918,7,9099).lua b/durt/nodes/(1918,7,9099).lua new file mode 100644 index 0000000..3df43db --- /dev/null +++ b/durt/nodes/(1918,7,9099).lua @@ -0,0 +1 @@ +local location = "Warmoneaye"
local ctl_pan = POS(1919,7,9093)
local signal = POS(1919,10,9094)
local route = "Exit South"
err = interrupt_pos
if event.ext_int then
if not atc_id then
err(ctl_pan,{['location'] = location, ['msg'] = " | No Train"})
end
if event.msg == "send" then
set_route(signal,route)
if atc_arrow then
atc_send("SM")
else
atc_send("S0WRSM")
end
end
end
\ No newline at end of file diff --git a/durt/nodes/(1918,7,9147).lua b/durt/nodes/(1918,7,9147).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/durt/nodes/(1918,7,9147).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/durt/nodes/(1921,7,9096).lua b/durt/nodes/(1921,7,9096).lua new file mode 100644 index 0000000..32d89d7 --- /dev/null +++ b/durt/nodes/(1921,7,9096).lua @@ -0,0 +1 @@ +if event.digiline then
if event.channel ~= "track_control" then return end
local err = 0
if not atc_id then err = 1 end
if not atc_arrow then err = 1 end
if type(event.msg) ~= "table" then err = 1 end
if err == 1 then
digiline_send("lcd","--Error-- | Check Train")
return
end
local i = event.msg
set_rc(i.ars or "")
atc_set_text_inside("Destination: "..(i.name or "Unknown").."\nCargo: "..(i.info or "Unknown"))
end
\ No newline at end of file diff --git a/durt/nodes/(1921,7,9148).lua b/durt/nodes/(1921,7,9148).lua new file mode 100644 index 0000000..7489acc --- /dev/null +++ b/durt/nodes/(1921,7,9148).lua @@ -0,0 +1 @@ +--
\ No newline at end of file diff --git a/durt/nodes/(1928,8,9112).lua b/durt/nodes/(1928,8,9112).lua new file mode 100644 index 0000000..82f90cc --- /dev/null +++ b/durt/nodes/(1928,8,9112).lua @@ -0,0 +1 @@ +-- do return end
--if event.punch then schedule(1) end
if event.schedule then
local t = rwt.now()
for k,v in pairs(t) do
if v < 10 then
t[k] = "0"..v
end
end
time = string.format("Warmoneaye | | Railway Time | %s;%s",tostring(t.m),tostring(t.s))
digiline_send("clock",time)
schedule(1)
end
\ No newline at end of file diff --git a/durt/nodes/(1968,39,8411).lua b/durt/nodes/(1968,39,8411).lua new file mode 100644 index 0000000..1a91da0 --- /dev/null +++ b/durt/nodes/(1968,39,8411).lua @@ -0,0 +1,3 @@ +if atc_arrow == true and get_line() == "DTLS1" then + atc_set_text_outside("DTL S1 -> Banana Place Central") +end
\ No newline at end of file diff --git a/durt/nodes/(431,-11,-256).lua b/durt/nodes/(431,-11,-256).lua new file mode 100644 index 0000000..8f8784e --- /dev/null +++ b/durt/nodes/(431,-11,-256).lua @@ -0,0 +1,9 @@ +if atc_arrow == true then + local rc = get_rc() + if rc:find("bh_ewb_unload") then + setstate("s_bh_ewb", "st") + end + if rc:find("bh_ewb_load") then + setstate("s_bh_ewb", "cr") + end +end
\ No newline at end of file diff --git a/durt/nodes/(434,-4,-200).lua b/durt/nodes/(434,-4,-200).lua new file mode 100644 index 0000000..b072d04 --- /dev/null +++ b/durt/nodes/(434,-4,-200).lua @@ -0,0 +1,7 @@ +if event.type == "train" then + rc = get_rc() + if rc:find("d23a_leave") ~= nil then + rc = rc:gsub("d23a_leave", "d23_unload") + end + set_rc(rc) +end
\ No newline at end of file diff --git a/durt/nodes/(442,-4,-198).lua b/durt/nodes/(442,-4,-198).lua new file mode 100644 index 0000000..028a50e --- /dev/null +++ b/durt/nodes/(442,-4,-198).lua @@ -0,0 +1,9 @@ +if event.type == "train" then + local rc = get_rc() + if rc:find("d23a_unload") ~= nil then + rc = rc:gsub("d23a_unload", "d23a_load") + elseif rc:find("d23a_load") ~= nil then + rc = rc:gsub("d23a_load", "d23a_leave") + end + set_rc(rc) +end
\ No newline at end of file diff --git a/durt/nodes/(446,-4,-201).lua b/durt/nodes/(446,-4,-201).lua new file mode 100644 index 0000000..028a50e --- /dev/null +++ b/durt/nodes/(446,-4,-201).lua @@ -0,0 +1,9 @@ +if event.type == "train" then + local rc = get_rc() + if rc:find("d23a_unload") ~= nil then + rc = rc:gsub("d23a_unload", "d23a_load") + elseif rc:find("d23a_load") ~= nil then + rc = rc:gsub("d23a_load", "d23a_leave") + end + set_rc(rc) +end
\ No newline at end of file diff --git a/durt/nodes/(771,25,8503).lua b/durt/nodes/(771,25,8503).lua new file mode 100644 index 0000000..58252f0 --- /dev/null +++ b/durt/nodes/(771,25,8503).lua @@ -0,0 +1,3 @@ +if atc_arrow == true and get_line() == "DTLS1" then + atc_set_text_outside("DTL S1 -> Azena Transirejo") +end
\ No newline at end of file |