diff options
author | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:57:16 +0200 |
---|---|---|
committer | autocommitter <autocommitter@linux-forks.de> | 2024-04-22 14:57:16 +0200 |
commit | 286944c0c92f2f08c1d7d664509099425442f240 (patch) | |
tree | 00202ca4d8ba94baf70ba7cf1be1c396e3b196fe | |
parent | e13abb46020afb258825a088ac5ff9347f062e4d (diff) | |
download | luaatc_envs-286944c0c92f2f08c1d7d664509099425442f240.tar.gz luaatc_envs-286944c0c92f2f08c1d7d664509099425442f240.tar.bz2 luaatc_envs-286944c0c92f2f08c1d7d664509099425442f240.zip |
State at 2022-05-14
-rw-r--r-- | Tyard/nodes/(-4012,12,-2646).lua | 2 | ||||
-rw-r--r-- | Tyard/nodes/(-4027,12,-2655).lua | 4 | ||||
-rw-r--r-- | Tyard/nodes/(-4027,12,-2731).lua | 4 | ||||
-rw-r--r-- | Tyard/nodes/(-4100,12,-2742).lua | 2 | ||||
-rw-r--r-- | durt/init_code.lua | 7 | ||||
-rw-r--r-- | durt/nodes/(-2077,3,788).lua | 24 | ||||
-rw-r--r-- | durt/nodes/(-2077,3,821).lua | 26 | ||||
-rw-r--r-- | durt/nodes/(-2080,19,731).lua | 32 | ||||
-rw-r--r-- | durt/nodes/(-2080,3,787).lua | 37 | ||||
-rw-r--r-- | durt/nodes/(-2080,3,822).lua | 49 | ||||
-rw-r--r-- | durt/nodes/(-2080,3,832).lua | 32 |
11 files changed, 184 insertions, 35 deletions
diff --git a/Tyard/nodes/(-4012,12,-2646).lua b/Tyard/nodes/(-4012,12,-2646).lua index 670bb6c..00d6c1b 100644 --- a/Tyard/nodes/(-4012,12,-2646).lua +++ b/Tyard/nodes/(-4012,12,-2646).lua @@ -47,7 +47,7 @@ end if event.schedule then if not atc_id then --bounce the train that just passed - atc_send_to_train(event.msg,"S0WRD1S3A1") + atc_send_to_train(event.msg,"B0WRD1S3A1") else if atc_id == event.msg then --train hasn't fully passed yet, wait a bit longer schedule_in(";01",atc_id) diff --git a/Tyard/nodes/(-4027,12,-2655).lua b/Tyard/nodes/(-4027,12,-2655).lua index c7a71f4..1c12a8f 100644 --- a/Tyard/nodes/(-4027,12,-2655).lua +++ b/Tyard/nodes/(-4027,12,-2655).lua @@ -21,7 +21,7 @@ if F.yard_active() then if F.has_rc("TY_RTS") then F.dir(not F.dir()) F.remove_rc({"TY_RTS"}) - F.add_rc({"TY_HEADSHUNT","TY_AROUND"}) -- send loco around to the other end + F.add_rc({"TY_AROUND"}) -- send loco around to the other end split_off_locomotive("A0B0") atc_set_ars_disable(false) return -- train has departed for RTS loop @@ -31,7 +31,7 @@ if F.yard_active() then end if this_dir == F.dir() then --train has bounced and is ready to classify wagon(s) -- local pre_split = train_length() - local lane = split_at_fc("A0B0",5) -- where to classify this rake + local lane = split_at_fc("A0B0",5) -- where to classify this rake -- headshunt length local locos = tonumber(F.get_rc_safe():match("TY_LOCOS_(%d+)")) or 1 --saved loco count local wagons = tonumber(F.get_rc_safe():match("TY_WAGONS_(%d+)")) or 0 -- wagon_count from last classification split local this_rake = train_length() - locos-- subtract these wagons from the overall wagon count diff --git a/Tyard/nodes/(-4027,12,-2731).lua b/Tyard/nodes/(-4027,12,-2731).lua index 91a7249..5491309 100644 --- a/Tyard/nodes/(-4027,12,-2731).lua +++ b/Tyard/nodes/(-4027,12,-2731).lua @@ -21,7 +21,7 @@ if F.yard_active() then if F.has_rc("TY_RTS") then F.dir(not F.dir()) F.remove_rc({"TY_RTS"}) - F.add_rc({"TY_HEADSHUNT","TY_AROUND"}) -- send loco around to the other end + F.add_rc({"TY_AROUND"}) -- send loco around to the other end split_off_locomotive("A0B0") atc_set_ars_disable(false) return -- train has departed for RTS loop @@ -31,7 +31,7 @@ if F.yard_active() then end if this_dir == F.dir() then --train has bounced and is ready to classify wagon(s) -- local pre_split = train_length() - local lane = split_at_fc("A0B0",5) -- where to classify this rake + local lane = split_at_fc("A0B0",5) -- where to classify this rake -- headshunt length local locos = tonumber(F.get_rc_safe():match("TY_LOCOS_(%d+)")) or 1 --saved loco count local wagons = tonumber(F.get_rc_safe():match("TY_WAGONS_(%d+)")) or 0 -- wagon_count from last classification split local this_rake = train_length() - locos-- subtract these wagons from the overall wagon count diff --git a/Tyard/nodes/(-4100,12,-2742).lua b/Tyard/nodes/(-4100,12,-2742).lua index 37b303a..8ed965e 100644 --- a/Tyard/nodes/(-4100,12,-2742).lua +++ b/Tyard/nodes/(-4100,12,-2742).lua @@ -47,7 +47,7 @@ end if event.schedule then if not atc_id then --bounce the train that just passed - atc_send_to_train(event.msg,"S0WRD1S3A1") + atc_send_to_train(event.msg,"B0WRD1S3A1") else if atc_id == event.msg then --train hasn't fully passed yet, wait a bit longer schedule_in(";01",atc_id) diff --git a/durt/init_code.lua b/durt/init_code.lua index aa7e821..82ac61e 100644 --- a/durt/init_code.lua +++ b/durt/init_code.lua @@ -233,6 +233,13 @@ if event.init then S.yards = S.yards or list_of_yards end +F.dir = function(dir_indicator,set) --returns true if on, false if off + if set ~= nil then + setstate(dir_indicator,(set and "on") or "off") + end + return (getstate(dir_indicator) == "on") or false +end + F.get_rc_safe = function() return get_rc() or "" end diff --git a/durt/nodes/(-2077,3,788).lua b/durt/nodes/(-2077,3,788).lua index 26580c1..669248a 100644 --- a/durt/nodes/(-2077,3,788).lua +++ b/durt/nodes/(-2077,3,788).lua @@ -1,17 +1,25 @@ -__approach_callback_method == 1 +local dir_indicator = POS(-2079,7,803) +local this_dir = false + +__approach_callback_mode = 2 if event.approach and not event.has_entered then - if not F.has_rc("ARC_load_reverse") then return end - atc_set_lzb_tsr(1) + atc_set_lzb_tsr(2) atc_set_ars_disable(true) return end if event.train then - if atc_arrow then - if F.has_rc("ARC_load_reverse") then - atc_send("S0WRD1A1S3") - F.add_rc("ARC_load_rejoin") - return + if not atc_arrow then + if F.dir(dir_indicator) == this_dir then + atc_send("B1") + end -- no else, should never happen + else + if F.has_rc("ARC_LOAD_load") and (F.dir(dir_indicator) == not this_dir) then + F.remove_rc({"ARC_LOAD_load"}) + F.add_rc("ARC_LOAD_rejoin") + atc_send("B0WRD1S2") + else + atc_send("A1S2") end end end
\ No newline at end of file diff --git a/durt/nodes/(-2077,3,821).lua b/durt/nodes/(-2077,3,821).lua index 7489acc..eceb40a 100644 --- a/durt/nodes/(-2077,3,821).lua +++ b/durt/nodes/(-2077,3,821).lua @@ -1 +1,25 @@ ---
\ No newline at end of file +local dir_indicator = POS(-2079,7,803) +local this_dir = true + +__approach_callback_mode = 2 +if event.approach and not event.has_entered then + atc_set_lzb_tsr(2) + atc_set_ars_disable(true) + return +end + +if event.train then + if not atc_arrow then + if F.dir(dir_indicator) == this_dir then + atc_send("B1") + end -- no else, should never happen + else + if F.has_rc("ARC_LOAD_load") and (F.dir(dir_indicator) == not this_dir) then + F.remove_rc({"ARC_LOAD_load"}) + F.add_rc("ARC_LOAD_rejoin") + atc_send("B0WRD1S2") + else + atc_send("A1S2") + end + end +end
\ No newline at end of file diff --git a/durt/nodes/(-2080,19,731).lua b/durt/nodes/(-2080,19,731).lua new file mode 100644 index 0000000..440ca17 --- /dev/null +++ b/durt/nodes/(-2080,19,731).lua @@ -0,0 +1,32 @@ +local dir_indicator = POS(-2079,7,803) +local this_dir = false + +if event.schedule then + if not atc_id then + atc_send_to_train(event.msg,"B0WRD1S1") + return + end + if event.msg == atc_id then + schedule_in(";01",atc_id) + return + else + atc_send("BB") + atc_send_to_train("BB") + return + end + return +end + +if event.train and atc_arrow then + if F.has_rc("ARC_LOAD_reverse") and F.dir(dir_indicator) == this_dir then + set_autocouple() + schedule_in(";01",atc_id) + return + end + if F.has_rc("ARC_LOAD_exit") then + F.remove_rc({"ARC_LOAD_exit"}) + atc_send("D5SM") + return + end +end + diff --git a/durt/nodes/(-2080,3,787).lua b/durt/nodes/(-2080,3,787).lua index 7489acc..79ffde6 100644 --- a/durt/nodes/(-2080,3,787).lua +++ b/durt/nodes/(-2080,3,787).lua @@ -1 +1,36 @@ ---
\ No newline at end of file +local dir_indicator = POS(-2079,7,803) +local this_dir = false + +__approach_callback_mode = 2 +if event.approach and not event.has_entered then + atc_set_lzb_tsr(2) + atc_set_ars_disable(true) + return +end + +if event.train then + if not F.has_rc("ARC_LOAD") then + atc_set_ars_disable(false) + return + end + if F.has_rc("ARC_LOAD_exit") then + atc_set_ars_disable(false) + return + end + if not atc_arrow then + atc_send("S2") + return + end + + if not F.has_rc("ARC_LOAD_rejoin") then + split_at_fc("B0") + F.add_rc("ARC_LOAD_reverse ARC_LOAD_load") + atc_send("A1S2") + F.dir(dir_indicator,this_dir) + else + unset_autocouple() + F.remove_rc({"ARC_LOAD_reverse","ARC_LOAD_rejoin"}) + F.add_rc("ARC_LOAD_exit") + atc_send("B0WRD1S6A1") + end +end
\ No newline at end of file diff --git a/durt/nodes/(-2080,3,822).lua b/durt/nodes/(-2080,3,822).lua index 202a5d7..b068713 100644 --- a/durt/nodes/(-2080,3,822).lua +++ b/durt/nodes/(-2080,3,822).lua @@ -1,25 +1,36 @@ -__approach_callback_method = 2 +local dir_indicator = POS(-2079,7,803) +local this_dir = true + +__approach_callback_mode = 2 if event.approach and not event.has_entered then - if atc_arrow then - atc_set_lzb_tsr(1) - else - atc_set_lzb_tsr(2) - end + atc_set_lzb_tsr(2) + atc_set_ars_disable(true) + return end if event.train then - if atc_arrow then - if F.has_rc("ARC_load") then - if F.has_rc("ARC_load_rejoin") then - F.remove_rc({"Arc_load_reverse","ARC_load_rejoin"}) - atc_send("SM") - return - else - split_at_fc("S0",5) - F.add_rc({"ARC_load_reverse"}) - atc_send("S2") - return - end - end + if not F.has_rc("ARC_LOAD") then + atc_set_ars_disable(false) + return + end + if F.has_rc("ARC_LOAD_exit") then + atc_set_ars_disable(false) + return + end + if not atc_arrow then + atc_send("S2") + return + end + + if not F.has_rc("ARC_LOAD_rejoin") then + split_at_fc("B0") + F.add_rc("ARC_LOAD_reverse ARC_LOAD_load") + atc_send("A1S2") + F.dir(dir_indicator,this_dir) + else + unset_autocouple() + F.remove_rc({"ARC_LOAD_reverse","ARC_LOAD_rejoin"}) + F.add_rc("ARC_LOAD_exit") + atc_send("B0WRD1S6A1") end end
\ No newline at end of file diff --git a/durt/nodes/(-2080,3,832).lua b/durt/nodes/(-2080,3,832).lua new file mode 100644 index 0000000..9a71d83 --- /dev/null +++ b/durt/nodes/(-2080,3,832).lua @@ -0,0 +1,32 @@ +local dir_indicator = POS(-2079,7,803) +local this_dir = true + +if event.schedule then + if not atc_id then + atc_send_to_train(event.msg,"B0WRD1S1") + return + end + if event.msg == atc_id then + schedule_in(";01",atc_id) + return + else + atc_send("BB") + atc_send_to_train("BB") + return + end + return +end + +if event.train and atc_arrow then + if F.has_rc("ARC_LOAD_reverse") and F.dir(dir_indicator) == this_dir then + set_autocouple() + schedule_in(";01",atc_id) + return + end + if F.has_rc("ARC_LOAD_exit") then + F.remove_rc({"ARC_LOAD_exit"}) + atc_send("D5SM") + return + end +end + |