summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-04-22 14:57:57 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-04-22 14:57:57 +0200
commit51dea8f7eed0ed6ba89d3e41663d0e45c300e3c3 (patch)
tree6c163b0c2ab1096563913353a33c2324339cd15e
parent70ea83f5682355ee68115a92cb0b45d6d17a097e (diff)
downloadluaatc_envs-51dea8f7eed0ed6ba89d3e41663d0e45c300e3c3.tar.gz
luaatc_envs-51dea8f7eed0ed6ba89d3e41663d0e45c300e3c3.tar.bz2
luaatc_envs-51dea8f7eed0ed6ba89d3e41663d0e45c300e3c3.zip
State at 2022-07-09
-rw-r--r--auto_yards/init_code.lua29
-rw-r--r--durt/init_code.lua12
-rw-r--r--durt/nodes/(1905,0,9143).lua5
-rw-r--r--durt/nodes/(1906,7,9136).lua23
4 files changed, 35 insertions, 34 deletions
diff --git a/auto_yards/init_code.lua b/auto_yards/init_code.lua
index f0a62da..92b69bd 100644
--- a/auto_yards/init_code.lua
+++ b/auto_yards/init_code.lua
@@ -68,7 +68,6 @@ F.has_rc = function(query,rc_list) -- query = string, single entry
for word in rc_list:gmatch("[^%s]+") do
if word == query then return true end
end
- -- print(F.get_rc_safe())
return false
end
@@ -95,7 +94,6 @@ F.add_rc = function(rc_list) -- rc_list = string or table, eg: {"rc1","rc2"} OR
rc_list = table.concat(rc_list," ")
end
set_rc(F.get_rc_safe().." "..rc_list)
- -- print(F.get_rc_safe())
return true
end
@@ -132,7 +130,6 @@ F.remove_rc = function(rc_list,arrow_mode) -- rc_list = string eg: "rc1 rc2 rc3"
-- insert new string to train's rc
set_rc(table.concat(reinsert," "))
end
- -- print(F.get_rc_safe())
return reinsert
end
@@ -144,7 +141,6 @@ F.remove_rc_match = function(rc_list) -- rc_list = pattern string, single entry,
table.insert(rm,v)
end
F.remove_rc(rm)
- -- print(F.get_rc_safe())
return rm
end
@@ -172,8 +168,8 @@ F.yard_arrival = function(yard_id,this_dir) -- arrow points towards yard
atc_send("S6")
print(rwt.to_string(rwt.now()))
- print("YARD: "..yard_id..": Train "..atc_id.." enters from the "..tostring(this_dir).." direction and "..((rts and "will") or "won't").." return in the same direction")
- print("YARD: "..yard_id..": Length "..train_length())
+ print("YARD "..yard_id..": Train "..atc_id.." enters from the "..tostring(this_dir).." direction and "..((rts and "will") or "won't").." return in the same direction")
+ print("YARD "..yard_id..": Length "..train_length())
return
end
@@ -187,7 +183,7 @@ F.yard_arrival = function(yard_id,this_dir) -- arrow points towards yard
if event.train and atc_arrow then
if F.indicator(yard.active_indicator_pos) then
print(rwt.to_string(rwt.now()))
- print("YARD: "..yard_id..": Train "..atc_id.." has arrived and has to wait for the yard to deactivate.")
+ print("YARD "..yard_id..": Train "..atc_id.." has arrived and has to wait for the yard to deactivate.")
schedule_in(";10","recheck")
return
else
@@ -293,8 +289,6 @@ F.headshunt_yard = function(yard_id,this_dir) -- arrow points toward yard
schedule_in(";01",atc_id)
return
else
- print(rwt.to_string(rwt.now()))
- print("Preparing train "..atc_id.." to depart "..yard_id.." yard.")
if get_line() ~= "LHF" then -- LHF trains will always only collect the * lane for that direction. This code is for other trains
local collect = F.get_rc_safe():match(yard_id.."_COLLECT_(%S+)") -- will only match to the first _COLLECT RC to avoid excessively long trains in the headshunt
if collect then --train needs to collect a rake from the yard before departing
@@ -359,19 +353,15 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard
if atc_arrow and (F.indicator(yard.dir_indicator_pos) == this_dir) then
if F.has_rc(yard_id.."_DEPART") then
print(rwt.to_string(rwt.now()))
- print("YARD: "..yard_id..": Train "..atc_id.." has a length of "..train_length())
- print("YARD: "..yard_id..": It will depart in the "..tostring(this_dir).." direction.")
+ print("YARD "..yard_id..": Train "..atc_id.." has a length of "..train_length())
+ print("YARD "..yard_id..": It will depart in the "..tostring(this_dir).." direction.")
unset_autocouple()
F.remove_rc({yard_id.."_FINAL_COLLECT",yard_id.."_DEPART"})
F.remove_rc_match(yard_id.."_LOCOS_%d+")
F.remove_rc_match(yard_id.."_WAGONS_%d+")
if yard.notify_pos then
- print(yard.notify)
interrupt_pos(yard.notify_pos,"notify")
- print("init notifications")
- else
- print("No notification panel configured")
end
if F.has_rc(yard_id.."_HAS_RTS") then --reinsert the RTS flag to fully return RC list to starting
@@ -382,7 +372,6 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard
atc_set_ars_disable(false)
atc_send("S6D10SM")
schedule_in(";05","deactivate_check") -- wait a little to ensure train is clear from headshunt to deactivate yard
- -- print(F.get_rc_safe())
return
end -- if not _DEPART then let the train pass as extra space for the bounce back to the yard
else
@@ -396,7 +385,7 @@ F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard
if not atc_id then
F.indicator(yard.active_indicator_pos,false)
print(rwt.to_string(rwt.now()))
- print(yard_id.." yard Disabled")
+ print("YARD "..yard_id..": yard Disabled")
else
schedule_in(";05","deactivate_check")
return
@@ -430,17 +419,11 @@ F.lane_EOL = function(yard_id,this_dir) -- arrow points towards headshunt
if F.indicator(yard.dir_indicator_pos) == this_dir then
local fc = F.get_rc_safe():match(yard_id.."_CLASS_(%S+)")
F.remove_rc_match(yard_id.."_CLASS_%S+")
- print(1)
if not yard.notify or not yard.notify_pos then return end
- print(2)
if not fc then return end
- print(3)
if fc == "*" then return end
- print(4)
if F.has_rc(yard_id.."_COLLECT_"..fc) then return end
- print(5)
S.yards[yard_id].notify[fc] = true
- print(6)
else --this should never come into play as it means the train has entered from the wrong end somehow
atc_send("BBOL") --stop the train and open the doors (if available) to signify assistance required
F.indicator(yard.error_indicator_pos,true)
diff --git a/durt/init_code.lua b/durt/init_code.lua
index a837f2e..cf4207c 100644
--- a/durt/init_code.lua
+++ b/durt/init_code.lua
@@ -1,5 +1,4 @@
---[[
- Misc Code
+--[[ Misc Code
]]--
S.runarounds = {
["M27_Breaker_Factory"] = {},
@@ -13,8 +12,7 @@ if event.init then
S.yards = S.yards or list_of_yards
end
---[[
- Utility Functions
+--[[ Utility Functions
]]--
F.indicator = function(indicator,set)
if set ~= nil then
@@ -145,8 +143,7 @@ end
---[[
- stats counter from subway/il_timetable
+--[[ stats counter from subway/il_timetable
]]--
F.stat=function(line, init)
--statistics
@@ -190,8 +187,7 @@ end
end
end
---[[
- Custom Subway/Passenger Station Code
+--[[ Custom Subway/Passenger Station Code
]]--
S.lines = {
S23 = {
diff --git a/durt/nodes/(1905,0,9143).lua b/durt/nodes/(1905,0,9143).lua
new file mode 100644
index 0000000..500f0a0
--- /dev/null
+++ b/durt/nodes/(1905,0,9143).lua
@@ -0,0 +1,5 @@
+if event.punch then
+ S.yards.WOA.mine_count = 1
+ print("WOA Mine: reset counter")
+ digiline_send("train_ctl","send")
+end \ No newline at end of file
diff --git a/durt/nodes/(1906,7,9136).lua b/durt/nodes/(1906,7,9136).lua
index df38109..03ae1a0 100644
--- a/durt/nodes/(1906,7,9136).lua
+++ b/durt/nodes/(1906,7,9136).lua
@@ -16,12 +16,21 @@ if event.approach and not event.has_entered then
end
if event.train and atc_arrow then
+ digiline_send("mine_counter_lcd",S.yards.WOA.mine_counter)
if F.has_rc("WOA_mine_around") then
if F.has_rc("WOA_around_active") then
F.remove_rc(around_rc_list)
unset_autocouple()
- atc_send("B0WRD3SMA1")
- atc_set_text_outside("Warmonaye Mining Co.")
+ if S.yards.WOA.mine_count < 7 then -- send train back to yard
+ S.yards.WOA.mine_count = S.yards.WOA.mine_count + 1
+ print("WOA Mine Count: "..S.yards.WOA.mine_count)
+ atc_set_text_outside("Warmoneaye Mining Co.")
+ atc_send("B0WRD3SMA1")
+ else
+ S.yards.WOA.mine_count = 0
+ atc_send("B0")
+ atc_set_text_outside("Warmoneaye Mining Co.\nAwaiting More Overburden")
+ end
return
end
atc_set_text_outside("Warmoneaye Mining Co.\nLocomotive Switching Ends")
@@ -32,4 +41,12 @@ if event.train and atc_arrow then
atc_send("S4A1")
return
end
-end \ No newline at end of file
+end
+
+if event.digiline and atc_id then
+ if not F.has_rc("WOA_around_active") then
+ atc_set_text_outside("Warmoneaye Mining Co.")
+ atc_send("S0WRD3SMA1")
+ return
+ end
+end