Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Connexion redNet
- function draw_line(x, y, length, color)
- monitor.setBackgroundColor(color)
- monitor.setCursorPos(x,y)
- monitor.write(string.rep(" ", length))
- end
- function draw_text(x, y, text, text_color, bg_color)
- monitor.setBackgroundColor(bg_color)
- monitor.setTextColor(text_color)
- monitor.setCursorPos(x,y)
- monitor.write(text)
- end
- function updateText()
- if id == 10 then
- if msg == 0 then
- monitor.clear()
- cadragetop(colors.red)
- draw_text(5, 4, "Réacteur 1", colors.red, colors.black)
- draw_text(5, 17, "Réacteur 2", colors.red, colors.black)
- draw_text(8,8,"RF/T",colors.red,colors.black)
- draw_text(8,22,"RF/T", colors.red, colors.black)
- draw_text(7,7,tostring(msg), colors.red, colors.black)
- else
- cadragetop(colors.lime)
- affichage()
- draw_text(7,7,tostring(msg), colors.red, colors.black)
- end
- elseif id == 17 then
- if msg == 0 then
- monitor.clear()
- cadragebot(colors.red)
- draw_text(5, 4, "Réacteur 1", colors.red, colors.black)
- draw_text(5, 17, "Réacteur 2", colors.red, colors.black)
- draw_text(8,8,"RF/T",colors.red,colors.black)
- draw_text(8,22,"RF/T", colors.red, colors.black)
- draw_text(7,21,"0", colors.red, colors.black)
- else
- cadragebot(colors.lime)
- affichage()
- draw_text(7,21,tostring(msg), colors.red, colors.black)
- end
- else return
- end
- end
- function connexion()
- rednet.open("top")
- id,msg = rednet.receive()
- updateText()
- end
- -- Définit l'écran
- monitor = peripheral.wrap("bottom")
- monitor.setTextScale(1)
- monitor.clear()
- function cadragetop(color)
- draw_line(1, 1 ,18 , color)
- for i = 2,13 do
- draw_line(1,i,1 ,color)
- end
- for i = 2,13 do
- draw_line(18,i,1,color)
- end
- draw_line(1,13,18,color)
- end
- function cadragebot(color)
- draw_line(1,14,18,color)
- for i = 15,25 do
- draw_line(1,i,1,color)
- end
- for i = 15,25 do
- draw_line(18,i,1,color)
- end
- draw_line(1,26,18,color)
- end
- draw_text(5, 4, "Réacteur 1", colors.red, colors.black)
- draw_text(5, 17, "Réacteur 2", colors.red, colors.black)
- draw_text(8,8,"RF/T",colors.red,colors.black)
- draw_text(8,22,"RF/T", colors.red, colors.black)
- while true do
- parallel.waitForAny(connexion)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement