SHOW:
|
|
- or go back to the newest paste.
| 1 | foundMonitor = false | |
| 2 | mw, mh = 0 | |
| 3 | spawners = {}
| |
| 4 | spawners[0] = false | |
| 5 | spawners[1] = true | |
| 6 | red = 16384 | |
| 7 | green = 32 | |
| 8 | scale = 3 | |
| 9 | - | i = x |
| 9 | + | |
| 10 | x = x/scale | |
| 11 | y = y/scale | |
| 12 | w = w/scale | |
| 13 | h = h/scale | |
| 14 | ||
| 15 | i = x | |
| 16 | _w = w + x | |
| 17 | _h = h+y | |
| 18 | while i < _w do | |
| 19 | j = y | |
| 20 | - | mon.setCursorPos(x,y) |
| 20 | + | |
| 21 | paintutils.drawPixel(i,j,c) | |
| 22 | j = j+1 | |
| 23 | end | |
| 24 | i = i+1 | |
| 25 | end | |
| 26 | mon.setCursorPos(x+w/2 - 0.5, y+h/w - 0.5) | |
| 27 | mon.write(label) | |
| 28 | end | |
| 29 | function drawGUI() | |
| 30 | mon.setCursorPos(1,1) | |
| 31 | if spawners[0] == false then | |
| 32 | drawBox(3,3,10,6, red, "OFF") | |
| 33 | else | |
| 34 | drawBox(3,3,10,6, green, "ON") | |
| 35 | end | |
| 36 | ||
| 37 | if spawners[1] == false then | |
| 38 | drawBox(3,12,10,6, red, "OFF") | |
| 39 | else | |
| 40 | drawBox(3,12,10,6, green, "ON") | |
| 41 | end | |
| 42 | ||
| 43 | end | |
| 44 | function update() | |
| 45 | if spawners[0] == true then spawners[0] = false | |
| 46 | else spawners[0] = true | |
| 47 | end | |
| 48 | ||
| 49 | function init() | |
| 50 | if peripheral.isPresent("bottom") then
| |
| 51 | mon = peripheral.wrap("bottom")
| |
| 52 | mw, mh = mon.getSize() | |
| 53 | mon.setBackgroundColor(1) | |
| 54 | mon.setTextScale(scale) | |
| 55 | mon.clear() | |
| 56 | term.redirect(mon) | |
| 57 | foundMonitor = true | |
| 58 | else | |
| 59 | foundMonitor = false | |
| 60 | print("Monitor not found - Aborting")
| |
| 61 | end | |
| 62 | if foundMonitor == true then | |
| 63 | while true do | |
| 64 | update() | |
| 65 | drawGUI() | |
| 66 | sleep(1) | |
| 67 | end | |
| 68 | term.restore() | |
| 69 | end | |
| 70 | end | |
| 71 | ||
| 72 | init() |