aboutsummaryrefslogtreecommitdiff
path: root/data/mods/default/textures/skybox2_night.png
blob: beb07a9cf8add64e0d98f45ad7b6552b8bb399cf (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 02 80 00 00 02 80 08 02 00 00 00 83 af 5e .PNG........IHDR...............^
0020 74 00 00 00 01 73 52 47 42 00 ae ce 1c e9 00 00 00 09 70 48 59 73 00 00 0b 13 00 00 0b 13 01 00 t....sRGB.........pHYs..........
0040 9a 9c 18 00 00 00 07 74 49 4d 45 07 db 04 1d 0e 32 1b 8e 55 df 59 00 00 00 1d 69 54 58 74 43 6f .......tIME.....2..U.Y....iTXtCo
0060 6d 6d 65 6e 74 00 00 00 00 00 43 72 65 61 74 65 64 20 77 69 74 68 20 47 49 4d 50 64 2e 65 07 00 mment.....Created.with.GIMPd.e..
0080 00 09 80 49 44 41 54 78 da ed dd 31 6e db 30 14 80 61 b1 f0 09 98 85 d9 94 51 90 ee 7f 1d 8e 9c ...IDATx...1n.0..a.......Q......
00a0 78 06 77 c8 12 18 ae db ca b6 44 51 df 37 16 48 d1 3e 0f 3f 9e cc 50 21 a6 71 00 00 b6 f5 cb 08 x.w.......DQ.7.H.>.?..P!.q......
00c0 00 40 80 01 40 80 01 00 01 06 00 01 06 00 04 18 00 04 18 00 10 60 00 10 60 00 40 80 01 40 80 01 .@..@................`..`.@..@..
00e0 40 80 01 00 01 06 00 01 06 00 04 18 00 04 18 00 10 60 00 10 60 00 40 80 01 40 80 01 40 80 01 00 @................`..`.@..@..@...
0100 01 06 00 01 06 00 04 18 00 04 18 00 10 60 00 10 60 00 40 80 01 40 80 01 40 80 fb 55 4b f6 91 03 .............`..`.@..@..@..UK...
0120 d0 82 10 d3 68 0a 00 60 03 06 00 01 06 fe cc 97 1a c0 6a 1e 41 03 80 0d 18 00 04 18 00 10 60 00 ....h..`..........j.A.........`.
0140 10 60 00 a0 cd 00 2f f3 64 be 00 70 97 53 d0 00 d0 d7 06 0c 00 08 30 00 08 30 00 08 30 00 20 c0 .`..../.d..p.S........0..0..0...
0160 00 9c d4 a9 ee 57 77 0a 1a 00 6c c0 00 20 c0 cf f3 b2 36 00 b8 cb 23 68 00 e8 6e 03 06 00 04 18 .....Ww...l.......6...#h..n.....
0180 00 04 18 00 04 18 00 10 60 00 10 60 00 40 80 01 40 80 01 0e 6f 99 27 43 60 7b 2e e2 00 00 1b 30 ........`..`.@..@...o.'C`{.....0
01a0 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 c0 3e 6a c9 86 70 72 ..0.....................0.>j..pr
01c0 6e c2 02 00 1b 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 n....0..0.....................0.
01e0 08 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 08 .0..0.....................0..0..
0200 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 08 30 00 20 c0 0.....................0..0..0...
0220 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 08 30 00 20 c0 00 20 c0 b0 ..................0..0..0.......
0240 87 65 9e 0c 01 e8 4f 88 69 34 05 00 b0 01 03 80 00 03 00 02 0c 00 02 0c 00 08 f0 9b 39 8b 0b c0 .e....O.i4..................9...
0260 0b 39 05 0d 00 36 60 00 10 60 00 40 80 01 40 80 01 00 01 06 00 01 06 00 04 18 00 04 18 00 10 60 .9...6`..`.@..@................`
0280 00 10 60 00 10 60 00 40 80 01 40 80 01 00 01 06 00 01 06 00 04 18 00 04 18 00 10 60 00 10 60 00 ..`..`.@..@................`..`.
02a0 10 60 00 40 80 01 40 80 01 00 01 06 d6 a9 25 1b 02 ec 28 c4 34 9a 02 00 d8 80 01 40 80 01 00 01 .`.@..@.......%...(.4......@....
02c0 06 00 01 06 00 04 18 00 04 18 00 10 60 00 10 60 00 10 60 23 00 00 01 06 00 01 06 8e c3 dd ce 70 ............`..`..`#...........p
02e0 2c ee 82 06 00 1b 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 ,.....0..0.....................0
0300 00 08 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 ..0..0.....................0..0.
0320 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 f0 0b d4 92 0d 01 80 75 42 .0............................uB
0340 4c a3 29 00 80 0d 18 00 04 18 80 b3 aa 25 fb ae ed 7d 3c 82 06 00 1b 30 00 08 30 00 20 c0 00 20 L.)..........%...}<....0..0.....
0360 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 08 30 00 20 c0 00 20 c0 00 80 00 ................0..0..0.........
0380 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 08 30 00 6c af 96 7c 9e ff 6c 88 69 f4 91 03 ............0..0..0.l..|..l.i...
03a0 80 0d 18 00 04 18 00 10 60 00 10 60 00 40 80 01 40 80 01 00 01 06 9a b0 cc 93 21 c0 37 bf 07 0c ........`..`.@..@.........!.7...
03c0 00 36 60 00 10 60 00 40 80 01 40 80 01 00 01 06 00 01 06 00 04 18 00 04 18 00 10 60 00 10 60 00 .6`..`.@..@................`..`.
03e0 10 60 00 ba e7 76 ee 1d b9 0b 1a 00 6c c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c c0 bf 70 ec b9 .`...v......l................p..
0400 1d 4e 41 03 80 0d 18 00 04 18 00 10 60 00 10 60 00 40 80 01 40 80 01 00 01 06 00 01 06 00 04 18 .NA.........`..`.@..@...........
0420 00 04 18 00 04 18 00 10 60 00 10 60 00 40 80 01 40 80 e9 5c 2d d9 10 00 9e e7 7d c0 00 d0 fb 06 ........`..`.@..@..\-.....}.....
0440 bc cc 93 89 03 80 0d 18 00 4e b0 01 03 00 02 0c 00 02 0c 00 02 0c 00 08 30 c0 7f f3 3b eb 34 ce .........N..............0...;.4.
0460 29 68 00 b0 01 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 )h...............0..0...........
0480 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 80 00 .............0..0...............
04a0 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 80 00 03 00 02 0c .........0..0...................
04c0 00 02 0c 00 08 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 80 00 03 00 02 0c 00 02 0c 00 .....0..0.......................
04e0 08 30 00 08 30 00 20 c0 00 20 c0 c0 63 b5 64 43 80 b3 09 31 8d a6 00 00 36 60 00 10 60 00 40 80 .0..0.......c.dC...1....6`..`.@.
0500 01 40 80 01 00 01 06 00 01 06 00 04 18 00 04 18 00 04 d8 08 00 40 80 01 40 80 01 00 01 06 00 01 .@...................@..@.......
0520 06 00 04 18 00 04 78 5f cb 3c f9 5c 01 68 9c f7 01 03 80 0d 18 00 04 18 5e a2 96 6c 08 00 37 3c ......x_.<.\.h..........^..l..7<
0540 82 06 00 1b 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 ....0..0.....................0..
0560 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 08 30 0..0.....................0..0..0
0580 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 08 30 00 20 c0 00 .....................0..0..0....
05a0 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 08 30 00 20 c0 00 20 c0 00 80 .................0..0..0........
05c0 00 03 c0 0a cb 3c b5 f0 cf 08 31 8d 3e 0c 00 b0 01 03 80 00 03 00 02 0c 00 02 0c 00 c3 d0 cc b1 .....<....1.>...................
05e0 a6 63 71 08 0b 00 6c c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 70 a3 96 6c 08 b4 cc 29 68 00 b0 .cq...l..............p..l...)h..
0600 01 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 80 00 .............0..0...............
0620 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 20 c0 00 d0 a4 8b 11 00 d0 b9 eb 75 fd cf 86 60 03 06 .........0..0............u...`..
0640 80 7e 08 30 00 9c 26 c0 b5 64 a3 07 40 80 b7 f6 f1 f9 65 f4 00 08 30 00 20 c0 00 20 c0 00 80 00 .~.0..&..d..@.....e...0.........
0660 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 ............0..0..0.............
0680 00 02 0c 00 02 0c 00 08 30 00 08 30 00 20 c0 00 20 c0 00 20 c0 00 c0 9b 5c 8c 00 80 ce 85 b0 fe ........0..0............\.......
06a0 67 af 57 1b 30 00 f4 43 80 01 40 80 01 40 80 01 00 01 06 00 01 06 00 04 18 00 04 18 00 10 60 00 g.W.0..C..@..@................`.
06c0 10 60 00 40 80 01 e0 ef 96 79 7a f9 df 19 62 1a 4d 16 00 ee 73 17 34 00 f4 44 80 01 40 80 01 40 .`.@.....yz...b.M...s.4..D..@..@
06e0 80 01 00 01 06 00 01 06 00 04 18 00 04 18 00 10 60 00 68 cf c5 08 00 60 0b 3f 2f d5 0a 41 80 01 ................`.h....`.?/..A..
0700 60 ab ee fe f8 43 8f a0 01 60 db fa 0e c3 e0 3b 60 00 d8 be be 02 0c 00 fb 10 60 00 10 60 00 10 `....C...`.....;`.........`..`..
0720 60 00 60 bd 10 04 18 00 da 6a b0 df 03 06 80 4d 1a ec 22 0e 00 d8 7d 1b f6 08 1a 00 76 20 c0 00 `.`......j.....M.."...}.....v...
0740 20 c0 00 20 c0 00 80 00 03 80 00 c3 89 d5 92 0d 01 78 52 88 69 34 05 00 b8 ef e1 1b 8d 6c c0 00 .................xR.i4.......l..
0760 70 30 02 0c 00 02 0c 00 02 0c 00 08 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c p0..........0..0................
0780 00 02 0c 00 02 0c 00 08 30 00 74 e5 62 04 00 74 ee 99 57 0a 86 60 03 06 80 7e 08 30 00 08 30 00 ........0.t.b..t..W..`...~.0..0.
07a0 08 30 00 20 c0 00 6f 51 4b 36 04 04 18 60 6b 1f 9f 5f 86 80 00 03 80 00 03 00 02 0c 00 02 0c 00 .0....oQK6...`k.._..............
07c0 08 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 .0..0........................0..
07e0 30 00 20 c0 00 20 c0 00 80 00 03 80 00 03 c0 89 5c 8c 00 80 ce 85 60 03 06 00 04 18 00 04 98 06 0...............\.....`.........
0800 d5 92 0d 01 e0 1d 42 4c a3 29 00 80 0d 18 00 04 18 00 10 60 00 10 60 00 40 80 01 40 80 01 00 01 ......BL.).........`..`.@..@....
0820 06 00 01 06 00 01 36 02 00 10 60 00 10 60 00 40 80 01 40 80 01 00 01 06 00 01 06 00 04 18 00 04 ......6...`..`.@..@.............
0840 18 00 10 60 00 10 60 00 10 60 00 40 80 01 40 80 01 00 01 06 00 01 06 00 04 18 e0 c5 6a c9 86 c0 ...`..`..`.@..@.............j...
0860 f3 42 4c a3 29 00 80 0d 18 00 04 18 00 10 60 00 10 60 00 40 80 01 40 80 01 00 01 06 00 01 06 00 .BL.).........`..`.@..@.........
0880 01 36 02 00 10 60 00 10 60 00 40 80 01 40 80 01 00 01 06 00 01 06 00 04 18 00 04 18 00 10 60 00 .6...`..`.@..@................`.
08a0 10 60 00 10 60 00 40 80 01 40 80 01 00 01 06 00 01 06 00 04 18 00 04 18 60 ad 65 9e 0c 81 9e 84 .`..`.@..@..............`.e.....
08c0 98 46 53 00 00 1b 30 00 08 30 00 20 c0 00 20 c0 00 80 00 0f c3 30 0c b5 64 1f 2a 00 ed 73 0a 1a .FS...0..0...........0..d.*..s..
08e0 00 6c c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 bc ca a1 2f 5f 72 .l...................0..0..../_r
0900 11 07 00 d8 80 01 40 80 01 00 01 06 00 01 06 00 04 18 00 04 18 00 10 60 00 10 60 00 40 80 01 40 ......@................`..`.@..@
0920 80 01 40 80 01 00 01 86 47 96 79 32 04 e0 58 bc 8c 01 00 6c c0 00 20 c0 00 80 00 03 80 00 03 00 ..@.....G.y2..X....l............
0940 02 0c 00 02 0c 00 08 30 00 08 30 00 20 c0 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 .......0..0.....................
0960 0c 00 08 30 00 08 30 00 20 c0 00 20 c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 ...0..0........................0
0980 00 08 30 00 20 c0 00 20 c0 5d 5b e6 c9 10 00 b8 11 62 1a 4d 01 00 6c c0 00 20 c0 00 80 00 03 80 ..0......][......b.M..l.........
09a0 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 9c 98 8b 59 80 6f 2e e2 00 00 1b 30 00 08 30 00 20 c0 ..........0..0...Y.o.....0..0...
09c0 00 20 c0 00 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 08 30 00 20 c0 00 20 c0 00 ..................0..0..0.......
09e0 80 00 03 80 00 03 00 02 0c 00 02 0c 00 08 30 00 08 30 00 08 30 00 20 c0 00 20 c0 00 80 00 03 c0 ..............0..0..0...........
0a00 11 fd 06 5f 5d 6c 4b 7d 9a 98 13 00 00 00 00 49 45 4e 44 ae 42 60 82 ..._]lK}.......IEND.B`.
ss="hl com"> rts = bool (whether the entering train will exit the way it came in) }, ]]-- TY = { yard_name = "Trisiston", active_indicator_pos = POS(-4025,14,-2659), dir_indicator_pos = POS(-4025,12,-2665), error_indicator_pos = POS(-4025,13,-2671), headshunt_max = 5, notify = {}, notify_pos = POS(-4023,12,-2660), arrival_time = rwt.now(), departure_time = rwt.now() }, BY = { yard_name = "Banach", active_indicator_pos = POS(-2002,3,-1099), dir_indicator_pos = POS(-2009,3,-1101), error_indicator_pos = POS(-1999,3,-1099), headshunt_max = 5, notify = {}, notify_pos = POS(-2004,2,-1101), arrival_time = rwt.now(), departure_time = rwt.now() }, ARC = { yard_name = "Arcadius", active_indicator_pos = POS(-1952,16,840), dir_indicator_pos = POS(-1950,16,840), error_indicator_pos = POS(-1948,16,840), headshunt_max = 5, notify = {}, notify_pos = POS(-1946,16,840), arrival_time = rwt.now(), departure_time = rwt.now() }, IP = { yard_name = "Ipswich", active_indicator_pos = POS(1179,16,3848), dir_indicator_pos = POS(1177,16,3855), error_indicator_pos = POS(1179,16,3850), headshunt_max = 5, notify = {}, notify_pos = POS(1178,16,3851), arrival_time = rwt.now(), departure_time = rwt.now() }, CAN = { yard_name = "Cannery", active_indicator_pos = POS(-594,26,2486), dir_indicator_pos = POS(-594,26,2484), error_indicator_pos = POS(-594,26,2482), headshunt_max = 2, --notify = {}, --notify_pos = POS(-594,26,2485), arrival_time = rwt.now(), departure_time = rwt.now() } -- HY = { -- active_indicator_pos = POS(-4025,14,-2659), -- dir_indicator_pos = POS(-4025,13,-2665), -- error_indicator_pos = POS(-4025,13,-2671), -- }, } S.known_trains = { ['120684'] = "LHF #1", --Maverick2797 ['249165'] = "LHF #2", --Maverick2797 ['734206'] = "ARC-BY", --Maverick2797 ['588750'] = "MMF-TY", --survivalg/erstazi ['543381'] = "WOA-IP", --Maverick2797 ['834721'] = "S27-ARC", --Maverick2797 ['513598'] = "S27EX-ARC", --Maverick2797 ['590988'] = "CAN-ARC", --Maverick2797 } end ------------------------------------------------------------------------------------ -- Utility Functions F.indicator = function(indicator,set) if set ~= nil then if type(set) == string then setstate(indicator,set) else setstate(indicator,(set and "on") or "off") end end return (getstate(indicator) == "on") or false end F.get_rc_safe = function() return get_rc() or "" end F.has_rc = function(query,rc_list) -- query = string, single entry if not atc_id then return false end if rc_list == "" or query == nil or query=="" then return false end if not rc_list then rc_list = F.get_rc_safe() end for word in rc_list:gmatch("[^%s]+") do if word == query then return true end end return false end F.has_rc_match = function(query,rc_list) -- query = pattern string, single entry if not atc_id then return false end if rc_list == "" or query == nil or query=="" then return false end if not rc_list then rc_list = F.get_rc_safe() end local rc = {} for v in rc_list:gmatch("("..query..")") do table.insert(rc,v) end if rc[1] == true then return true, rc else return nil end end F.add_rc = function(rc_list) -- rc_list = string or table, eg: {"rc1","rc2"} OR "rc1 rc2" if not atc_id then return false end if type(rc_list) == "table" then rc_list = table.concat(rc_list," ") end set_rc(F.get_rc_safe().." "..rc_list) return true end F.remove_rc = function(rc_list,arrow_mode) -- rc_list = string eg: "rc1 rc2 rc3" OR table eg: {"rc1","rc2","rc3"} -- Arrow Modes: -- true: with arrow direction -- false: against arrow direction -- nil: ignores arrow direction if not atc_id then return false end if not rc_list then return false end if (arrow_mode == nil) or (atc_arrow == arrow_mode) then -- prep rc_list to useable format local rc_remove = {} if type(rc_list) == "string" then for word in rc_list:gmatch("[^%s]+") do rc_remove[word] = true end elseif type(rc_list) == "table" then for _,word in pairs(rc_list) do rc_remove[word] = true end end -- remove codes from train's rc local rc = F.get_rc_safe() local reinsert = {} for token in rc:gmatch("[^%s]+") do if not rc_remove[token] then table.insert(reinsert,token) end end -- insert new string to train's rc set_rc(table.concat(reinsert," ")) end return reinsert end F.remove_rc_match = function(rc_list) -- rc_list = pattern string, single entry, eg: "rc_%d+" if not atc_id then return false end if not rc_list then return false end local rm = {} for v in F.get_rc_safe():gmatch("("..rc_list..")") do table.insert(rm,v) end F.remove_rc(rm) return rm end ---------------------------------------------------------------------------------------------- -- Trackside Functions -- this_dir = points towards Origin/Junction Yard F.yard_arrival = function(yard_id,this_dir, force_rts) -- arrow points towards yard local yard = S.yards[yard_id] --yard ref if F.has_rc(yard_id.."_NOSHUNT") then return end local function enter_yard() if not atc_id then F.indicator(yard.error_indicator_pos,true) return end F.indicator(yard.dir_indicator_pos,this_dir) F.indicator(yard.active_indicator_pos,true) F.add_rc({yard_id.."_ARRIVE"}) local rts = false if force_rts then -- yard is designated as a terminus yard. all trains MUST rts F.add_rc(yard_id.."_RTS") rts = true elseif F.has_rc(yard_id.."_RTS") then --save the RTS flag as it's removed during the arrival procedure F.add_rc({yard_id.."_HAS_RTS"}) rts = true end atc_set_ars_disable(false) atc_send("S6") S.yards[yard_id].last_id = atc_id S.yards[yard_id].arrival_length = train_length() S.yards[yard_id].arrival_time = rwt.now() S.yards[yard_id].departure_length = "?" S.yards[yard_id].departure_time = rwt.now() S.yards[yard_id].rts = rts if S.print_debug then print(rwt.to_string(rwt.now())) print("YARD "..yard_id..": Train "..atc_id.." ("..(S.known_trains[atc_id] or "Unknown")..") enters from the "..tostring(this_dir).." direction and will exit in the "..tostring(rts).." direction") print("YARD "..yard_id..": Length "..train_length()) end return end __approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) atc_set_lzb_tsr(1) return end if event.train and atc_arrow then if F.indicator(yard.active_indicator_pos) then if S.print_debug then print(rwt.to_string(rwt.now())) print("YARD "..yard_id..": Train "..atc_id.." ("..(S.known_trains[atc_id] or "Unknown")..") has arrived from the "..tostring(this_dir).." direction and has to wait for the yard to deactivate.") end schedule_in(";10","recheck") return else enter_yard() return true end end if event.schedule then if F.indicator(yard.active_indicator_pos) then schedule_in(";10","recheck") return else enter_yard() return true end end end F.classification = function(yard_id, this_dir) -- arrow points towards headshunt local yard = S.yards[yard_id] --yard ref if not F.indicator(yard.active_indicator_pos) then return end if F.has_rc(yard_id.."_NOSHUNT") then return end -- this_dir == true for north end, false for south end if F.indicator(yard.active_indicator_pos) then if atc_arrow then -- loco is at working end F.remove_rc({yard_id.."_PICKUP"}) if F.has_rc(yard_id.."_ARRIVE") and F.indicator(yard.dir_indicator_pos) == this_dir then --first pass, prep train for working F.remove_rc({yard_id.."_AROUND"}) if not F.get_rc_safe():match(yard_id.."_LOCOS_%d+") or not F.get_rc_safe():match(yard_id.."_WAGONS_%d+") then local full_length = train_length() split_off_locomotive("A0B0") local loco_count = train_length() local wagon_count = 0 if full_length > loco_count then wagon_count = full_length - loco_count end F.add_rc({yard_id.."_LOCOS_"..loco_count, yard_id.."_WAGONS_"..wagon_count}) --[[ train will end up going through headshunt no matter what there shouldn't be any trains entering that pass straight through the yard any that do should run under the _NOSHUNT rc ]]-- if not F.has_rc(yard_id.."_RTS") then F.add_rc({yard_id.."_HEADSHUNT",yard_id.."_PICKUP"}) else F.indicator(yard.dir_indicator_pos,not F.indicator(yard.dir_indicator_pos)) F.remove_rc({yard_id.."_RTS"}) F.add_rc({yard_id.."_AROUND"}) -- send loco around to the other end end atc_set_ars_disable(false) return -- train has departed for headshunt/around end --else train has arrived from wagon count and headshunt/around F.remove_rc({yard_id.."_ARRIVE"}) end if this_dir == F.indicator(yard.dir_indicator_pos) then --train has bounced and is ready to classify wagon(s) local locos = tonumber(F.get_rc_safe():match(yard_id.."_LOCOS_(%d+)")) or 1 --saved loco count local wagons = tonumber(F.get_rc_safe():match(yard_id.."_WAGONS_(%d+)")) or 0 -- wagon_count from last classification split local lane = split_at_fc("A0B0",yard.headshunt_max) -- where to classify this rake -- headshunt length local this_rake = train_length() - locos if lane ~= "" then F.add_rc({yard_id.."_CLASS_"..lane}) end if this_rake == wagons then -- mark for last_classification F.add_rc({yard_id.."_LAST_CLASS"}) end F.remove_rc_match(yard_id.."_WAGONS_%d+") F.add_rc({yard_id.."_HEADSHUNT",yard_id.."_WAGONS_"..wagons-this_rake}) -- subtract these wagons from the overall wagon count atc_set_ars_disable(false) set_autocouple() else --bounce train back towards working end atc_set_ars_disable(true) atc_send("S0WRD1S3") unset_autocouple() end else -- train entering from the far end. set autocouple so it pushes all the way through to the bounce atc_set_ars_disable(true) set_autocouple() end end end F.headshunt_yard = function(yard_id,this_dir) -- arrow points toward yard local yard = S.yards[yard_id] --yard ref __approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) atc_set_lzb_tsr(1) return end if not F.indicator(yard.active_indicator_pos) then return end if F.has_rc(yard_id.."_NOSHUNT") then return end if event.train then if not atc_arrow then --train has entered headshunt from yard. bounce or depart atc_set_ars_disable(true) F.remove_rc({yard_id.."_HEADSHUNT"}) if not F.has_rc(yard_id.."_FINAL_COLLECT") then if not F.has_rc(yard_id.."_DEPART") then -- MOST TRAINS. only set when train wants to depart, otherwise train will start the reverse countdown schedule_in(";01",atc_id) return else 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 F.add_rc({yard_id.."_CLASS_"..collect,yard_id.."_FINAL_COLLECT"}) schedule_in(";01",atc_id) return end else -- CLASS_* should never be set in ARS, instead being left to the * route F.add_rc({yard_id.."_FINAL_COLLECT", yard_id.."_CLASS_*"}) schedule_in(";01",atc_id) return end end --else let train proceed forward to the exit controller without a rake end --else train has already collected rake. let it exit yard else --train has bounced if F.has_rc(yard_id.."_AROUND") then if this_dir == F.indicator(yard.dir_indicator_pos) then --send train to Classification F.remove_rc({yard_id.."_AROUND"}) F.add_rc({yard_id.."_PICKUP"}) atc_set_ars_disable(false) return end --if at wrong end, do nothing. train will follow <yard_id>_AROUND ARS to relevant headshunt end -- if doesn't have <yard_id>_AROUND then let ARS classify the train atc_set_ars_disable(false) end return end if event.schedule then if not atc_id then --bounce the train that just passed atc_send_to_train(event.msg,"B0WRD1A1S3") else if atc_id == event.msg then --train hasn't fully passed yet, wait a bit longer schedule_in(";01",atc_id) else -- somehow another train crossed the controller before the first one returned. Unlikely but possible atc_send_to_train(event.msg,"BBOL") atc_send("BBOL") F.indicator(yard.error_indicator_pos,true) end end return end end F.headshunt_exit = function(yard_id,this_dir) -- arrow points out of yard local yard = S.yards[yard_id] --yard ref __approach_callback_mode = 1 if event.approach and not event.has_entered then atc_set_ars_disable(true) atc_set_lzb_tsr(1) return end if not F.indicator(yard.active_indicator_pos) then return end if F.has_rc(yard_id.."_NOSHUNT") then return end if event.train then if atc_arrow and (F.indicator(yard.dir_indicator_pos) == this_dir) then if F.has_rc(yard_id.."_DEPART") then if S.print_debug then print(rwt.to_string(rwt.now())) print("YARD "..yard_id..": Train "..atc_id.." ("..(S.known_trains[atc_id] or "Unknown")..") has a length of "..train_length()) print("YARD "..yard_id..": It will depart in the "..tostring(this_dir).." direction.") end S.yards[yard_id].departure_length = train_length() 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 interrupt_pos(yard.notify_pos,"notify") end if F.has_rc(yard_id.."_HAS_RTS") then --reinsert the RTS flag to fully return RC list to starting F.remove_rc(yard_id.."_HAS_RTS") F.add_rc({yard_id.."_RTS"}) end step_fc() 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 return end -- if not _DEPART then let the train pass as extra space for the bounce back to the yard else atc_send("BBOL") F.indicator(yard.error_indicator_pos,true) end end if event.schedule then if event.msg == "deactivate_check" then if not atc_id then F.indicator(yard.active_indicator_pos,false) S.yards[yard_id].departure_time = rwt.now() if S.print_debug then print(rwt.to_string(rwt.now())) print("YARD "..yard_id..": yard Disabled") end else schedule_in(";05","deactivate_check") return end end end end F.lane_EOL = function(yard_id,this_dir) -- arrow points towards headshunt local yard = S.yards[yard_id] --yard ref if not F.indicator(yard.active_indicator_pos) then return end if F.has_rc(yard_id.."_NOSHUNT") then return end if atc_arrow then if F.indicator(yard.dir_indicator_pos) == this_dir then --train has bounced and needs to leave the rake or depart with it if F.has_rc(yard_id.."_LAST_CLASS") then -- this is the last clasification move F.remove_rc({yard_id.."_LAST_CLASS"}) F.add_rc({yard_id.."_DEPART"}) split_off_locomotive("A0B0") elseif not F.has_rc(yard_id.."_FINAL_COLLECT") then