Advertisement
sshikamaru

pc plasma

Jul 26th, 2014
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 23.92 KB | None | 0 0
  1. local computer = require("computer")
  2. local component = require("component")
  3. local term = require("term")
  4. local math = require("math")
  5. local event = require("event")
  6. string = require("string")
  7. unicode = require("unicode")
  8. local colors = require("colors")
  9. local sides = require("sides")
  10.  
  11. --Récupération des écrans
  12. local screen1 = component.get("60a8","screen")
  13. local screen2 = component.get("08d2","screen")
  14. local screen3 = component.get("3686","screen")
  15.  
  16. --récupérations des GPU et résolution
  17. local gpu1 = component.get("20a8","gpu")
  18. local gpu2 = component.get("0ede","gpu")
  19. local gpu3 = component.get("8132","gpu")
  20. local pgpu1 = component.proxy(gpu1)
  21. local pgpu2 = component.proxy(gpu2)
  22. local pgpu3 = component.proxy(gpu3)
  23.  
  24. pgpus={}
  25. pgpus[1] = component.proxy(gpu1)
  26. pgpus[2] = component.proxy(gpu2)
  27. pgpus[3] = component.proxy(gpu3)
  28.  
  29. pgpus[3].bind(screen3)
  30. pgpus[3].setResolution(45,25)
  31. pgpus[3].set(1,1,"Ecran 3 prêt!")
  32.  
  33. pgpus[2].bind(screen2)
  34. pgpus[2].setResolution(45,25)
  35. pgpus[2].set(1,1,"Ecran 2 prêt!")
  36.  
  37. pgpus[1].bind(screen1)
  38. pgpus[1].setResolution(63,35)
  39. pgpus[1].set(1,1,"Ecran 1 prêt!")
  40.  
  41.  
  42. --Récupération de la redstone
  43. local grs1 = component.get("16a3","redstone")
  44. local grs2 = component.get("201f","redstone")
  45. local grs3 = component.get("3188","redstone")
  46. local grs4 = component.get("b0b8","redstone")
  47. local rs1 = component.proxy(grs1)
  48. local rs2 = component.proxy(grs2)
  49. local rs3 = component.proxy(grs3)
  50. local rs4 = component.proxy(grs4)
  51.  
  52. local commande = sides.top
  53. local r_color = {colors.white,colors.orange,colors.magenta,colors.lightblue,colors.yellow,colors.lime,colors.pink,colors.gray}
  54.  
  55. --Récupération des tanks
  56. local gtank1 = component.get("6c90","thermalexpansion_tank_resonant_name")
  57. local gtank2 = component.get("1ade","thermalexpansion_tank_resonant_name")
  58. local gtank3 = component.get("7609","thermalexpansion_tank_resonant_name")
  59. local gtank4 = component.get("64c6","thermalexpansion_tank_resonant_name")
  60. local tank1 = component.proxy(gtank1)
  61. local tank2 = component.proxy(gtank2)
  62. local tank3 = component.proxy(gtank3)
  63. local tank4 = component.proxy(gtank4)
  64.  
  65. local fusions = {
  66.   {redstone=rs1,tank=tank1},
  67.   {redstone=rs2,tank=tank2},
  68.   {redstone=rs3,tank=tank3},
  69.   {redstone=rs4,tank=tank4}
  70. }
  71.  
  72. --récupération de l'IDSU
  73. idsu = component.getPrimary("gt_idsu")
  74.  
  75. --Définition des paliers de déclenchement
  76.   local palier = 990000000
  77.   local delta = 5000000
  78.  
  79. local function setColor(bg,fg,gpu)
  80.   pgpus[gpu].setBackground(bg)
  81.   pgpus[gpu].setForeground(fg)
  82. end
  83.  
  84.  local function unit(qty)
  85.   if qty >= 1000000000 then
  86.     return string.format("%.02fMB",qty/10000000)
  87.   elseif qty >=1000000 then
  88.     return string.format("%.02fKB",qty/1000000)
  89.   elseif qty >=1000 then
  90.     return string.format("%.02fB",qty/1000)
  91.   else
  92.     return string.format("%dmB",qty)
  93.   end
  94. end
  95.  
  96. function loadbar(x,y,width,cur,text,bg,gpu)
  97.   local raw = " " .. text ..string.rep(" ", width - unicode.len(text) - 2) .. " "
  98.   local oldbg = gpu.setBackground(bg)
  99.   local oldfg = gpu.setForeground(0xFFFFFF - bg)
  100.   gpu.set(x,y,unicode.sub(raw,1,cur))
  101.   gpu.setBackground(oldbg)
  102.   gpu.setForeground(oldfg)
  103.   gpu.set(x+cur,y,unicode.sub(raw,cur+1,width))
  104. end
  105.  
  106. local function affidsu(x,y,length,gpu)
  107.   local amount = idsu.getStored()
  108.   local capacity = idsu.getCapacity()
  109.   local output = idsu.getOutput()
  110.   local pct = amount / capacity
  111.   local cur = math.floor(pct * length)
  112.   local color = 0x00FFFF
  113.   local textfrac = string.format("%s / %s", amount, capacity)
  114.   local textpct = string.format("%.02f%%", pct*100)
  115.   local text = textfrac .. string.rep(" ", length - string.len(textfrac) - string.len(textpct) - 2) .. textpct
  116.   local dir = ""
  117.   loadbar(x,y,length,cur,dir,color,pgpus[gpu])
  118.   loadbar(x,y+1,length,cur,dir,color,pgpus[gpu])
  119.   loadbar(x,y+2,length,cur,text,color,pgpus[gpu])
  120. end  
  121.  
  122. local function affplasma(x,y,length,fusion,gpu)
  123.   local amount = fusions[fusion].tank.getTankInfo().amount
  124.   local capacity = fusions[fusion].tank.getTankInfo().capacity
  125.   local pct = amount / capacity
  126.   local cur = math.floor(pct * length)
  127.   local dir = ""
  128.  
  129.   local label = "Plasma d'hélium"
  130.   local color = 0xffff66
  131.   local textfrac = string.format("%s / %s", unit(amount), unit(capacity))
  132.   local textpct = string.format("%.02f%%", pct*100)
  133.   local text = textfrac ..string.rep(" ", length - string.len(textfrac) - string.len(textpct) - 2) .. textpct
  134.   loadbar(x,y,length,cur,text,color,pgpus[gpu])
  135. end
  136.  
  137. --Fonctions texte variable
  138.  
  139. local function marche_on(x, y, gpu)
  140.   setColor(0x00FF00, 0x0, gpu)
  141.   pgpus[gpu].set(x,y,"MARCHE")
  142.   setColor(0x0, 0xFFFFFF, gpu)
  143. end
  144.  
  145. local function marche_off(x, y, gpu)
  146.   setColor(0x0, 0x00FF00, gpu)
  147.   pgpus[gpu].set(x,y,"MARCHE")
  148.   setColor(0x0, 0xFFFFFF, gpu)
  149. end
  150.  
  151. local function auto_on(x, y, gpu)
  152.   setColor(0xFFFA000, 0x0, gpu)
  153.   pgpus[gpu].set(x,y,"AUTO")
  154.   setColor(0x0, 0xFFFFFF, gpu)
  155. end
  156.  
  157. local function auto_off(x, y, gpu)
  158.   setColor(0x0, 0xFFFA000, gpu)
  159.   pgpus[gpu].set(x,y,"AUTO")
  160.   setColor(0x0, 0xFFFFFF, gpu)
  161. end
  162.  
  163. local function arret_on(x, y, gpu)
  164.   setColor(0xFF0000, 0xFFFFFF, gpu)
  165.   pgpus[gpu].set(x,y,"ARRET")
  166.   setColor(0x0, 0xFF0000, gpu)
  167. end
  168.  
  169. local function arret_off(x, y, gpu)
  170.   setColor(0x0, 0xFF0000, gpu)
  171.   pgpus[gpu].set(x,y,"ARRET")
  172.   setColor(0x0, 0xFFFFFF, gpu)
  173. end
  174.  
  175. local function on(x, y, gpu)
  176.   setColor(0x00FF00, 0x0000FF, gpu)
  177.   pgpus[gpu].set(x,y,"ON ")
  178.   setColor(0x0, 0xFFFFFF, gpu)
  179. end
  180.  
  181. local function off(x, y, gpu)
  182.   setColor(0xFF8E8E, 0x0, gpu)
  183.   pgpus[gpu].set(x,y,"OFF")
  184.   setColor(0x0, 0xFFFFFF, gpu)
  185. end
  186.  
  187.  
  188. local function mb1(x, y, gpu)
  189.   setColor(0xFFFFFF, 0x0, gpu)
  190.   pgpus[gpu].set(x,y,"  0mb/s")
  191.   setColor(0x0, 0xFFFFFF, gpu)
  192. end
  193.  
  194. local function mb2(x, y, gpu)
  195.   setColor(0x4169e1, 0xFFFFFF, gpu)
  196.   pgpus[gpu].set(x,y," 40mb/s")
  197.   setColor(0x0, 0xFFFFFF, gpu)
  198. end
  199.  
  200. local function mb3(x, y, gpu)
  201.   setColor(0x008080, 0xFFFFFF, gpu)
  202.   pgpus[gpu].set(x,y," 80mb/s")
  203.   setColor(0x0, 0xFFFFFF, gpu)
  204. end
  205.  
  206. local function mb4(x, y, gpu)
  207.   setColor(0x00ffff, 0x0, gpu)
  208.   pgpus[gpu].set(x,y,"120mb/s")
  209.   setColor(0x0, 0xFFFFFF, gpu)
  210. end
  211.  
  212. local function mb5(x, y, gpu)
  213.   setColor(0x2e8b57, 0x0, gpu)
  214.   pgpus[gpu].set(x,y,"160mb/s")
  215.   setColor(0x0, 0xFFFFFF, gpu)
  216. end
  217.  
  218. local function mb6(x, y, gpu)
  219.   setColor(0xadff2f, 0x0, gpu)
  220.   pgpus[gpu].set(x,y,"200mb/s")
  221.   setColor(0x0, 0xFFFFFF, gpu)
  222. end
  223.  
  224. local function mb7(x, y, gpu)
  225.   setColor(0xffff00, 0x0, gpu)
  226.   pgpus[gpu].set(x,y,"240mb/s")
  227.   setColor(0x0, 0xFFFFFF, gpu)
  228. end
  229.  
  230. local function mb8(x, y, gpu)
  231.   setColor(0xd2691e, 0xFFFFFF, gpu)
  232.   pgpus[gpu].set(x,y,"280mb/s")
  233.   setColor(0x0, 0xFFFFFF, gpu)
  234. end
  235.  
  236. local function mb9(x, y, gpu)
  237.   setColor(0xff0000, 0xFFFFFF, gpu)
  238.   pgpus[gpu].set(x,y,"320mb/s")
  239.   setColor(0x0, 0xFFFFFF, gpu)
  240. end
  241.  
  242. local function conso(val, x, y, gpu)
  243.   if val==0 then
  244.   mb1(x, y, gpu)
  245.   elseif val==1 then
  246.   mb2(x, y, gpu)
  247.   elseif val==2 then
  248.   mb3(x, y, gpu)
  249.   elseif val==3 then
  250.   mb4(x, y, gpu)
  251.   elseif val==4 then
  252.   mb5(x, y, gpu)
  253.   elseif val==5 then
  254.   mb6(x, y, gpu)
  255.   elseif val==6 then
  256.   mb7(x, y, gpu)
  257.   elseif val==7 then
  258.   mb8(x, y, gpu)
  259.   elseif val==8 then
  260.   mb9(x, y, gpu)
  261.   end
  262. end
  263.  
  264. local function comgene(x,y,gpu)
  265.   marche_off(x,y,gpu)
  266.   auto_off(x+7,y,gpu)
  267.   arret_off(x+12,y,gpu)
  268. end
  269.  
  270. local function dessin(x,y,gpu)
  271.   off(x,y,gpu)
  272.   marche_off(x+6,y,gpu)
  273.   auto_on(x+13,y,gpu)
  274.   arret_off(x+18,y,gpu)
  275. end
  276.  
  277. local function gdessin(x,y,gpu)
  278.   comgene(x+12,y+1,gpu)
  279.   dessin(x+6,y+3,gpu)
  280.   dessin(x+6,y+4,gpu)
  281.   dessin(x+6,y+5,gpu)
  282.   dessin(x+6,y+6,gpu)
  283.   dessin(x+6,y+7,gpu)
  284.   dessin(x+6,y+8,gpu)
  285.   dessin(x+6,y+9,gpu)
  286.   dessin(x+6,y+10,gpu)
  287. end
  288.  
  289. local plasma_on = {
  290.   {0,0,0,0,0,0,0,0},
  291.   {0,0,0,0,0,0,0,0},
  292.   {0,0,0,0,0,0,0,0},
  293.   {0,0,0,0,0,0,0,0}
  294. }
  295.  
  296. local buttontest = {
  297.   {2,2,2,2,2,2,2,2},
  298.   {2,2,2,2,2,2,2,2},
  299.   {2,2,2,2,2,2,2,2},
  300.   {2,2,2,2,2,2,2,2}
  301. }
  302.  
  303. local palierg = {pg1,pg2,pg3,pg4}
  304.  
  305. local function palierp(fusion,n)
  306.   local amount = idsu.getStored()
  307.   local pg = palier - (delta * (fusion-1))
  308.   local dpp = delta / 8
  309.   local pp = palier - ( dpp * (n-1))
  310.  
  311.   if buttontest[fusion][n] == 1 then
  312.       plasma_on[fusion][n] = 1
  313.  
  314.   elseif buttontest[fusion][n] == 2 then
  315.     if amount<pp then
  316.       plasma_on[fusion][n] = 1
  317.     else
  318.       plasma_on[fusion][n] = 0
  319.     end
  320.  
  321.   elseif buttontest[fusion][n] == 3 then
  322.       plasma_on[fusion][n] = 0
  323.   end
  324. end
  325.  
  326. local function test_marche(x,y,gpu,fusion,n)
  327.   if plasma_on[fusion][n] == 0 then
  328.     fusions[fusion].redstone.setBundledOutput(commande,r_color[n],0)
  329.     off(x,y,gpu)
  330.  
  331.   elseif plasma_on[fusion][n] == 1 then
  332.     fusions[fusion].redstone.setBundledOutput(commande, r_color[n],255)
  333.     on(x,y,gpu)
  334.   end
  335. end
  336.  
  337.  
  338. local function test_marche8(x,y,gpu,fusion)
  339.   test_marche(x,y,gpu,fusion,1)
  340.   test_marche(x,y+1,gpu,fusion,2)
  341.   test_marche(x,y+2,gpu,fusion,3)
  342.   test_marche(x,y+3,gpu,fusion,4)
  343.   test_marche(x,y+4,gpu,fusion,5)
  344.   test_marche(x,y+5,gpu,fusion,6)
  345.   test_marche(x,y+6,gpu,fusion,7)
  346.   test_marche(x,y+7,gpu,fusion,8)
  347. end  
  348.  
  349. local function control(x,y,fusion, gpu)
  350.   local d1 = plasma_on[fusion][1]
  351.   local d2 = plasma_on[fusion][2]
  352.   local d3 = plasma_on[fusion][3]
  353.   local d4 = plasma_on[fusion][4]
  354.   local d5 = plasma_on[fusion][5]
  355.   local d6 = plasma_on[fusion][6]
  356.   local d7 = plasma_on[fusion][7]
  357.   local d8 = plasma_on[fusion][8]
  358.   local d = d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8
  359.   affplasma(x,y+12,30,fusion, gpu)
  360.   conso(d, x+22, y+14, gpu)
  361.     palierp(fusion,1)
  362.     palierp(fusion,2)
  363.     palierp(fusion,3)
  364.     palierp(fusion,4)
  365.     palierp(fusion,5)
  366.     palierp(fusion,6)
  367.     palierp(fusion,7)
  368.     palierp(fusion,8)
  369. end
  370.  
  371. local function button1(x,y,w,z,gpu,address,n,fusion) -- x = gpu x / y = gpu y / w = touch x / z = touch y / n = n° du boutton
  372.   if w>x and w<x+7 and z==y then
  373.     marche_on(x+1,y,gpu)
  374.     auto_off(x+8,y,gpu)
  375.     arret_off(x+13,y,gpu)
  376.     buttontest[fusion][n] = 1
  377.  
  378.   elseif w>x+7 and w<x+12 and z==y then
  379.     marche_off(x+1,y,gpu)
  380.     auto_on(x+8,y,gpu)
  381.     arret_off(x+13,y,gpu)
  382.     buttontest[fusion][n] = 2
  383.  
  384.   elseif w>x+12 and w<x+18 and z==y then
  385.     marche_off(x+1,y,gpu)
  386.     auto_off(x+8,y,gpu)
  387.     arret_on(x+13,y,gpu)
  388.     buttontest[fusion][n] = 3
  389.   end
  390. end
  391.  
  392. local function button8(x,y,w,z,gpu,address,fusion) -- x = gpu x / y = gpu y / w = touch x / z = touch y
  393.   button1(x,y,w,z,gpu,address,1,fusion)
  394.   button1(x,y+1,w,z,gpu,address,2,fusion)
  395.   button1(x,y+2,w,z,gpu,address,3,fusion)
  396.   button1(x,y+3,w,z,gpu,address,4,fusion)
  397.   button1(x,y+4,w,z,gpu,address,5,fusion)
  398.   button1(x,y+5,w,z,gpu,address,6,fusion)
  399.   button1(x,y+6,w,z,gpu,address,7,fusion)
  400.   button1(x,y+7,w,z,gpu,address,8,fusion)
  401. end
  402.  
  403. local function buttongene(x,y,w,z,gpu,address,fusion) -- x = gpu x / y = gpu y / w = touch x / z = touch y
  404.   if w>x and w<x+7 and z==y then
  405.       marche_on(x+1,y+2,gpu)
  406.       marche_on(x+1,y+3,gpu)
  407.       marche_on(x+1,y+4,gpu)
  408.       marche_on(x+1,y+5,gpu)
  409.       marche_on(x+1,y+6,gpu)
  410.       marche_on(x+1,y+7,gpu)
  411.       marche_on(x+1,y+8,gpu)
  412.       marche_on(x+1,y+9,gpu)
  413.       auto_off(x+8,y+2,gpu)
  414.       auto_off(x+8,y+3,gpu)
  415.       auto_off(x+8,y+4,gpu)
  416.       auto_off(x+8,y+5,gpu)
  417.       auto_off(x+8,y+6,gpu)
  418.       auto_off(x+8,y+7,gpu)
  419.       auto_off(x+8,y+8,gpu)
  420.       auto_off(x+8,y+9,gpu)
  421.       arret_off(x+13,y+2,gpu)
  422.       arret_off(x+13,y+3,gpu)
  423.       arret_off(x+13,y+4,gpu)
  424.       arret_off(x+13,y+5,gpu)
  425.       arret_off(x+13,y+6,gpu)
  426.       arret_off(x+13,y+7,gpu)
  427.       arret_off(x+13,y+8,gpu)
  428.       arret_off(x+13,y+9,gpu)
  429.       buttontest[fusion] = {1,1,1,1,1,1,1,1}
  430.  
  431.   elseif w>x+7 and w<x+12 and z==y then
  432.       marche_off(x+1,y+2,gpu)
  433.       marche_off(x+1,y+3,gpu)
  434.       marche_off(x+1,y+4,gpu)
  435.       marche_off(x+1,y+5,gpu)
  436.       marche_off(x+1,y+6,gpu)
  437.       marche_off(x+1,y+7,gpu)
  438.       marche_off(x+1,y+8,gpu)
  439.       marche_off(x+1,y+9,gpu)
  440.       auto_on(x+8,y+2,gpu)
  441.       auto_on(x+8,y+3,gpu)
  442.       auto_on(x+8,y+4,gpu)
  443.       auto_on(x+8,y+5,gpu)
  444.       auto_on(x+8,y+6,gpu)
  445.       auto_on(x+8,y+7,gpu)
  446.       auto_on(x+8,y+8,gpu)
  447.       auto_on(x+8,y+9,gpu)
  448.       arret_off(x+13,y+2,gpu)
  449.       arret_off(x+13,y+3,gpu)
  450.       arret_off(x+13,y+4,gpu)
  451.       arret_off(x+13,y+5,gpu)
  452.       arret_off(x+13,y+6,gpu)
  453.       arret_off(x+13,y+7,gpu)
  454.       arret_off(x+13,y+8,gpu)
  455.       arret_off(x+13,y+9,gpu)
  456.       buttontest[fusion] = {2,2,2,2,2,2,2,2}
  457.  
  458.   elseif w>x+12 and w<x+18 and z==y then
  459.       marche_off(x+1,y+2,gpu)
  460.       marche_off(x+1,y+3,gpu)
  461.       marche_off(x+1,y+4,gpu)
  462.       marche_off(x+1,y+5,gpu)
  463.       marche_off(x+1,y+6,gpu)
  464.       marche_off(x+1,y+7,gpu)
  465.       marche_off(x+1,y+8,gpu)
  466.       marche_off(x+1,y+9,gpu)
  467.       auto_off(x+8,y+2,gpu)
  468.       auto_off(x+8,y+3,gpu)
  469.       auto_off(x+8,y+4,gpu)
  470.       auto_off(x+8,y+5,gpu)
  471.       auto_off(x+8,y+6,gpu)
  472.       auto_off(x+8,y+7,gpu)
  473.       auto_off(x+8,y+8,gpu)
  474.       auto_off(x+8,y+9,gpu)
  475.       arret_on(x+13,y+2,gpu)
  476.       arret_on(x+13,y+3,gpu)
  477.       arret_on(x+13,y+4,gpu)
  478.       arret_on(x+13,y+5,gpu)
  479.       arret_on(x+13,y+6,gpu)
  480.       arret_on(x+13,y+7,gpu)
  481.       arret_on(x+13,y+8,gpu)
  482.       arret_on(x+13,y+9,gpu)
  483.       buttontest[fusion] = {3,3,3,3,3,3,3,3}
  484.   end
  485. end  
  486.  
  487. --                                                                                
  488. --cadre screen 1   ║        ║         ║         ║ ║       ║         ║         ║  ║
  489.  pgpus[1].set(1,1,"╔══════════════════════════════╦══════════════════════════════╗")
  490.  pgpus[1].set(1,2,"║        Groupe plasma 1       ║        Groupe plasma 2       ║")
  491.  pgpus[1].set(1,3,"║   Mode     MARCHE AUTO ARRET ║   Mode     MARCHE AUTO ARRET ║")
  492.  pgpus[1].set(1,4,"╟───┬──────┬───────────────────╫───┬──────┬───────────────────╢")
  493.  pgpus[1].set(1,5,"║ 1 │  ON  │ MARCHE AUTO ARRET ║ 1 │  ON  │ MARCHE AUTO ARRET ║")
  494.  pgpus[1].set(1,6,"║ 2 │  ON  │ MARCHE AUTO ARRET ║ 2 │  ON  │ MARCHE AUTO ARRET ║")
  495.  pgpus[1].set(1,7,"║ 3 │  ON  │ MARCHE AUTO ARRET ║ 3 │  ON  │ MARCHE AUTO ARRET ║")
  496.  pgpus[1].set(1,8,"║ 4 │  ON  │ MARCHE AUTO ARRET ║ 4 │  ON  │ MARCHE AUTO ARRET ║")
  497.  pgpus[1].set(1,9,"║ 5 │  ON  │ MARCHE AUTO ARRET ║ 5 │  ON  │ MARCHE AUTO ARRET ║")
  498. pgpus[1].set(1,10,"║ 6 │  ON  │ MARCHE AUTO ARRET ║ 6 │  ON  │ MARCHE AUTO ARRET ║")
  499. pgpus[1].set(1,11,"║ 7 │  ON  │ MARCHE AUTO ARRET ║ 7 │  ON  │ MARCHE AUTO ARRET ║")
  500. pgpus[1].set(1,12,"║ 8 │  ON  │ MARCHE AUTO ARRET ║ 8 │  ON  │ MARCHE AUTO ARRET ║")
  501. pgpus[1].set(1,13,"╟───┴──────┴───────────────────╫───┴──────┴───────────────────╢")
  502. pgpus[1].set(1,14,"║ val     Plasma       100.00% ║ val     Plasma       100.00% ║")
  503. pgpus[1].set(1,15,"╟──────────────────────────────╫──────────────────────────────╢")
  504. pgpus[1].set(1,16,"║   Consommation         0mB/s ║   Consommation         0mB/s ║")
  505. pgpus[1].set(1,17,"╠══════════════════════════════╩══════════════════════════════╣")
  506. pgpus[1].set(1,18,"║          CONTROLE GENERAL DES GENERATEURS A PLASMA          ║")
  507. pgpus[1].set(1,19,"╠══════════════════════════════╦══════════════════════════════╣")
  508. pgpus[1].set(1,20,"║        Groupe plasma 3       ║        Groupe plasma 4       ║")
  509. pgpus[1].set(1,21,"║   Mode     MARCHE AUTO ARRET ║   Mode     MARCHE AUTO ARRET ║")
  510. pgpus[1].set(1,22,"╟───┬──────┬───────────────────╫───┬──────┬───────────────────╢")
  511. pgpus[1].set(1,23,"║ 1 │  ON  │ MARCHE AUTO ARRET ║ 1 │  ON  │ MARCHE AUTO ARRET ║")
  512. pgpus[1].set(1,24,"║ 2 │  ON  │ MARCHE AUTO ARRET ║ 2 │  ON  │ MARCHE AUTO ARRET ║")
  513. pgpus[1].set(1,25,"║ 3 │  ON  │ MARCHE AUTO ARRET ║ 3 │  ON  │ MARCHE AUTO ARRET ║")
  514. pgpus[1].set(1,26,"║ 4 │  ON  │ MARCHE AUTO ARRET ║ 4 │  ON  │ MARCHE AUTO ARRET ║")
  515. pgpus[1].set(1,27,"║ 5 │  ON  │ MARCHE AUTO ARRET ║ 5 │  ON  │ MARCHE AUTO ARRET ║")
  516. pgpus[1].set(1,28,"║ 6 │  ON  │ MARCHE AUTO ARRET ║ 6 │  ON  │ MARCHE AUTO ARRET ║")
  517. pgpus[1].set(1,29,"║ 7 │  ON  │ MARCHE AUTO ARRET ║ 7 │  ON  │ MARCHE AUTO ARRET ║")
  518. pgpus[1].set(1,30,"║ 8 │  ON  │ MARCHE AUTO ARRET ║ 8 │  ON  │ MARCHE AUTO ARRET ║")
  519. pgpus[1].set(1,31,"╟───┴──────┴───────────────────╫───┴──────┴───────────────────╢")
  520. pgpus[1].set(1,32,"║ val     Plasma       100.00% ║ val     Plasma       100.00% ║")
  521. pgpus[1].set(1,33,"╟──────────────────────────────╫──────────────────────────────╢")
  522. pgpus[1].set(1,34,"║   Consommation         0mB/s ║   Consommation         0mB/s ║")
  523. pgpus[1].set(1,35,"╚══════════════════════════════╩══════════════════════════════╝")
  524.  
  525. gdessin(2,2,1)
  526. gdessin(33,2,1)
  527. gdessin(2,20,1)
  528. gdessin(33,20,1)
  529.  
  530. --cadre screen 2
  531.  pgpus[2].set(1,1,"╔═══════════════════════════════════════════╗")
  532.  pgpus[2].set(1,2,"║         ETAT DU RESEAU ELECTRIQUE         ║")
  533.  pgpus[2].set(1,3,"╠═══════════════════════════════════════════╣")
  534.  pgpus[2].set(1,4,"║                                           ║")
  535.  pgpus[2].set(1,5,"║                                           ║")
  536.  pgpus[2].set(1,6,"║                                           ║")
  537.  pgpus[2].set(1,7,"╟───────────────────────────────────────────╢")
  538.  pgpus[2].set(1,8,"║              Charge de l'IDSU             ║")
  539.  pgpus[2].set(1,9,"╠═══════════════════════════════════════════╣")
  540. pgpus[2].set(1,10,"║                                           ║")
  541. pgpus[2].set(1,11,"║                                           ║")
  542. pgpus[2].set(1,12,"║                                           ║")
  543. pgpus[2].set(1,13,"║                                           ║")
  544. pgpus[2].set(1,14,"║                                           ║")
  545. pgpus[2].set(1,15,"║                                           ║")
  546. pgpus[2].set(1,16,"║                                           ║")
  547. pgpus[2].set(1,17,"║                                           ║")
  548. pgpus[2].set(1,18,"║                                           ║")
  549. pgpus[2].set(1,19,"║                                           ║")
  550. pgpus[2].set(1,20,"╟───────────────────────────────────────────╢")
  551. pgpus[2].set(1,21,"║              Charge des AESU              ║")
  552. pgpus[2].set(1,22,"╟───────────────────────────────────────────╢")
  553. pgpus[2].set(1,23,"║ Charge Batteries    CONNEXION DECONNEXION ║")
  554. pgpus[2].set(1,24,"║ Décharge Batteries  CONNEXION DECONNEXION ║")
  555. pgpus[2].set(1,25,"╚═══════════════════════════════════════════╝")
  556.  
  557. --cadre screen 3
  558.  pgpus[3].set(1,1,"╔═══════════════════════════════════════════╗")
  559.  pgpus[3].set(1,2,"║                                           ║")
  560.  pgpus[3].set(1,3,"║                                           ║")
  561.  pgpus[3].set(1,4,"║                                           ║")
  562.  pgpus[3].set(1,5,"║                                           ║")
  563.  pgpus[3].set(1,6,"║                                           ║")
  564.  pgpus[3].set(1,7,"║                                           ║")
  565.  pgpus[3].set(1,8,"║                                           ║")
  566.  pgpus[3].set(1,9,"║                                           ║")
  567. pgpus[3].set(1,10,"║                                           ║")
  568. pgpus[3].set(1,11,"║                                           ║")
  569. pgpus[3].set(1,12,"║                                           ║")
  570. pgpus[3].set(1,13,"║                                           ║")
  571. pgpus[3].set(1,14,"║                                           ║")
  572. pgpus[3].set(1,15,"║                                           ║")
  573. pgpus[3].set(1,16,"║                                           ║")
  574. pgpus[3].set(1,17,"║                                           ║")
  575. pgpus[3].set(1,18,"║                                           ║")
  576. pgpus[3].set(1,19,"║                                           ║")
  577. pgpus[3].set(1,20,"║                                           ║")
  578. pgpus[3].set(1,21,"║                                           ║")
  579. pgpus[3].set(1,22,"║                                           ║")
  580. pgpus[3].set(1,23,"║                                           ║")
  581. pgpus[3].set(1,24,"║                                           ║")
  582. pgpus[3].set(1,25,"╚═══════════════════════════════════════════╝")
  583.  
  584. local function controlg()
  585.   control(2,2,1,1)
  586.   control(33,2,2,1)
  587.   control(2,20,3,1)
  588.   control(33,20,4,1)
  589.   test_marche8(8,5,1,1)
  590.   test_marche8(39,5,1,2)
  591.   test_marche8(8,23,1,3)
  592.   test_marche8(39,23,1,4)
  593. end
  594.  
  595. local function drawbars()
  596.   controlg()
  597.   affidsu(2,4,43,2)
  598. end
  599.  
  600. local function onTouch(_,address,x,y)
  601.   if address==screen1 then
  602.     if x~=1 and y~=1 then
  603.       if x>13 and x<31 and y>4 and y<13 then
  604.         button8(13,5,x,y,1,address,1)
  605.  
  606.       elseif x>44 and x<62 and y>22 and y<31 then
  607.         button8(44,5,x,y,1,address,1)
  608.  
  609.       elseif x>13 and x<31 and y>4 and y<13 then
  610.         button8(13,23,x,y,1,address,1)
  611.  
  612.       elseif x>44 and x<62 and y>22 and y<31 then
  613.         button8(44,23,x,y,1,address,1)
  614.  
  615.       elseif x>13 and x<31 and y==3 then
  616.         buttongene(13,3,x,y,1,address,1)
  617.  
  618.       elseif x>44 and x<62 and y==3 then
  619.         buttongene(44,3,x,y,1,address,2)
  620.  
  621.       elseif x>13 and x<31 and y==21 then
  622.         buttongene(13,21,x,y,1,address,3)
  623.  
  624.       elseif x>44 and x<62 and y==21 then
  625.         buttongene(44,21,x,y,1,address,4)
  626.       end
  627.  
  628.     elseif x==1 and y==1 then
  629.       computer.pushSignal("quit")
  630.       pgpus[3].fill(1,1,45,25," ")
  631.       pgpus[2].fill(1,1,45,25," ")
  632.       pgpus[1].fill(1,1,63,35," ")
  633.       term.setCursor(1,1)
  634.       return false
  635.     end
  636.   end
  637. end
  638.  
  639. local function onTimer(_,timer)
  640.   drawbars()
  641.   return true
  642. end
  643.  
  644. event.listen("touch",onTouch)
  645. local timer = event.timer(1,onTimer,math.huge)
  646. event.pull("quit")
  647. event.cancel(timer)
  648. event.ignore("touch",onTouch)
  649. pgpus[3].fill(1,1,45,25," ")
  650. pgpus[2].fill(1,1,45,25," ")
  651. pgpus[1].fill(1,1,63,35," ")
  652. pgpus[1].bind(screen1)
  653. pgpus[1].setResolution(120,50)
  654.  
  655. --crée par sshikamaru // Citez moi ainsi que le serveur Sphère-ville si vous utilisez ou modifiez ce code.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement