summaryrefslogtreecommitdiff
path: root/auto_yards/nodes/(771,14,-16).lua
diff options
context:
space:
mode:
Diffstat (limited to 'auto_yards/nodes/(771,14,-16).lua')
-rw-r--r--auto_yards/nodes/(771,14,-16).lua55
1 files changed, 55 insertions, 0 deletions
diff --git a/auto_yards/nodes/(771,14,-16).lua b/auto_yards/nodes/(771,14,-16).lua
new file mode 100644
index 0000000..447dce1
--- /dev/null
+++ b/auto_yards/nodes/(771,14,-16).lua
@@ -0,0 +1,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)) \ No newline at end of file