summaryrefslogtreecommitdiff
path: root/auto_yards/nodes/(771,14,-16).lua
blob: 447dce1170a2961aa5a7f936020693617c9332a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--leekston collection controller
local up_dir = "North"
local down_dir = "South"
local up_dir_indicator = POS(771,13,-14)
local down_dir_indicator = POS(771,13,-15)
local exit_indicator_pos = POS(771,13,-18)

local userlist = {
	"Maverick2797", 
	"mary4"
}

if event.ext_int then --to be pinged by the departing LHF train only
	local dir
	if F.indicator(exit_indicator_pos) then
		F.indicator(up_dir_indicator, false)
		dir = up_dir
	else
		F.indicator(down_dir_indicator, false)
		dir = down_dir
	end
	digiline_send("lcd",string.format("%s | Train collected and departed %sbound",rwt.to_string(rwt.now()), dir))
	return
end

--confirm user is actually allowed to use this system
local permitted_user = false
for _,name in pairs(userlist) do
	if name == event.name then
		permitted_user = name
		break
	end
end
if not permitted_user then
	digiline_send("lcd","User is not permitted to use this. Contact a moderator")
	return
end

local dir = ""
--cycle through the departure options
if F.indicator(up_dir_indicator) then
	F.indicator(up_dir_indicator, false)
	F.indicator(down_dir_indicator, true)
	dir = down_dir.."bound"
elseif F.indicator(down_dir_indicator) then
	F.indicator(up_dir_indicator, false)
	F.indicator(down_dir_indicator, false)
	dir = "Disabled"
else
	F.indicator(up_dir_indicator, true)
	F.indicator(down_dir_indicator, false)
	dir = up_dir.."bound"
end

digiline_send("lcd",string.format("%s\nCollection %s.\nUser %s", rwt.to_string(rwt.now()), dir, event.name))