summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pad/init_code.lua47
-rw-r--r--pad/nodes/(-1053,4,-3352).lua29
-rw-r--r--pad/nodes/(-1054,4,-3333).lua29
-rw-r--r--pad/nodes/(-1055,1,-3333).lua (renamed from m4/nodes/(-897,-11,-3154).lua)0
-rw-r--r--pad/nodes/(-1055,1,-3352).lua3
-rw-r--r--pad/nodes/(-1210,-3,-3345).lua29
-rw-r--r--pad/nodes/(-1210,-6,-3345).lua3
-rw-r--r--pad/nodes/(-897,-11,-3154).lua3
-rw-r--r--pad/nodes/(-984,10,-3329).lua39
9 files changed, 178 insertions, 4 deletions
diff --git a/pad/init_code.lua b/pad/init_code.lua
index e0fbfdf..5996fe3 100644
--- a/pad/init_code.lua
+++ b/pad/init_code.lua
@@ -21,6 +21,53 @@ F.ack = function(n, c)
return r
end
+F.ack2 = function(n, c)
+ local r
+ local acc_n
+
+ if n ~= nil and c ~= nil then
+ acc_n = S.acc and S.acc[n]
+ if acc_n then
+ r = S.acc[n][c]
+ end
+ end
+
+ return r
+end
+
+F.cac = function(n)
+ local c = 0
+
+ if n ~= nil and S.acc[n] ~= nil then
+ for _ in pairs(S.acc[n]) do
+ c = c + 1
+ end
+ end
+
+ return c
+end
+
+F.adc = function(n, c, a)
+ local s
+
+ if n ~= nil and c ~= nil then
+ acc_n = S.acc and S.acc[n]
+
+ if not acc_n then
+ S.acc[n] = {}
+ end
+ S.acc[n][c] = a
+
+ if not S.acc[n][c] then
+ s = false
+ else
+ s = true
+ end
+ end
+
+ return s
+end
+
F.ick = function (m)
local wm, au, out, r
local a, b, c, d
diff --git a/pad/nodes/(-1053,4,-3352).lua b/pad/nodes/(-1053,4,-3352).lua
new file mode 100644
index 0000000..6d0c5aa
--- /dev/null
+++ b/pad/nodes/(-1053,4,-3352).lua
@@ -0,0 +1,29 @@
+local OPENER = {x=-1055,y=1,z=-3352}
+
+if event.type == "digiline" then
+ local catch = event
+ local prefix = catch.msg:sub(1, 4)
+ local message, r_prefix
+
+ if catch.channel == "Fla" and prefix == "uput" then
+ message = F.ick(catch.msg)
+
+ if message ~= nil then
+ r_prefix = message:sub(1, 3)
+ end
+
+ if r_prefix ~= nil then
+ if r_prefix == "ACC" then
+ interrupt(5)
+ interrupt_pos(OPENER, "open")
+ end
+ digiline_send("pref_sc", message:sub(5))
+ end
+ else
+ interrupt(5)
+ end
+end
+
+if event.type == "int" then
+ digiline_send("pref_sc", "Please insert your transport pass below")
+end
diff --git a/pad/nodes/(-1054,4,-3333).lua b/pad/nodes/(-1054,4,-3333).lua
new file mode 100644
index 0000000..18a9d4f
--- /dev/null
+++ b/pad/nodes/(-1054,4,-3333).lua
@@ -0,0 +1,29 @@
+local OPENER = {x=-1055,y=1,z=-3333}
+
+if event.type == "digiline" then
+ local catch = event
+ local prefix = catch.msg:sub(1, 4)
+ local message, r_prefix
+
+ if catch.channel == "Fla" and prefix == "uput" then
+ message = F.ick(catch.msg)
+
+ if message ~= nil then
+ r_prefix = message:sub(1, 3)
+ end
+
+ if r_prefix ~= nil then
+ if r_prefix == "ACC" then
+ interrupt(5)
+ interrupt_pos(OPENER, "open")
+ end
+ digiline_send("pref_sc", message:sub(5))
+ end
+ else
+ interrupt(5)
+ end
+end
+
+if event.type == "int" then
+ digiline_send("pref_sc", "Please insert your transport pass below")
+end \ No newline at end of file
diff --git a/m4/nodes/(-897,-11,-3154).lua b/pad/nodes/(-1055,1,-3333).lua
index dcad264..dcad264 100644
--- a/m4/nodes/(-897,-11,-3154).lua
+++ b/pad/nodes/(-1055,1,-3333).lua
diff --git a/pad/nodes/(-1055,1,-3352).lua b/pad/nodes/(-1055,1,-3352).lua
new file mode 100644
index 0000000..dcad264
--- /dev/null
+++ b/pad/nodes/(-1055,1,-3352).lua
@@ -0,0 +1,3 @@
+if event.type == "ext_int" and event.message == "open" then
+ digiline_send("open", "on")
+end \ No newline at end of file
diff --git a/pad/nodes/(-1210,-3,-3345).lua b/pad/nodes/(-1210,-3,-3345).lua
new file mode 100644
index 0000000..4d23b39
--- /dev/null
+++ b/pad/nodes/(-1210,-3,-3345).lua
@@ -0,0 +1,29 @@
+local OPENER = {x=-1210,y=-6,z=-3345}
+
+if event.type == "digiline" then
+ local catch = event
+ local prefix = catch.msg:sub(1, 4)
+ local message, r_prefix
+
+ if catch.channel == "Gre" and prefix == "uput" then
+ message = F.ick(catch.msg)
+
+ if message ~= nil then
+ r_prefix = message:sub(1, 3)
+ end
+
+ if r_prefix ~= nil then
+ if r_prefix == "ACC" then
+ interrupt(5)
+ interrupt_pos(OPENER, "open")
+ end
+ digiline_send("pref_sc", message:sub(5))
+ end
+ else
+ interrupt(5)
+ end
+end
+
+if event.type == "int" then
+ digiline_send("pref_sc", "Please insert your transport pass below")
+end \ No newline at end of file
diff --git a/pad/nodes/(-1210,-6,-3345).lua b/pad/nodes/(-1210,-6,-3345).lua
new file mode 100644
index 0000000..dcad264
--- /dev/null
+++ b/pad/nodes/(-1210,-6,-3345).lua
@@ -0,0 +1,3 @@
+if event.type == "ext_int" and event.message == "open" then
+ digiline_send("open", "on")
+end \ No newline at end of file
diff --git a/pad/nodes/(-897,-11,-3154).lua b/pad/nodes/(-897,-11,-3154).lua
new file mode 100644
index 0000000..dcad264
--- /dev/null
+++ b/pad/nodes/(-897,-11,-3154).lua
@@ -0,0 +1,3 @@
+if event.type == "ext_int" and event.message == "open" then
+ digiline_send("open", "on")
+end \ No newline at end of file
diff --git a/pad/nodes/(-984,10,-3329).lua b/pad/nodes/(-984,10,-3329).lua
index e1a0de7..a25f6b8 100644
--- a/pad/nodes/(-984,10,-3329).lua
+++ b/pad/nodes/(-984,10,-3329).lua
@@ -1,7 +1,38 @@
if event.type == "punch" then
- if S.acc[event.name] ~= nil then
--- digiline_send("output", "You already own a transport\npass. You can use it at\nany station or top-up your\nrides at a selling point.")
--- else
- digiline_send("commit", event.name)
+ digiline_send("commit", {name, F.cac(name)})
+end
+
+if event.channel == "ack" then
+ local catch = event.msg
+ name = catch[1]
+ wm = catch[2]
+
+ if F.ack2(name, wm) then
+ digiline_send("ack_r", S.acc[name][wm])
+ else
+ digiline_send("ack_r", false)
end
+end
+
+if event.channel == "checkout" then
+ local catch = event.msg
+ name = catch[1]
+ wm = catch[2]
+ amount = catch[3]
+
+ if F.ack2(name, wm) and amount ~= nil then
+ S.acc[name][wm] = S.acc[name][wm] + amount
+ digiline_send("checkout_r", true)
+ else
+ digiline_send("checkout_r", false)
+ end
+end
+
+if event.channel == "create" then
+ local catch = event.msg
+ name = catch[1]
+ wm = catch[2]
+ am = catch[3]
+
+ F.adc(name, wm, am)
end \ No newline at end of file