View difference between Paste ID: Z84dBdkz and YffAVKz6
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
8+
scale = 2
9
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-
	mon.setCursorPos(x+w/2 - 0.5, y+h/w - 0.5)
26+
27
	end
28
	mon.setCursorPos(x - w/2, y -h/2)
29
	mon.write(label)
30
end
31
function drawGUI()
32-
		drawBox(3,3,10,6, red, "OFF")
32+
33
	if spawners[0] == false then
34-
		drawBox(3,3,10,6, green, "ON")
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-
		drawBox(3,12,10,6, red, "OFF")
38+
39
	if spawners[1] == false then
40-
		drawBox(3,12,10,6, green, "ON")
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
51
function init()
52
if peripheral.isPresent("bottom") then	
53
	mon = peripheral.wrap("bottom")
54
	mw, mh = mon.getSize()
55
	mon.setBackgroundColor(1)
56
	mon.setTextScale(scale)
57
	mon.clear()
58
	term.redirect(mon)
59
	foundMonitor = true
60
else
61
	foundMonitor = false
62
	print("Monitor not found - Aborting")
63
end
64
if foundMonitor == true then
65
	while true do 
66
		update()
67
		drawGUI()
68
		sleep(1)
69
	end
70
	term.restore()
71
end
72
end
73
74
init()