summaryrefslogtreecommitdiff
path: root/pad/nodes/(-1053,7,-3336).lua
blob: f9bc218d43f2845c25903696e92ea5cc1b2d6b63 (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
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")