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