summaryrefslogtreecommitdiff
path: root/durt
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-04-22 14:56:58 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-04-22 14:56:58 +0200
commitaeea70df13db7d77ce2ce1075cbd14dc1c3797fc (patch)
tree0b95d7adcbc6f128ce1528d6e965c926bb725fb1 /durt
parent4062f8447ce4eaa550613c41d3251c473522c201 (diff)
downloadluaatc_envs-aeea70df13db7d77ce2ce1075cbd14dc1c3797fc.tar.gz
luaatc_envs-aeea70df13db7d77ce2ce1075cbd14dc1c3797fc.tar.bz2
luaatc_envs-aeea70df13db7d77ce2ce1075cbd14dc1c3797fc.zip
State at 2022-04-19
Diffstat (limited to 'durt')
-rw-r--r--durt/nodes/(-3524,8,-2281).lua3
-rw-r--r--durt/nodes/(-3541,8,-2276).lua43
-rw-r--r--durt/nodes/(-3543,8,-2281).lua57
-rw-r--r--durt/nodes/(-3543,8,-2282).lua56
-rw-r--r--durt/nodes/(-3590,8,-2277).lua44
-rw-r--r--durt/nodes/(-3591,8,-2276).lua43
-rw-r--r--durt/nodes/(-3591,8,-2281).lua57
-rw-r--r--durt/nodes/(-3591,8,-2282).lua56
8 files changed, 202 insertions, 157 deletions
diff --git a/durt/nodes/(-3524,8,-2281).lua b/durt/nodes/(-3524,8,-2281).lua
index 7d40fda..9afccd1 100644
--- a/durt/nodes/(-3524,8,-2281).lua
+++ b/durt/nodes/(-3524,8,-2281).lua
@@ -1,7 +1,6 @@
local dir = "east"
if event.train and atc_arrow then
- local rc = get_rc() or ""
- if rc:match("Treefarm_headshunt_"..dir) then
+ if F.get_rc_safe():match("Treefarm_headshunt_"..dir) then
schedule_in(";01",atc_id)
return
end
diff --git a/durt/nodes/(-3541,8,-2276).lua b/durt/nodes/(-3541,8,-2276).lua
new file mode 100644
index 0000000..22e5c4d
--- /dev/null
+++ b/durt/nodes/(-3541,8,-2276).lua
@@ -0,0 +1,43 @@
+local dir = "east"
+local split_indicators = {east=POS(-3559,9,-2282),west=POS(-3592,9,-2282)}
+local loco_indicators = {east=POS(-3540,8,-2278),west=POS(-3593,8,-2277)}
+
+local inv_dir = (dir=="east" and "west" or "east")
+
+__approach_callback_mode = 1
+if event.approach and not event.has_entered then
+ atc_set_lzb_tsr(1)
+end
+
+if event.train then
+print(tostring(atc_arrow))
+ local train_dir = F.get_rc_safe():match("Treefarm_headshunt_(%a%a%a%a)")
+ if not train_dir then return end -- ignore this train completely
+ if not atc_arrow then return end--nothing to do with this train yet
+
+print(train_dir.." "..dir)
+ if train_dir == dir then --train is matching arrow and has already bounced, split and let it pass
+ if getstate(split_indicators[dir]) == "red" then --there's an error somewhere, shouldn't get to this
+ print("error1")
+ return
+ end
+ if not F.get_rc_safe():match("Treefarm_collect") then
+ split_off_locomotive("A0B0",1)
+ atc_send("A1S3")
+ end
+ F.remove_rc({"Treefarm_loading"})
+ set_rc(F.get_rc_safe().." Treefarm_rejoin_"..dir)
+ elseif train_dir == inv_dir then -- bounce the train
+print("bounce")
+ if getstate(split_indicators[inv_dir]) == "red" then --there's an error somewhere, shouldn't get to this
+ print("error2")
+ return
+ end
+ set_rc(F.get_rc_safe().." Treefarm_collect")
+print(F.get_rc_safe())
+ atc_reset()
+ atc_send("S2D2S0WRS3")
+print("do the bounce")
+ return
+ end
+end \ No newline at end of file
diff --git a/durt/nodes/(-3543,8,-2281).lua b/durt/nodes/(-3543,8,-2281).lua
index a2adaf7..7489acc 100644
--- a/durt/nodes/(-3543,8,-2281).lua
+++ b/durt/nodes/(-3543,8,-2281).lua
@@ -1,56 +1 @@
-local dir = "east"
-local split_indicators = {['east']=POS(-3539,9,-2282),['west']=POS(-3592,9,-2282)}
-
-local inv_dir = (dir=="east" and "west" or "east")
-
-__approach_callback_mode = 2
-
-
-if event.approach and not event.has_entered then
- if not F.get_rc_safe():match("logging_pickup") then return end
-
- atc_set_ars_disable(true)
- atc_set_lzb_tsr(1)
-end
-
-if event.train then
-print(F.get_rc_safe())
- if not F.get_rc_safe():match("logging_pickup") then return end
- if getstate(split_indicators[inv_dir]) == "green" then return end -- train is busy from the other end. ignore for now
-print(1)
- if atc_arrow == true then
-print(2)
- local state = getstate(split_indicators[dir])
-print("state " ..tostring(state))
-print(3)
- if state == "red" then
- local split_length = F.get_rc_safe():match("logging_split(%d+)") or 0
-print("split length: "..split_length)
- split_at_index(split_length+2,"A0B0")
- set_rc(F.get_rc_safe().." Treefarm_headshunt_"..dir.." Treefarm_loading")
- atc_send("S3")
- atc_set_ars_disable(false)
- setstate(split_indicators[dir],"green")
- elseif state == "green" then
- atc_send("S5D10SM")
- setstate(split_indicators[dir],"red")
- F.remove_rc({"Treefarm_headshunt_"..dir,"Treefarm_loading","Treefarm_rejoin_"..dir,"Treefarm_collect"})
- end
- else
- if F.get_rc_safe():match("Treefarm_rejoin_"..dir) then
- atc_set_ars_disable(true)
- schedule_in(";01",atc_id)
- return
- end
- end
-end
-
-if event.schedule then
- if event.msg == atc_id then
- schedule_in(";01",event.msg)
- return
- else
- atc_send_to_train(event.msg,"B0WRA1S3")
- return
- end
-end \ No newline at end of file
+-- \ No newline at end of file
diff --git a/durt/nodes/(-3543,8,-2282).lua b/durt/nodes/(-3543,8,-2282).lua
new file mode 100644
index 0000000..a2adaf7
--- /dev/null
+++ b/durt/nodes/(-3543,8,-2282).lua
@@ -0,0 +1,56 @@
+local dir = "east"
+local split_indicators = {['east']=POS(-3539,9,-2282),['west']=POS(-3592,9,-2282)}
+
+local inv_dir = (dir=="east" and "west" or "east")
+
+__approach_callback_mode = 2
+
+
+if event.approach and not event.has_entered then
+ if not F.get_rc_safe():match("logging_pickup") then return end
+
+ atc_set_ars_disable(true)
+ atc_set_lzb_tsr(1)
+end
+
+if event.train then
+print(F.get_rc_safe())
+ if not F.get_rc_safe():match("logging_pickup") then return end
+ if getstate(split_indicators[inv_dir]) == "green" then return end -- train is busy from the other end. ignore for now
+print(1)
+ if atc_arrow == true then
+print(2)
+ local state = getstate(split_indicators[dir])
+print("state " ..tostring(state))
+print(3)
+ if state == "red" then
+ local split_length = F.get_rc_safe():match("logging_split(%d+)") or 0
+print("split length: "..split_length)
+ split_at_index(split_length+2,"A0B0")
+ set_rc(F.get_rc_safe().." Treefarm_headshunt_"..dir.." Treefarm_loading")
+ atc_send("S3")
+ atc_set_ars_disable(false)
+ setstate(split_indicators[dir],"green")
+ elseif state == "green" then
+ atc_send("S5D10SM")
+ setstate(split_indicators[dir],"red")
+ F.remove_rc({"Treefarm_headshunt_"..dir,"Treefarm_loading","Treefarm_rejoin_"..dir,"Treefarm_collect"})
+ end
+ else
+ if F.get_rc_safe():match("Treefarm_rejoin_"..dir) then
+ atc_set_ars_disable(true)
+ schedule_in(";01",atc_id)
+ return
+ end
+ end
+end
+
+if event.schedule then
+ if event.msg == atc_id then
+ schedule_in(";01",event.msg)
+ return
+ else
+ atc_send_to_train(event.msg,"B0WRA1S3")
+ return
+ end
+end \ No newline at end of file
diff --git a/durt/nodes/(-3590,8,-2277).lua b/durt/nodes/(-3590,8,-2277).lua
index 358f6c2..7489acc 100644
--- a/durt/nodes/(-3590,8,-2277).lua
+++ b/durt/nodes/(-3590,8,-2277).lua
@@ -1,43 +1 @@
-local dir = "west"
-local split_indicators = {east=POS(-3559,9,-2282),west=POS(-3592,9,-2282)}
-local loco_indicators = {east=POS(-3540,8,-2278),west=POS(-3593,8,-2277)}
-
-local inv_dir = (dir=="east" and "west" or "east")
-
-__approach_callback_mode = 1
-if event.approach and not event.has_entered then
- atc_set_lzb_tsr(1)
-end
-
-if event.train then
-print(tostring(atc_arrow))
- local train_dir = F.get_rc_safe():match("Treefarm_headshunt_(%a%a%a%a)")
- if not train_dir then return end -- ignore this train completely
- if not atc_arrow then return end--nothing to do with this train yet
-
-print(train_dir.." "..dir)
- if train_dir == dir then --train is matching arrow and has already bounced, split and let it pass
- if getstate(split_indicators[dir]) == "red" then --there's an error somewhere, shouldn't get to this
- print("error1")
- return
- end
- if not F.get_rc_safe():match("Treefarm_collect") then
- split_off_locomotive("A0B0",1)
- atc_send("A1S3")
- end
- F.remove_rc({"Treefarm_loading"})
- set_rc(F.get_rc_safe().." Treefarm_rejoin_"..dir)
- elseif train_dir == inv_dir then -- bounce the train
-print("bounce")
- if getstate(split_indicators[inv_dir]) == "red" then --there's an error somewhere, shouldn't get to this
- print("error2")
- return
- end
- set_rc(F.get_rc_safe().." Treefarm_collect")
-print(F.get_rc_safe())
- atc_reset()
- atc_send("S2D2S0WRS3")
-print("do the bounce")
- return
- end
-end \ No newline at end of file
+-- \ No newline at end of file
diff --git a/durt/nodes/(-3591,8,-2276).lua b/durt/nodes/(-3591,8,-2276).lua
new file mode 100644
index 0000000..358f6c2
--- /dev/null
+++ b/durt/nodes/(-3591,8,-2276).lua
@@ -0,0 +1,43 @@
+local dir = "west"
+local split_indicators = {east=POS(-3559,9,-2282),west=POS(-3592,9,-2282)}
+local loco_indicators = {east=POS(-3540,8,-2278),west=POS(-3593,8,-2277)}
+
+local inv_dir = (dir=="east" and "west" or "east")
+
+__approach_callback_mode = 1
+if event.approach and not event.has_entered then
+ atc_set_lzb_tsr(1)
+end
+
+if event.train then
+print(tostring(atc_arrow))
+ local train_dir = F.get_rc_safe():match("Treefarm_headshunt_(%a%a%a%a)")
+ if not train_dir then return end -- ignore this train completely
+ if not atc_arrow then return end--nothing to do with this train yet
+
+print(train_dir.." "..dir)
+ if train_dir == dir then --train is matching arrow and has already bounced, split and let it pass
+ if getstate(split_indicators[dir]) == "red" then --there's an error somewhere, shouldn't get to this
+ print("error1")
+ return
+ end
+ if not F.get_rc_safe():match("Treefarm_collect") then
+ split_off_locomotive("A0B0",1)
+ atc_send("A1S3")
+ end
+ F.remove_rc({"Treefarm_loading"})
+ set_rc(F.get_rc_safe().." Treefarm_rejoin_"..dir)
+ elseif train_dir == inv_dir then -- bounce the train
+print("bounce")
+ if getstate(split_indicators[inv_dir]) == "red" then --there's an error somewhere, shouldn't get to this
+ print("error2")
+ return
+ end
+ set_rc(F.get_rc_safe().." Treefarm_collect")
+print(F.get_rc_safe())
+ atc_reset()
+ atc_send("S2D2S0WRS3")
+print("do the bounce")
+ return
+ end
+end \ No newline at end of file
diff --git a/durt/nodes/(-3591,8,-2281).lua b/durt/nodes/(-3591,8,-2281).lua
index 48a6b55..7489acc 100644
--- a/durt/nodes/(-3591,8,-2281).lua
+++ b/durt/nodes/(-3591,8,-2281).lua
@@ -1,56 +1 @@
-local dir = "west"
-local split_indicators = {['east']=POS(-3539,9,-2282),['west']=POS(-3592,9,-2282)}
-
-local inv_dir = (dir=="east" and "west" or "east")
-
-__approach_callback_mode = 2
-
-
-if event.approach and not event.has_entered then
- if not F.get_rc_safe():match("logging_pickup") then return end
-
- atc_set_ars_disable(true)
- atc_set_lzb_tsr(1)
-end
-
-if event.train then
-print(F.get_rc_safe())
- if not F.get_rc_safe():match("logging_pickup") then return end
- if getstate(split_indicators[inv_dir]) == "green" then return end -- train is busy from the other end. ignore for now
-print(1)
- if atc_arrow == true then
-print(2)
- local state = getstate(split_indicators[dir])
-print("state " ..tostring(state))
-print(3)
- if state == "red" then
- local split_length = F.get_rc_safe():match("logging_split(%d+)") or 0
-print("split length: "..split_length)
- split_at_index(split_length+2,"A0B0")
- set_rc(F.get_rc_safe().." Treefarm_headshunt_"..dir.." Treefarm_loading")
- atc_send("S3")
- atc_set_ars_disable(false)
- setstate(split_indicators[dir],"green")
- elseif state == "green" then
- atc_send("S5D10SM")
- setstate(split_indicators[dir],"red")
- F.remove_rc({"Treefarm_headshunt_"..dir,"Treefarm_loading","Treefarm_rejoin_"..dir,"Treefarm_collect"})
- end
- else
- if F.get_rc_safe():match("Treefarm_rejoin_"..dir) then
- atc_set_ars_disable(true)
- schedule_in(";01",atc_id)
- return
- end
- end
-end
-
-if event.schedule then
- if event.msg == atc_id then
- schedule_in(";01",event.msg)
- return
- else
- atc_send_to_train(event.msg,"B0WRA1S3")
- return
- end
-end \ No newline at end of file
+-- \ No newline at end of file
diff --git a/durt/nodes/(-3591,8,-2282).lua b/durt/nodes/(-3591,8,-2282).lua
new file mode 100644
index 0000000..48a6b55
--- /dev/null
+++ b/durt/nodes/(-3591,8,-2282).lua
@@ -0,0 +1,56 @@
+local dir = "west"
+local split_indicators = {['east']=POS(-3539,9,-2282),['west']=POS(-3592,9,-2282)}
+
+local inv_dir = (dir=="east" and "west" or "east")
+
+__approach_callback_mode = 2
+
+
+if event.approach and not event.has_entered then
+ if not F.get_rc_safe():match("logging_pickup") then return end
+
+ atc_set_ars_disable(true)
+ atc_set_lzb_tsr(1)
+end
+
+if event.train then
+print(F.get_rc_safe())
+ if not F.get_rc_safe():match("logging_pickup") then return end
+ if getstate(split_indicators[inv_dir]) == "green" then return end -- train is busy from the other end. ignore for now
+print(1)
+ if atc_arrow == true then
+print(2)
+ local state = getstate(split_indicators[dir])
+print("state " ..tostring(state))
+print(3)
+ if state == "red" then
+ local split_length = F.get_rc_safe():match("logging_split(%d+)") or 0
+print("split length: "..split_length)
+ split_at_index(split_length+2,"A0B0")
+ set_rc(F.get_rc_safe().." Treefarm_headshunt_"..dir.." Treefarm_loading")
+ atc_send("S3")
+ atc_set_ars_disable(false)
+ setstate(split_indicators[dir],"green")
+ elseif state == "green" then
+ atc_send("S5D10SM")
+ setstate(split_indicators[dir],"red")
+ F.remove_rc({"Treefarm_headshunt_"..dir,"Treefarm_loading","Treefarm_rejoin_"..dir,"Treefarm_collect"})
+ end
+ else
+ if F.get_rc_safe():match("Treefarm_rejoin_"..dir) then
+ atc_set_ars_disable(true)
+ schedule_in(";01",atc_id)
+ return
+ end
+ end
+end
+
+if event.schedule then
+ if event.msg == atc_id then
+ schedule_in(";01",event.msg)
+ return
+ else
+ atc_send_to_train(event.msg,"B0WRA1S3")
+ return
+ end
+end \ No newline at end of file