From 9ef9e006c52db4a72872d417b99c1bea1e61ce35 Mon Sep 17 00:00:00 2001 From: autocommitter Date: Mon, 22 Apr 2024 14:55:35 +0200 Subject: State at 2021-12-29 --- durt/nodes/(-3590,8,-2277).lua | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 durt/nodes/(-3590,8,-2277).lua (limited to 'durt/nodes/(-3590,8,-2277).lua') diff --git a/durt/nodes/(-3590,8,-2277).lua b/durt/nodes/(-3590,8,-2277).lua new file mode 100644 index 0000000..358f6c2 --- /dev/null +++ b/durt/nodes/(-3590,8,-2277).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 -- cgit v1.2.3