Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.wrap("top") -- Configura o monitor na parte de cima
- monitor.setTextScale(1) -- Define o tamanho do texto como 1
- function updateMonitor(status)
- monitor.clear()
- local width, height = monitor.getSize()
- local line1 = "REATOR"
- local line2 = status and "ATIVO" or "DESLIGADO"
- monitor.setBackgroundColor(status and colors.green or colors.red)
- monitor.setTextColor(colors.white)
- monitor.clear()
- -- Centralizar a primeira linha
- local x1 = math.floor((width - #line1) / 2) + 1
- local y1 = math.floor(height / 2) - 1
- monitor.setCursorPos(x1, y1)
- monitor.write(line1)
- -- Centralizar a segunda linha
- local x2 = math.floor((width - #line2) / 2) + 1
- local y2 = math.floor(height / 2) + 1
- monitor.setCursorPos(x2, y2)
- monitor.write(line2)
- end
- -- Loop principal
- while true do
- local signal = redstone.getInput("back") -- Altere "back" para a direção correta
- updateMonitor(signal)
- sleep(1) -- Aguarda 1 segundo antes de verificar novamente
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement