summaryrefslogtreecommitdiff
path: root/pad
diff options
context:
space:
mode:
Diffstat (limited to 'pad')
-rw-r--r--pad/init_code.lua118
-rw-r--r--pad/nodes/(-1053,4,-3352).lua29
-rw-r--r--pad/nodes/(-1053,7,-3336).lua56
-rw-r--r--pad/nodes/(-1054,4,-3333).lua29
-rw-r--r--pad/nodes/(-1055,1,-3333).lua3
-rw-r--r--pad/nodes/(-1055,1,-3352).lua3
-rw-r--r--pad/nodes/(-1061,1,-3321).lua5
-rw-r--r--pad/nodes/(-1107,-5,-3242).lua4
-rw-r--r--pad/nodes/(-1191,-5,-3294).lua4
-rw-r--r--pad/nodes/(-1208,0,-3337).lua56
-rw-r--r--pad/nodes/(-1210,-3,-3345).lua29
-rw-r--r--pad/nodes/(-1210,-6,-3345).lua3
-rw-r--r--pad/nodes/(-4,19,-99).lua3
-rw-r--r--pad/nodes/(-4,3,-100).lua83
-rw-r--r--pad/nodes/(-860,-5,-3265).lua4
-rw-r--r--pad/nodes/(-863,-10,-3236).lua3
-rw-r--r--pad/nodes/(-887,-10,-3156).lua5
-rw-r--r--pad/nodes/(-890,-5,-3154).lua56
-rw-r--r--pad/nodes/(-897,-11,-3154).lua3
-rw-r--r--pad/nodes/(-897,-8,-3153).lua29
-rw-r--r--pad/nodes/(-928,-5,-3274).lua3
-rw-r--r--pad/nodes/(-978,-5,-3264).lua3
-rw-r--r--pad/nodes/(-984,10,-3329).lua38
23 files changed, 569 insertions, 0 deletions
diff --git a/pad/init_code.lua b/pad/init_code.lua
new file mode 100644
index 0000000..5996fe3
--- /dev/null
+++ b/pad/init_code.lua
@@ -0,0 +1,118 @@
+if event.init then
+ local accounts = {}
+ S.acc = S.acc or accounts
+end
+
+F.ack = 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
+
+ if r ~= nil and r > 0 then
+ S.acc[n][c] = S.acc[n][c] - 1
+ end
+ end
+
+ 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
+
+ if m ~= nil then
+ a = m:find("\\u0003watermark\\u0002")
+ c = m:find("\\u0003owner\\u0002")
+ end
+
+ if a ~= nil then
+ wm = m:sub(a+21)
+ end
+
+ if c ~= nil then
+ au = m:sub(c+17)
+ end
+
+ if wm ~= nil then
+ b = wm:find("\\u0003")
+ if b then
+ wm = wm:sub(1, b - 1)
+ end
+ end
+
+ if au ~= nil then
+ d = au:find("\\u0003")
+ if d then
+ au = au:sub(1, d - 1)
+ end
+ if au and au:sub(-9) == "(printed)" then
+ au = au:sub(1, -11)
+ end
+ end
+
+ if au ~= nil and wm ~= nil then
+ r = F.ack(au, wm)
+ else
+ return "ERR:Not a valid transport pass"
+ end
+
+ if r ~= nil and r > 0 then
+ out = "ACC:" .. tostring(r-1) .. " remaining uses"
+ else
+ out = "ERR:No remaining uses. Please top-up."
+ end
+
+ return out
+end \ No newline at end of file
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/(-1053,7,-3336).lua b/pad/nodes/(-1053,7,-3336).lua
new file mode 100644
index 0000000..f9bc218
--- /dev/null
+++ b/pad/nodes/(-1053,7,-3336).lua
@@ -0,0 +1,56 @@
+function printLcd(t)
+ local str = ""
+ for _, i in ipairs(t) do
+ str = str .. i .. "\n"
+ end
+
+ digiline_send("lcd", str)
+end
+
+if not time_table then time_table = {} end
+
+if event.ext_int then
+ local catch = event.message
+
+ if catch[1] == "arr1" then
+ time_table[catch[2]] = 25
+ elseif catch[1] == "arr2" then
+ time_table[catch[2]] = 45
+ elseif catch[1] == "arr3" then
+
+ elseif catch[1] == "dep1" then
+ time_table[catch[2]] = 210
+ elseif catch[1] == "dep2" then
+ time_table[catch[2]] = 180
+ elseif catch[1] == "dep3" then
+ elseif catch[1] == "arr" then
+ time_table[catch[2]] = 0
+ end
+elseif event.int and event.msg == "d" then
+ txt = {" === Next trains ==="}
+ for i, j in pairs(time_table) do
+ local approx = ""
+
+ if j > 0 then
+ time_table[i] = time_table[i] - 5
+ end
+
+ if j < 15 then
+ approx = ">>"
+ elseif j < 60 then
+ approx = j .. "s"
+ else
+ approx = math.floor(j / 60) .. "m"
+ end
+
+ table.insert(txt, string.format("Lighthouse %s", approx))
+ end
+
+ printLcd(txt)
+elseif event.punch then
+ time_table = {}
+ digiline_send("lcd", "This is a test")
+end
+
+interrupt_safe(5, "d")
+
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/pad/nodes/(-1055,1,-3333).lua b/pad/nodes/(-1055,1,-3333).lua
new file mode 100644
index 0000000..dcad264
--- /dev/null
+++ b/pad/nodes/(-1055,1,-3333).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/(-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/(-1061,1,-3321).lua b/pad/nodes/(-1061,1,-3321).lua
new file mode 100644
index 0000000..0c6783a
--- /dev/null
+++ b/pad/nodes/(-1061,1,-3321).lua
@@ -0,0 +1,5 @@
+if event.type == "train" then
+ interrupt_pos(POS(-890,-5,-3154), {"arr2", event.id})
+ interrupt_pos(POS(-1208,0,-3337), {"dep2", event.id})
+ interrupt_pos(POS(-1053,7,-3336), {"dep1", event.id})
+end \ No newline at end of file
diff --git a/pad/nodes/(-1107,-5,-3242).lua b/pad/nodes/(-1107,-5,-3242).lua
new file mode 100644
index 0000000..9492c11
--- /dev/null
+++ b/pad/nodes/(-1107,-5,-3242).lua
@@ -0,0 +1,4 @@
+if event.type == "train" then
+ interrupt_pos(POS(-890,-5,-3154), {"dep2", event.id})
+ interrupt_pos(POS(-1208,0,-3337), {"arr1", event.id})
+end \ No newline at end of file
diff --git a/pad/nodes/(-1191,-5,-3294).lua b/pad/nodes/(-1191,-5,-3294).lua
new file mode 100644
index 0000000..ee184b6
--- /dev/null
+++ b/pad/nodes/(-1191,-5,-3294).lua
@@ -0,0 +1,4 @@
+if event.type == "train" then
+ interrupt_pos(POS(-1208,0,-3337), {"dep1", event.id})
+ interrupt_pos(POS(-1053,7,-3336), {"arr2", event.id})
+end \ No newline at end of file
diff --git a/pad/nodes/(-1208,0,-3337).lua b/pad/nodes/(-1208,0,-3337).lua
new file mode 100644
index 0000000..8d6cdfe
--- /dev/null
+++ b/pad/nodes/(-1208,0,-3337).lua
@@ -0,0 +1,56 @@
+function printLcd(t)
+ local str = ""
+ for _, i in ipairs(t) do
+ str = str .. i .. "\n"
+ end
+
+ digiline_send("lcd", str)
+end
+
+if not time_table then time_table = {} end
+
+if event.ext_int then
+ local catch = event.message
+
+ if catch[1] == "arr1" then
+ time_table[catch[2]] = 15
+ elseif catch[1] == "arr2" then
+ time_table[catch[2]] = 45
+ elseif catch[1] == "arr3" then
+
+ elseif catch[1] == "dep1" then
+ time_table[catch[2]] = 210
+ elseif catch[1] == "dep2" then
+ time_table[catch[2]] = 140
+ elseif catch[1] == "dep3" then
+ elseif catch[1] == "arr" then
+ time_table[catch[2]] = 0
+ end
+elseif event.int and event.msg == "d" then
+ txt = {" === Next trains ==="}
+ for i, j in pairs(time_table) do
+ local approx = ""
+
+ if j > 0 then
+ time_table[i] = time_table[i] - 5
+ end
+
+ if j < 15 then
+ approx = ">>"
+ elseif j < 60 then
+ approx = j .. "s"
+ else
+ approx = math.floor(j / 60) .. "m"
+ end
+
+ table.insert(txt, string.format("Flatcoast %s", approx))
+ end
+
+ printLcd(txt)
+elseif event.punch then
+ time_table = {}
+ digiline_send("lcd", "Initializing TTP...")
+end
+
+interrupt_safe(5, "d")
+
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/(-4,19,-99).lua b/pad/nodes/(-4,19,-99).lua
new file mode 100644
index 0000000..a07fd58
--- /dev/null
+++ b/pad/nodes/(-4,19,-99).lua
@@ -0,0 +1,3 @@
+if event.ext_int then
+ digiline_send("upgr", event.message)
+end \ No newline at end of file
diff --git a/pad/nodes/(-4,3,-100).lua b/pad/nodes/(-4,3,-100).lua
new file mode 100644
index 0000000..9f3f08c
--- /dev/null
+++ b/pad/nodes/(-4,3,-100).lua
@@ -0,0 +1,83 @@
+if event.punch then
+ local i = {
+ "mesecons_materials:silicon",
+ "default:iron_lump",
+ "default:copper_lump",
+ "technic:lead_lump"
+ }
+ local t = { type="set",
+ offer={
+ [1] = {give="currency:minegeld_5", give_count=1, pay=i[1], pay_count=25},
+ [2] = {give="currency:minegeld_5", give_count=1, pay=i[2], pay_count=7},
+ [3] = {give="currency:minegeld_5", give_count=1, pay=i[3], pay_count=6},
+ [4] = {give="currency:minegeld_5", give_count=1, pay=i[4], pay_count=5},
+ }
+ }
+
+ interrupt_pos(POS(-4,19,-99), {"mer_s9", t})
+end
+
+--[[
+
+ mer_s1
+ { type="set",
+ offer={
+ [1] = {give="currency:minegeld", give_count=1, pay="default:cobble", pay_count=99},
+ [2] = {give="currency:minegeld", give_count=2, pay="default:mossycobble", pay_count=99},
+ [3] = {give="currency:minegeld", give_count=4, pay="default:clay", pay_count=99},
+ [4] = {give="currency:minegeld", give_count=1, pay="default:gravel", pay_count=99},
+ }
+ }
+
+
+ mer_s2
+ { type="set",
+ offer={
+ [1] = {give="currency:minegeld", give_count=1, pay="default:grass_1", pay_count=20},
+ [2] = {give="currency:minegeld", give_count=1, pay="default:dry_grass_1", pay_count=20},
+ [3] = {give="currency:minegeld", give_count=1, pay="default:junglegrass", pay_count=50},
+ [4] = {give="currency:minegeld", give_count=1, pay="ethereal:dry_shrub", pay_count=50},
+ }
+ }
+ mer_s3
+ "ethereal:sponge_wet",
+ "default:coral_skeleton",
+ "ethereal:crystal_spike",
+ "ethereal:fire_flower"
+
+ mer_s4
+ "default:papyrus",
+ "ethereal:bamboo",
+ "ethereal:bush",
+ "ethereal:vine"
+
+ mer_s5
+ "default:leaves",
+ "default:jungleleaves",
+ "ethereal:bamboo_leaves",
+ "ethereal:orange_leaves"
+
+ mer_s6
+ "mobs:blood",
+ "mobs:honey",
+ "mobs:hairball",
+ "mobs:intestines"
+
+ mer_s7
+ "technic:plastic_clean",
+ "technic:rubber",
+ "technic:raw_latex",
+ "technic:graphite"
+
+ mer_s8
+ "technic:aspirin_pill",
+ "technic:silicon_wafer",
+ "technic:doped_silicon_wafer",
+ "technic:sulfur_lump"
+
+ mer_s10
+ "ethereal:blue_marble",
+ "technic:marble",
+ "technic:granite",
+ "ethereal:etherium_dust"
+]]-- \ No newline at end of file
diff --git a/pad/nodes/(-860,-5,-3265).lua b/pad/nodes/(-860,-5,-3265).lua
new file mode 100644
index 0000000..18502c2
--- /dev/null
+++ b/pad/nodes/(-860,-5,-3265).lua
@@ -0,0 +1,4 @@
+if event.type == "train" then
+ interrupt_pos(POS(-890,-5,-3154), {"arr1", event.id})
+ interrupt_pos(POS(-1053,7,-3336), {"dep2", event.id})
+end \ No newline at end of file
diff --git a/pad/nodes/(-863,-10,-3236).lua b/pad/nodes/(-863,-10,-3236).lua
new file mode 100644
index 0000000..afaffa2
--- /dev/null
+++ b/pad/nodes/(-863,-10,-3236).lua
@@ -0,0 +1,3 @@
+if event.type == "train" then
+ interrupt_pos(POS(-890,-5,-3154), {"dep1", event.id})
+end \ No newline at end of file
diff --git a/pad/nodes/(-887,-10,-3156).lua b/pad/nodes/(-887,-10,-3156).lua
new file mode 100644
index 0000000..c1cfee3
--- /dev/null
+++ b/pad/nodes/(-887,-10,-3156).lua
@@ -0,0 +1,5 @@
+atc_set_text_outside("Padrana Subway - Greenplain")
+
+if event.type == "train" then
+ interrupt_pos(POS(-890,-5,-3154), {event.id, "arr"})
+end \ No newline at end of file
diff --git a/pad/nodes/(-890,-5,-3154).lua b/pad/nodes/(-890,-5,-3154).lua
new file mode 100644
index 0000000..74680a0
--- /dev/null
+++ b/pad/nodes/(-890,-5,-3154).lua
@@ -0,0 +1,56 @@
+function printLcd(t)
+ local str = ""
+ for _, i in ipairs(t) do
+ str = str .. i .. "\n"
+ end
+
+ digiline_send("lcd", str)
+end
+
+if not time_table then time_table = {} end
+
+if event.ext_int then
+ local catch = event.message
+
+ if catch[1] == "arr1" then
+ time_table[catch[2]] = 15
+ elseif catch[1] == "arr2" then
+ time_table[catch[2]] = 50
+ elseif catch[1] == "arr3" then
+
+ elseif catch[1] == "dep1" then
+ time_table[catch[2]] = 210
+ elseif catch[1] == "dep2" then
+ time_table[catch[2]] = 160
+ elseif catch[1] == "dep3" then
+ elseif catch[1] == "arr" then
+ time_table[catch[2]] = 0
+ end
+elseif event.int and event.msg == "d" then
+ txt = {" === Next trains ==="}
+ for i, j in pairs(time_table) do
+ local approx = ""
+
+ if j > 0 then
+ time_table[i] = time_table[i] - 5
+ end
+
+ if j < 15 then
+ approx = ">>"
+ elseif j < 60 then
+ approx = j .. "s"
+ else
+ approx = math.floor(j / 60) .. "m"
+ end
+
+ table.insert(txt, string.format("Greenplain %s", approx))
+ end
+
+ printLcd(txt)
+elseif event.punch then
+ time_table = {}
+ digiline_send("lcd", "Initializing TTP...")
+end
+
+interrupt_safe(5, "d")
+
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/(-897,-8,-3153).lua b/pad/nodes/(-897,-8,-3153).lua
new file mode 100644
index 0000000..13b89b6
--- /dev/null
+++ b/pad/nodes/(-897,-8,-3153).lua
@@ -0,0 +1,29 @@
+local OPENER = {x=-897,y=-11,z=-3154}
+
+if event.type == "digiline" then
+ local catch = event
+ local prefix = catch.msg:sub(1, 4)
+ local message, r_prefix
+
+ if catch.channel == "Lig" 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/(-928,-5,-3274).lua b/pad/nodes/(-928,-5,-3274).lua
new file mode 100644
index 0000000..3171e88
--- /dev/null
+++ b/pad/nodes/(-928,-5,-3274).lua
@@ -0,0 +1,3 @@
+if event.type == "train" then
+ interrupt_pos(POS(-1208,0,-3337), {"arr2", event.id})
+end \ No newline at end of file
diff --git a/pad/nodes/(-978,-5,-3264).lua b/pad/nodes/(-978,-5,-3264).lua
new file mode 100644
index 0000000..1b812fb
--- /dev/null
+++ b/pad/nodes/(-978,-5,-3264).lua
@@ -0,0 +1,3 @@
+if event.type == "train" then
+ interrupt_pos(POS(-1053,7,-3336), {"arr1", event.id})
+end \ No newline at end of file
diff --git a/pad/nodes/(-984,10,-3329).lua b/pad/nodes/(-984,10,-3329).lua
new file mode 100644
index 0000000..30010d4
--- /dev/null
+++ b/pad/nodes/(-984,10,-3329).lua
@@ -0,0 +1,38 @@
+if event.type == "punch" then
+ digiline_send("commit", true) --{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