summaryrefslogtreecommitdiff
path: root/durt/nodes/(-3591,8,-2276).lua
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/nodes/(-3591,8,-2276).lua
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/nodes/(-3591,8,-2276).lua')
-rw-r--r--durt/nodes/(-3591,8,-2276).lua43
1 files changed, 43 insertions, 0 deletions
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