diff options
Diffstat (limited to 'pad/nodes/(-890,-5,-3154).lua')
| -rw-r--r-- | pad/nodes/(-890,-5,-3154).lua | 56 |
1 files changed, 56 insertions, 0 deletions
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") + |
