View difference between Paste ID: 8SBDkctw and CgfUpLmC
SHOW: | | - or go back to the newest paste.
1
modemSide = "back"
2-
targetID = 119
2+
targetID = 128
3
local monitor = peripheral.wrap("right")
4
 
5
local function drawBar()
6
    local w, h = monitor.getSize()
7
    term.redirect(monitor)
8
 
9
    monitor.setBackgroundColor(colors.white)
10
    monitor.clear()
11
    monitor.setTextColor(colors.orange)
12
    paintutils.drawLine(2, 2, 5, 2, colors.orange)
13
    monitor.setBackgroundColor(colors.white)
14
    monitor.setCursorPos(6, 2)
15
    monitor.write("[Rocket Gate]")
16
    paintutils.drawLine(22, 3, 22, 5, colors.black)
17
    paintutils.drawLine(23, 3, 23, 5, colors.black)
18
    paintutils.drawLine(21, 3, 21, 5, colors.black)
19
    paintutils.drawPixel(20, 6, colors.black)
20
    paintutils.drawPixel(19, 7, colors.black)
21
    paintutils.drawPixel(24, 6, colors.black)
22
    paintutils.drawPixel(25, 7, colors.black)
23
    paintutils.drawPixel(22, 2, colors.black)
24
    paintutils.drawPixel(22, 4, colors.white)
25
 
26
 
27
    monitor.setTextColor(colors.white)
28
    paintutils.drawLine(2, 4, 7, 4, colors.green)
29
    paintutils.drawLine(2, 5, 7, 5, colors.green)
30
    paintutils.drawLine(2, 6, 7, 6, colors.green)
31
    monitor.setCursorPos(2, 5)
32
    monitor.setBackgroundColor(colors.green)
33
    monitor.write("[Open]")
34
 
35
36
    paintutils.drawLine(10, 4, 16, 4, colors.red)
37
    paintutils.drawLine(10, 6, 16, 5, colors.red)
38
    paintutils.drawLine(10, 5, 16, 6, colors.red)
39
    monitor.setCursorPos(10, 5)
40
    monitor.setBackgroundColor(colors.red)
41
    monitor.write("[Close]")
42
 
43
 
44
 
45
 
46
end
47
 
48
 
49
drawBar()
50
 
51
while true do
52
    local event, side, x, y = os.pullEvent("monitor_touch")
53
    monitor.setBackgroundColor(colors.gray)
54
 
55
    if x >= 3 and x <= 7 and y >= 4 and y <= 6 then
56
        rednet.open(modemSide)
57
        rednet.send(targetID, "open")
58
        rednet.close(modemSide)
59
    elseif x >= 10 and x <= 17 and y >= 4 and  y <= 6 then
60
        rednet.open(modemSide)
61
        rednet.send(targetID, "close")
62
        rednet.close(modemSide)
63
    end
64
 
65
    drawBar()
66
 
67
    os.sleep(1)
68
 
69
end