summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-04-22 14:53:01 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-04-22 14:53:01 +0200
commite148c22517fc9286940d72158851555a14dcb4fe (patch)
tree2620e29a0bea38ccf753fe9c706cfccb1d89b1fd
parent36347476634def7228380f4d0063fdcce126bce4 (diff)
downloadluaatc_envs-e148c22517fc9286940d72158851555a14dcb4fe.tar.gz
luaatc_envs-e148c22517fc9286940d72158851555a14dcb4fe.tar.bz2
luaatc_envs-e148c22517fc9286940d72158851555a14dcb4fe.zip
State at 2021-05-17
-rw-r--r--durt/nodes/(-1511,11,-2590).lua67
1 files changed, 67 insertions, 0 deletions
diff --git a/durt/nodes/(-1511,11,-2590).lua b/durt/nodes/(-1511,11,-2590).lua
new file mode 100644
index 0000000..9c41623
--- /dev/null
+++ b/durt/nodes/(-1511,11,-2590).lua
@@ -0,0 +1,67 @@
+__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
+ if S.yards.S27.shunt_type == true then
+
+ --split and run around properly. player is present to supervise autocouple
+ local info = {
+ ['rc'] = get_rc() or " ",
+ ['ln'] = get_line() or " ",
+ ['it'] = atc_get_text_inside() or " ",
+ ['ot'] = atc_get_text_outside() or " "
+ }
+ print("Local Info:")
+ print(info)
+ print("===========")
+ if info.rc ~= "S27_HEADSHUNT S27_AROUND" then
+ S.yards.S27['info'] = info
+ print("info.rc false --> S.yards.S27: ")
+ print(S.yards.S27)
+ print("===========")
+ split_at_index(2,"BBWR")
+ set_rc("S27_HEADSHUNT S27_AROUND")
+ set_autocouple()
+ else
+ info = S.yards.S27['info']
+ print("info.rc true --> S.yards.S27: ")
+ print(S.yards.S27)
+ print("===========")
+ set_rc(info.rc)
+ set_line(info.ln)
+ atc_set_text_inside(info.it)
+ atc_set_text_outside(info.ot)
+
+ atc_send("BBWD3RD1SM")
+ end
+ atc_set_ars_disable(false)
+ return
+ elseif S.yards.S27.shunt_type == false then
+ --reverse around loop. player not present to supervise autocouple operation
+ local rc = get_rc() or ""
+
+ local action = 0
+ local rc_list = {}
+ for token in rc:gmatch("[^%s]+") do
+ if token=="S27_LOOP" then
+ action = 1
+ else
+ table.insert(rc_list,token)
+ end
+ end
+
+ if action == 0 then
+ rc = rc.." S27_LOOP"
+ else
+ rc = table.concat(rc_list," ").." S27_EXIT"
+ end
+ set_rc(rc)
+ atc_set_ars_disable(false)
+ atc_send("B0WRD1S3")
+ return
+ end
+end \ No newline at end of file