Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modemSide = "back"
- targetID = 128
- local monitor = peripheral.wrap("right")
- local function drawBar()
- local w, h = monitor.getSize()
- term.redirect(monitor)
- monitor.setBackgroundColor(colors.white)
- monitor.clear()
- monitor.setTextColor(colors.orange)
- paintutils.drawLine(2, 2, 5, 2, colors.orange)
- monitor.setBackgroundColor(colors.white)
- monitor.setCursorPos(6, 2)
- monitor.write("[Rocket Gate]")
- paintutils.drawLine(22, 3, 22, 5, colors.black)
- paintutils.drawLine(23, 3, 23, 5, colors.black)
- paintutils.drawLine(21, 3, 21, 5, colors.black)
- paintutils.drawPixel(20, 6, colors.black)
- paintutils.drawPixel(19, 7, colors.black)
- paintutils.drawPixel(24, 6, colors.black)
- paintutils.drawPixel(25, 7, colors.black)
- paintutils.drawPixel(22, 2, colors.black)
- paintutils.drawPixel(22, 4, colors.white)
- monitor.setTextColor(colors.white)
- paintutils.drawLine(2, 4, 7, 4, colors.green)
- paintutils.drawLine(2, 5, 7, 5, colors.green)
- paintutils.drawLine(2, 6, 7, 6, colors.green)
- monitor.setCursorPos(2, 5)
- monitor.setBackgroundColor(colors.green)
- monitor.write("[Open]")
- paintutils.drawLine(10, 4, 16, 4, colors.red)
- paintutils.drawLine(10, 6, 16, 5, colors.red)
- paintutils.drawLine(10, 5, 16, 6, colors.red)
- monitor.setCursorPos(10, 5)
- monitor.setBackgroundColor(colors.red)
- monitor.write("[Close]")
- end
- drawBar()
- while true do
- local event, side, x, y = os.pullEvent("monitor_touch")
- monitor.setBackgroundColor(colors.gray)
- if x >= 3 and x <= 7 and y >= 4 and y <= 6 then
- rednet.open(modemSide)
- rednet.send(targetID, "open")
- rednet.close(modemSide)
- elseif x >= 10 and x <= 17 and y >= 4 and y <= 6 then
- rednet.open(modemSide)
- rednet.send(targetID, "close")
- rednet.close(modemSide)
- end
- drawBar()
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement