SHOW:
|
|
- or go back to the newest paste.
| 1 | API = require("buttonAPI")
| |
| 2 | local event = require("event")
| |
| 3 | local computer = require("computer")
| |
| 4 | local term = require("term")
| |
| 5 | local component = require("component")
| |
| 6 | local gpu = component.gpu | |
| 7 | ||
| 8 | local rs = component.redstone | |
| 9 | local colors = require("colors")
| |
| 10 | local sides = require("sides")
| |
| 11 | ||
| 12 | function API.fillTable() | |
| 13 | - | API.setTable("Gen I", test1, 10,20,3,5)
|
| 13 | + | API.setTable("Hall", test1, 10,30,3,5)
|
| 14 | - | API.setTable("Gen II", test2, 22,32,3,5)
|
| 14 | + | API.setTable("Entrance", test2, 32,52,3,5)
|
| 15 | - | API.setTable("Gen III", test3, 10,20,8,10)
|
| 15 | + | API.setTable("Stall lights", test3, 10,30,8,10)
|
| 16 | - | API.setTable("Exit", test4, 22,32,8,10)
|
| 16 | + | API.setTable("Stall power", test4, 32,52,8,10)
|
| 17 | API.screen() | |
| 18 | end | |
| 19 | ||
| 20 | function getClick() | |
| 21 | local _, _, x, y = event.pull(1,touch) | |
| 22 | if x == nil or y == nil then | |
| 23 | local h, w = gpu.getResolution() | |
| 24 | gpu.set(h, w, ".") | |
| 25 | gpu.set(h, w, " ") | |
| 26 | else | |
| 27 | API.checkxy(x,y) | |
| 28 | end | |
| 29 | end | |
| 30 | ||
| 31 | function test1() | |
| 32 | - | API.toggleButton("Gen I")
|
| 32 | + | API.toggleButton("Hall")
|
| 33 | if buttonStatus == true then | |
| 34 | term.setCursor(1,25) | |
| 35 | term.write("Working... ")
| |
| 36 | rs.setOutput(sides.left,15) | |
| 37 | - | os.sleep(3) |
| 37 | + | os.sleep(1) |
| 38 | term.setCursor(1,25) | |
| 39 | term.write("System ready ")
| |
| 40 | else | |
| 41 | term.setCursor(1,25) | |
| 42 | term.write("Working... ")
| |
| 43 | rs.setOutput(sides.left,0) | |
| 44 | - | os.sleep(3) |
| 44 | + | os.sleep(1) |
| 45 | term.setCursor(1,25) | |
| 46 | term.write("System ready ")
| |
| 47 | end | |
| 48 | end | |
| 49 | ||
| 50 | ||
| 51 | function test2() | |
| 52 | - | API.toggleButton("Gen II")
|
| 52 | + | API.toggleButton("Entrance")
|
| 53 | if buttonStatus == true then | |
| 54 | term.setCursor(1,25) | |
| 55 | term.write("Working... ")
| |
| 56 | rs.setOutput(sides.up,15) | |
| 57 | - | os.sleep(3) |
| 57 | + | os.sleep(1) |
| 58 | term.setCursor(1,25) | |
| 59 | term.write("System ready ")
| |
| 60 | else | |
| 61 | term.setCursor(1,25) | |
| 62 | term.write("Working... ")
| |
| 63 | rs.setOutput(sides.up,0) | |
| 64 | - | os.sleep(3) |
| 64 | + | os.sleep(1) |
| 65 | term.setCursor(1,25) | |
| 66 | term.write("System ready ")
| |
| 67 | end | |
| 68 | end | |
| 69 | ||
| 70 | function test3() | |
| 71 | - | API.toggleButton("Gen III")
|
| 71 | + | API.toggleButton("Stall lights")
|
| 72 | if buttonStatus == true then | |
| 73 | term.setCursor(1,25) | |
| 74 | term.write("Working... ")
| |
| 75 | rs.setOutput(sides.right,15) | |
| 76 | - | os.sleep(3) |
| 76 | + | os.sleep(1) |
| 77 | term.setCursor(1,25) | |
| 78 | term.write("System ready ")
| |
| 79 | else | |
| 80 | term.setCursor(1,25) | |
| 81 | term.write("Working... ")
| |
| 82 | rs.setOutput(sides.right,0) | |
| 83 | - | os.sleep(3) |
| 83 | + | os.sleep(1) |
| 84 | term.setCursor(1,25) | |
| 85 | term.write("System ready ")
| |
| 86 | end | |
| 87 | end | |
| 88 | ||
| 89 | function test4() | |
| 90 | - | term.clear() |
| 90 | + | API.toggleButton("Stall power")
|
| 91 | - | os.exit() |
| 91 | + | |
| 92 | term.setCursor(1,25) | |
| 93 | term.write("Working... ")
| |
| 94 | rs.setOutput(sides.back,15) | |
| 95 | os.sleep(1) | |
| 96 | term.setCursor(1,25) | |
| 97 | term.write("System ready ")
| |
| 98 | - | API.heading("Heisenberg nuclear plant control system")
|
| 98 | + | |
| 99 | - | API.label(1,24,"Charlestown, Skovetsky.") |
| 99 | + | |
| 100 | term.write("Working... ")
| |
| 101 | rs.setOutput(sides.back,0) | |
| 102 | os.sleep(1) | |
| 103 | term.setCursor(1,25) | |
| 104 | term.write("System ready ")
| |
| 105 | end | |
| 106 | end | |
| 107 | ||
| 108 | term.setCursorBlink(false) | |
| 109 | gpu.setResolution(80, 25) | |
| 110 | API.clear() | |
| 111 | API.fillTable() | |
| 112 | API.heading("Power control - by maumagro")
| |
| 113 | API.label(1,24,"Buenos Aires, Argentina.") | |
| 114 | ||
| 115 | while true do | |
| 116 | getClick() | |
| 117 | end | |
| 118 | ||
| 119 | ||
| 120 | ||
| 121 | --eof |