-
Notifications
You must be signed in to change notification settings - Fork 0
/
nether_lava_pump_tesseract_control.lua
63 lines (54 loc) · 1.7 KB
/
nether_lava_pump_tesseract_control.lua
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
57
58
59
60
61
62
63
-- bind our monitor
local monitor = peripheral.wrap("back")
-- set the text size
monitor.setTextScale(0.5)
-- initialise the redstone output
redstone.setOutput("right", false)
function redraw_screen()
-- set background colour to black
monitor.setBackgroundColor(colors.black)
-- clear the screen before we redraw it
monitor.clear()
-- print our title
monitor.setCursorPos(3,2)
monitor.write("NETHER LAVA")
monitor.setCursorPos(7,3)
monitor.write("PUMP")
-- draw the tesseract box, colour depending on what state the outputs are in
monitor.setCursorPos(2,6)
if redstone.getOutput("right") == false then
monitor.setBackgroundColor(colors.red)
monitor.write(" ")
monitor.setCursorPos(2,7)
monitor.write(" TESSERACT ")
monitor.setCursorPos(2,8)
monitor.write(" DISABLED ")
monitor.setCursorPos(2,9)
monitor.write(" ")
elseif redstone.getOutput("right") == true then
monitor.setBackgroundColor(colors.lime)
monitor.write(" ")
monitor.setCursorPos(2,7)
monitor.write(" TESSERACT ")
monitor.setCursorPos(2,8)
monitor.write(" ENABLED ")
monitor.setCursorPos(2,9)
monitor.write(" ")
end
end
-- call redraw_screen once to draw the screen for the first time
redraw_screen()
while true do
-- pull touch events from the screen
event, side, xPos, yPos = os.pullEvent("monitor_touch")
-- if the touch was within the tesseract box, toggle that output
if xPos >= 2 and xPos <=14 and yPos >= 6 and yPos <= 9 then
if redstone.getOutput("right") == false then
redstone.setOutput("right", true)
redraw_screen()
elseif redstone.getOutput("right") == true then
redstone.setOutput("right", false)
redraw_screen()
end
end
end