Advertisement
sshikamaru

OC - API Diesel

May 16th, 2014
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.02 KB | None | 0 0
  1. --Require
  2. local term = require("term")
  3. local computer = require("computer")
  4. local component = require("component")
  5. local event = require ("event")
  6. local colors = require("colors")
  7. local sides = require("sides")
  8.  
  9. --Component
  10. local gpu = component.gpu
  11. local screen = component.screen.adress
  12. local rs = component.redstone
  13.  
  14. --Résolution
  15. local maxX, maxY = component.gpu.maxResolution()
  16. if maxX >= 67 and maxY >= 37 then
  17.   component.gpu.setResolution(67,37)
  18.   end
  19.  
  20. local nbdiesel1
  21. local nbdiesel2
  22. local d1
  23. local d2
  24. local d3
  25. local d4
  26. local d5
  27. local d6
  28. local d7
  29. local d8
  30.  
  31. local s_commande = sides.top
  32. local retour_info = sides.south
  33.  
  34. --Fonctions de couleurs
  35.  
  36. local function setColor(bg,fg)
  37.   gpu.setBackground(bg)
  38.   gpu.setForeground(fg)
  39. end
  40.  
  41. --Fonctions texte variable
  42.  
  43. local function marche_on(x, y)
  44.   setColor(0x00FF00, 0x0)
  45.   gpu.set(x,y,"MARCHE")
  46.   setColor(0x0, 0xFFFFFF)
  47. end
  48.  
  49. local function marche_off(x, y)
  50.   setColor(0x0, 0x00FF00)
  51.   gpu.set(x,y,"MARCHE")
  52.   setColor(0x0, 0xFFFFFF)
  53. end
  54.  
  55. local function auto_on(x, y)
  56.   setColor(0xFFFA000, 0x0)
  57.   gpu.set(x,y,"AUTO")
  58.   setColor(0x0, 0xFFFFFF)
  59. end
  60.  
  61. local function auto_off(x, y)
  62.   setColor(0x0, 0xFFFA000)
  63.   gpu.set(x,y,"AUTO")
  64.   setColor(0x0, 0xFFFFFF)
  65. end
  66.  
  67. local function arret_on(x, y)
  68.   setColor(0xFF0000, 0xFFFFFF)
  69.   gpu.set(x,y,"ARRET")
  70.   setColor(0x0, 0xFF0000)
  71. end
  72.  
  73. local function arret_off(x, y)
  74.   setColor(0x0, 0xFF0000)
  75.   gpu.set(x,y,"ARRET")
  76.   setColor(0x0, 0xFFFFFF)
  77. end
  78.  
  79. local function on(x, y)
  80.   setColor(0x00FF00, 0x0000FF)
  81.   gpu.set(x,y,"ON ")
  82.   setColor(0x0, 0xFFFFFF)
  83. end
  84.  
  85. local function off(x, y)
  86.   setColor(0xFF8E8E, 0x0)
  87.   gpu.set(x,y,"OFF")
  88.   setColor(0x0, 0xFFFFFF)
  89. end
  90.  
  91. local function connexion_on(x, y)
  92.   setColor(0x0000FF, 0x0)
  93.   gpu.set(x,y,"CONNEXION")
  94.   setColor(0x0, 0xFFFFFF)
  95. end
  96.  
  97. local function connexion_off(x, y)
  98.   setColor(0x0, 0x0000FF)
  99.   gpu.set(x,y,"CONNEXION")
  100.   setColor(0x0, 0xFFFFFF)
  101. end
  102.  
  103. local function deconnexion_on(x, y)
  104.   setColor(0xADD8FF, 0x0)
  105.   gpu.set(x,y,"DECONNEXION")
  106.   setColor(0x0, 0xFFFFFF)
  107. end
  108.  
  109. local function deconnexion_off(x, y)
  110.   setColor(0x0, 0xADD8FF)
  111.   gpu.set(x,y,"DECONNEXION")
  112.   setColor(0x0, 0xFFFFFF)
  113. end
  114.  
  115. local function mb1(x, y)
  116.   setColor(0xFFFFFF, 0x0)
  117.   gpu.set(x,y,"   0mb/s")
  118.   setColor(0x0, 0xFFFFFF)
  119. end
  120.  
  121. local function mb2(x, y)
  122.   setColor(0x00FF00, 0x0)
  123.   gpu.set(x,y," 320mb/s")
  124.   setColor(0x0, 0xFFFFFF)
  125. end
  126.  
  127. local function mb3(x, y)
  128.   setColor(0xFFFF00, 0x0)
  129.   gpu.set(x,y," 640mb/s")
  130.   setColor(0x0, 0xFFFFFF)
  131. end
  132.  
  133. local function mb4(x, y)
  134.   setColor(0xFFA000, 0x0)
  135.   gpu.set(x,y," 960mb/s")
  136.   setColor(0x0, 0xFFFFFF)
  137. end
  138.  
  139. local function mb5(x, y)
  140.   setColor(0xFF0000, 0xFFFFFF)
  141.   gpu.set(x,y,"1280mb/s")
  142.   setColor(0x0, 0xFFFFFF)
  143. end
  144.  
  145. local function conso(val, x, y)
  146.   if val==0 then
  147.   mb1(x, y)
  148.   elseif val==1 then
  149.   mb2(x, y)
  150.   elseif val==2 then
  151.   mb3(x, y)
  152.   elseif val==3 then
  153.   mb4(x, y)
  154.   elseif val==4 then
  155.   mb5(x, y)
  156.   end
  157. end
  158. --cadre
  159. term.clear()
  160.  
  161.  
  162.  gpu.set(1,1,"╔═════════════════════════════════════════════════════════════════╗")
  163.  gpu.set(1,2,"║           ║            ║            ║            ║              ║")
  164.  gpu.set(1,3,"║───────────║────────────║────────────║────────────║              ║")
  165.  gpu.set(1,4,"║           ║            ║            ║            ║              ║")
  166.  gpu.set(1,5,"║           ║            ║            ║            ║              ║")
  167.  gpu.set(1,6,"║           ║            ║            ║            ║              ║")
  168.  gpu.set(1,7,"║           ║            ║            ║            ║              ║")
  169.  gpu.set(1,8,"║           ║            ║            ║            ║              ║")
  170.  gpu.set(1,9,"║───────────║────────────║────────────║────────────║──────────────║")
  171. gpu.set(1,10,"║           ║            ║            ║            ║              ║")
  172. gpu.set(1,11,"║           ║            ║            ║            ║              ║")
  173. gpu.set(1,12,"║           ║            ║            ║            ║              ║")
  174. gpu.set(1,13,"║           ║            ║            ║            ║              ║")
  175. gpu.set(1,14,"║           ║            ║            ║            ║              ║")
  176. gpu.set(1,15,"║─────────────────────────────────────────────────────────────────║")
  177. gpu.set(1,16,"║                                                  ║              ║")
  178. gpu.set(1,17,"║                                                  ║              ║")
  179. gpu.set(1,18,"║                                                  ║              ║")
  180. gpu.set(1,19,"║═════════════════════════════════════════════════════════════════║")
  181. gpu.set(1,20,"║           ║            ║            ║            ║              ║")
  182. gpu.set(1,21,"║───────────║────────────║────────────║────────────║              ║")
  183. gpu.set(1,22,"║           ║            ║            ║            ║              ║")
  184. gpu.set(1,23,"║           ║            ║            ║            ║              ║")
  185. gpu.set(1,24,"║           ║            ║            ║            ║              ║")
  186. gpu.set(1,25,"║           ║            ║            ║            ║              ║")
  187. gpu.set(1,26,"║           ║            ║            ║            ║              ║")
  188. gpu.set(1,27,"║───────────║────────────║────────────║────────────║──────────────║")
  189. gpu.set(1,28,"║           ║            ║            ║            ║              ║")
  190. gpu.set(1,29,"║           ║            ║            ║            ║              ║")
  191. gpu.set(1,30,"║           ║            ║            ║            ║              ║")
  192. gpu.set(1,31,"║           ║            ║            ║            ║              ║")
  193. gpu.set(1,32,"║           ║            ║            ║            ║              ║")
  194. gpu.set(1,33,"║─────────────────────────────────────────────────────────────────║")
  195. gpu.set(1,34,"║                                                  ║              ║")
  196. gpu.set(1,35,"║                                                  ║              ║")
  197. gpu.set(1,36,"║                                                  ║              ║")
  198. gpu.set(1,37,"╚═════════════════════════════════════════════════════════════════╝")
  199.  
  200. --textes
  201. --groupe 1
  202. --
  203. gpu.set(3,2,"DIESEL 1")
  204. gpu.set(16,2,"DIESEL 2")
  205. gpu.set(29,2,"DIESEL 3")
  206. gpu.set(42,2,"DIESEL 4")
  207. --
  208. gpu.set(5,5,"ETAT")
  209. gpu.set(18,5,"ETAT")
  210. gpu.set(31,5,"ETAT")
  211. gpu.set(44,5,"ETAT")
  212. --
  213. gpu.set(57,3,"GROUPE")
  214. gpu.set(56,4,"DIESEL 1")
  215. gpu.set(56,6,"COMMANDE")
  216. gpu.set(56,7,"GENERALE")
  217. --
  218. off(6,7)
  219. off(19,7)
  220. off(32,7)
  221. off(45,7)
  222. --
  223. marche_off(4,10)
  224. marche_off(17,10)
  225. marche_off(30,10)
  226. marche_off(43,10)
  227. marche_off(57,10)
  228. --
  229. auto_on(5,12)
  230. auto_on(18,12)
  231. auto_on(31,12)
  232. auto_on(44,12)
  233. auto_off(58,12)
  234. --
  235. arret_off(5,14)
  236. arret_off(18,14)
  237. arret_off(31,14)
  238. arret_off(44,14)
  239. arret_off(58,14)
  240. --
  241. gpu.set(4,17,"GROUPE DIESEL 1")
  242. connexion_on(23,17)
  243. deconnexion_off(36,17)
  244. --
  245. gpu.set(54,16,"CONSOMMATION")
  246. mb1(57,17)
  247. --
  248. --groupe 2
  249. --
  250. gpu.set(3,20,"DIESEL 5")
  251. gpu.set(16,20,"DIESEL 6")
  252. gpu.set(29,20,"DIESEL 7")
  253. gpu.set(42,20,"DIESEL 8")
  254. --
  255. gpu.set(5,23,"ETAT")
  256. gpu.set(18,23,"ETAT")
  257. gpu.set(31,23,"ETAT")
  258. gpu.set(44,23,"ETAT")
  259. --
  260. gpu.set(57,21,"GROUPE")
  261. gpu.set(56,22,"DIESEL 2")
  262. gpu.set(56,24,"COMMANDE")
  263. gpu.set(56,25,"GENERALE")
  264. --
  265. off(6,25)
  266. off(19,25)
  267. off(32,25)
  268. off(45,25)
  269. --
  270. marche_off(4,28)
  271. marche_off(17,28)
  272. marche_off(30,28)
  273. marche_off(43,28)
  274. marche_off(57,28)
  275. --
  276. auto_on(5,30)
  277. auto_on(18,30)
  278. auto_on(31,30)
  279. auto_on(44,30)
  280. auto_off(58,30)
  281. --
  282. arret_off(5,32)
  283. arret_off(18,32)
  284. arret_off(31,32)
  285. arret_off(44,32)
  286. arret_off(58,32)
  287. --
  288. gpu.set(4,35,"GROUPE DIESEL 2")
  289. connexion_on(23,35)
  290. deconnexion_off(36,35)
  291. --
  292. gpu.set(54,34,"CONSOMMATION")
  293. mb1(57,35)
  294. --
  295.  
  296. --initialisation des sorties redstone
  297. rs.setBundledOutput(s_commande,colors.cyan,0)
  298. rs.setBundledOutput(s_commande,colors.silver,0)
  299. rs.setBundledOutput(s_commande,colors.blue,0)
  300. rs.setBundledOutput(s_commande,colors.purple,0)  
  301. rs.setBundledOutput(s_commande,colors.green,0)
  302. rs.setBundledOutput(s_commande,colors.brown,0)
  303. rs.setBundledOutput(s_commande,colors.black,0)
  304. rs.setBundledOutput(s_commande,colors.red,0)
  305. rs.setBundledOutput(retour_info,colors.blue,0)
  306. rs.setBundledOutput(s_commande,colors.gray,0)
  307. rs.setBundledOutput(s_commande,colors.pink,0)
  308. rs.setBundledOutput(s_commande,colors.lime,0)
  309. rs.setBundledOutput(s_commande,colors.yellow,0)
  310. rs.setBundledOutput(s_commande,colors.lightblue,0)
  311. rs.setBundledOutput(s_commande,colors.magenta,0)
  312. rs.setBundledOutput(s_commande,colors.orange,0)
  313. rs.setBundledOutput(s_commande,colors.white,0)
  314. rs.setBundledOutput(retour_info,colors.green,0)
  315.  
  316. local function onRedstone(_, address, side)
  317.  
  318.   local input = rs.getBundledInput(side, colors.white)
  319.   --print(input)
  320.  
  321.   local diesel1 = rs.getBundledInput(retour_info, colors.white)
  322.   local diesel2 = rs.getBundledInput(retour_info, colors.silver)
  323.   local diesel3 = rs.getBundledInput(retour_info, colors.gray)
  324.   local diesel4 = rs.getBundledInput(retour_info, colors.black)
  325.   local diesel5 = rs.getBundledInput(retour_info, colors.pink)
  326.   local diesel6 = rs.getBundledInput(retour_info, colors.red)
  327.   local diesel7 = rs.getBundledInput(retour_info, colors.orange)
  328.   local diesel8 = rs.getBundledInput(retour_info, colors.yellow)
  329.  
  330.   if diesel1==0 then
  331.     off(6,7)
  332.     d1 = 0
  333.   else
  334.     on(6,7)
  335.     d1 = 1
  336.   end
  337.  
  338.   if diesel2==0 then
  339.     off(19,7)
  340.     d2 = 0
  341.   else
  342.     on(19,7)
  343.     d2 = 1
  344.   end
  345.  
  346.   if diesel3==0 then
  347.     off(32,7)
  348.     d3 = 0
  349.   else
  350.     on(32,7)
  351.     d3 = 1
  352.   end
  353.  
  354.   if diesel4==0 then
  355.     off(45,7)
  356.     d4 = 0
  357.   else
  358.     on(45,7)
  359.     d4 = 1
  360.   end
  361.  
  362.   if diesel5==0 then
  363.     off(6,25)
  364.     d5 = 0
  365.   else
  366.     on(6,25)
  367.     d5 = 1
  368.   end
  369.  
  370.   if diesel6==0 then
  371.     off(19,25)
  372.     d6 = 0
  373.   else
  374.     on(19,25)
  375.     d6 = 1
  376.   end
  377.  
  378.   if diesel7==0 then
  379.     off(32,25)
  380.     d7 = 0
  381.   else
  382.     on(32,25)
  383.     d7 = 1
  384.   end
  385.  
  386.   if diesel8==0 then
  387.     off(45,25)
  388.     d8 = 0
  389.   else
  390.     on(45,25)
  391.     d8 = 1
  392.   end
  393.  
  394.   --print(d1.." / "..d2.." / "..d3.." / "..d4.." / "..d5.." / "..d6.." / "..d7.." / "..d8)
  395.  
  396.   nbdiesel1 = d1 + d2 + d3 + d4
  397.   nbdiesel2 = d5 + d6 + d7 + d8
  398.   conso(nbdiesel1, 57, 17)
  399.   conso(nbdiesel2, 57, 35)
  400.   --print("val_1 : "..nbdiesel1)
  401.   --print("val_2 : "..nbdiesel2)
  402.  
  403. end
  404.  
  405. local function onTouch(_, _, x, y)
  406.  
  407. --  local _, _, x, y = event.pull("touch", _, _, _, _)
  408.  
  409.   if x>3 and x<10 and y==10 then
  410.     rs.setBundledOutput(s_commande,colors.cyan,255)
  411.     rs.setBundledOutput(s_commande,colors.silver,0)
  412.     marche_on(4, 10)
  413.     auto_off(5, 12)
  414.     arret_off(5, 14)
  415.  
  416.   elseif x>16 and x<23 and y==10 then
  417.     rs.setBundledOutput(s_commande,colors.blue,255)
  418.     rs.setBundledOutput(s_commande,colors.purple,0)
  419.     marche_on(17, 10)
  420.     auto_off(18, 12)
  421.     arret_off(18, 14)
  422.  
  423.   elseif x>29 and x<36 and y==10 then
  424.     rs.setBundledOutput(s_commande,colors.green,255)
  425.     rs.setBundledOutput(s_commande,colors.brown,0)
  426.     marche_on(30, 10)
  427.     auto_off(31, 12)
  428.     arret_off(31, 14)
  429.  
  430.   elseif x>42 and x<49 and y==10 then
  431.     rs.setBundledOutput(s_commande,colors.black,255)
  432.     rs.setBundledOutput(s_commande,colors.red,0)
  433.     marche_on(43, 10)
  434.     auto_off(44, 12)
  435.     arret_off(44, 14)
  436.  
  437.   elseif x>56 and x<63 and y==10 then
  438.     rs.setBundledOutput(s_commande,colors.cyan,255)
  439.     rs.setBundledOutput(s_commande,colors.silver,0)
  440.     marche_on(4, 10)
  441.     auto_off(5, 12)
  442.     arret_off(5, 14)
  443.     rs.setBundledOutput(s_commande,colors.blue,255)
  444.     rs.setBundledOutput(s_commande,colors.purple,0)
  445.     marche_on(17, 10)
  446.     auto_off(18, 12)
  447.     arret_off(18, 14)
  448.     rs.setBundledOutput(s_commande,colors.green,255)
  449.     rs.setBundledOutput(s_commande,colors.brown,0)
  450.     marche_on(30, 10)
  451.     auto_off(31, 12)
  452.     arret_off(31, 14)
  453.     rs.setBundledOutput(s_commande,colors.black,255)
  454.     rs.setBundledOutput(s_commande,colors.red,0)
  455.     marche_on(43, 10)
  456.     auto_off(44, 12)
  457.     arret_off(44, 14)
  458.  
  459.   elseif x>4 and x<9 and y==12 then
  460.     rs.setBundledOutput(s_commande,colors.cyan,0)
  461.     rs.setBundledOutput(s_commande,colors.silver,0)  
  462.     marche_off(4, 10)
  463.     auto_on(5, 12)
  464.     arret_off(5, 14)
  465.  
  466.   elseif x>17 and x<22 and y==12 then
  467.     rs.setBundledOutput(s_commande,colors.blue,0)
  468.     rs.setBundledOutput(s_commande,colors.purple,0)  
  469.     marche_off(17, 10)
  470.     auto_on(18, 12)
  471.     arret_off(18, 14)
  472.  
  473.   elseif x>30 and x<35 and y==12 then
  474.     rs.setBundledOutput(s_commande,colors.green,0)
  475.     rs.setBundledOutput(s_commande,colors.brown,0)
  476.     marche_off(30, 10)
  477.     auto_on(31, 12)
  478.     arret_off(31, 14)
  479.  
  480.   elseif x>43 and x<48 and y==12 then
  481.     rs.setBundledOutput(s_commande,colors.black,0)
  482.     rs.setBundledOutput(s_commande,colors.red,0)
  483.     marche_off(43, 10)
  484.     auto_on(44, 12)
  485.     arret_off(44, 14)
  486.  
  487.   elseif x>57 and x<62 and y==12 then
  488.     rs.setBundledOutput(s_commande,colors.cyan,0)
  489.     rs.setBundledOutput(s_commande,colors.silver,0)  
  490.     marche_off(4, 10)
  491.     auto_on(5, 12)
  492.     arret_off(5, 14)
  493.     rs.setBundledOutput(s_commande,colors.blue,0)
  494.     rs.setBundledOutput(s_commande,colors.purple,0)  
  495.     marche_off(17, 10)
  496.     auto_on(18, 12)
  497.     arret_off(18, 14)
  498.     rs.setBundledOutput(s_commande,colors.green,0)
  499.     rs.setBundledOutput(s_commande,colors.brown,0)
  500.     marche_off(30, 10)
  501.     auto_on(31, 12)
  502.     arret_off(31, 14)
  503.     rs.setBundledOutput(s_commande,colors.black,0)
  504.     rs.setBundledOutput(s_commande,colors.red,0)
  505.     marche_off(43, 10)
  506.     auto_on(44, 12)
  507.     arret_off(44, 14)  
  508.  
  509.   elseif x>4 and x<10 and y==14 then
  510.     rs.setBundledOutput(s_commande,colors.cyan,0)
  511.     rs.setBundledOutput(s_commande,colors.silver,255)
  512.     marche_off(4, 10)
  513.     auto_off(5, 12)
  514.     arret_on(5, 14)
  515.  
  516.   elseif x>17 and x<23 and y==14 then
  517.     rs.setBundledOutput(s_commande,colors.blue,0)
  518.     rs.setBundledOutput(s_commande,colors.purple,255)  
  519.     marche_off(17, 10)
  520.     auto_off(18, 12)
  521.     arret_on(18, 14)
  522.  
  523.   elseif x>30 and x<36 and y==14 then
  524.     rs.setBundledOutput(s_commande,colors.green,0)
  525.     rs.setBundledOutput(s_commande,colors.brown,255)
  526.     marche_off(30, 10)
  527.     auto_off(31, 12)
  528.     arret_on(31, 14)
  529.  
  530.   elseif x>43 and x<49 and y==14 then
  531.     rs.setBundledOutput(s_commande,colors.black,0)
  532.     rs.setBundledOutput(s_commande,colors.red,255)
  533.     marche_off(43, 10)
  534.     auto_off(44, 12)
  535.     arret_on(44, 14)
  536.  
  537.   elseif x>57 and x<63 and y==14 then
  538.     rs.setBundledOutput(s_commande,colors.cyan,0)
  539.     rs.setBundledOutput(s_commande,colors.silver,255)
  540.     marche_off(4, 10)
  541.     auto_off(5, 12)
  542.     arret_on(5, 14)
  543.     rs.setBundledOutput(s_commande,colors.blue,0)
  544.     rs.setBundledOutput(s_commande,colors.purple,255)  
  545.     marche_off(17, 10)
  546.     auto_off(18, 12)
  547.     arret_on(18, 14)
  548.     rs.setBundledOutput(s_commande,colors.green,0)
  549.     rs.setBundledOutput(s_commande,colors.brown,255)
  550.     marche_off(30, 10)
  551.     auto_off(31, 12)
  552.     arret_on(31, 14)
  553.     rs.setBundledOutput(s_commande,colors.black,0)
  554.     rs.setBundledOutput(s_commande,colors.red,255)
  555.     marche_off(43, 10)
  556.     auto_off(44, 12)
  557.     arret_on(44, 14)  
  558.    
  559.   elseif x>22 and x<32 and y==17 then  
  560.     rs.setBundledOutput(retour_info,colors.blue,0)
  561.     connexion_on(23,17)
  562.     deconnexion_off(36,17)
  563.  
  564.   elseif x>35 and x<47 and y==17 then    
  565.     rs.setBundledOutput(retour_info,colors.blue,255)
  566.     connexion_off(23,17)
  567.     deconnexion_oon(36,17)
  568.    
  569.   elseif x>3 and x<10 and y==28 then
  570.     rs.setBundledOutput(s_commande,colors.gray,255)
  571.     rs.setBundledOutput(s_commande,colors.pink,0)
  572.     marche_on(4, 28)
  573.     auto_off(5, 30)
  574.     arret_off(5, 32)
  575.  
  576.   elseif x>16 and x<23 and y==28 then
  577.     rs.setBundledOutput(s_commande,colors.lime,255)
  578.     rs.setBundledOutput(s_commande,colors.yellow,0)
  579.     marche_on(17, 28)
  580.     auto_off(18, 30)
  581.     arret_off(18, 32)
  582.  
  583.   elseif x>29 and x<36 and y==28 then
  584.     rs.setBundledOutput(s_commande,colors.lightblue,255)
  585.     rs.setBundledOutput(s_commande,colors.magenta,0)
  586.     marche_on(30, 28)
  587.     auto_off(31, 30)
  588.     arret_off(31, 32)
  589.  
  590.   elseif x>42 and x<49 and y==28 then
  591.     rs.setBundledOutput(s_commande,colors.orange,255)
  592.     rs.setBundledOutput(s_commande,colors.white,0)
  593.     marche_on(43, 28)
  594.     auto_off(44, 30)
  595.     arret_off(44, 32)
  596.  
  597.   elseif x>56 and x<63 and y==28 then
  598.     rs.setBundledOutput(s_commande,colors.gray,255)
  599.     rs.setBundledOutput(s_commande,colors.pink,0)
  600.     marche_on(4, 28)
  601.     auto_off(5, 30)
  602.     arret_off(5, 32)
  603.     rs.setBundledOutput(s_commande,colors.lime,255)
  604.     rs.setBundledOutput(s_commande,colors.yellow,0)
  605.     marche_on(17, 28)
  606.     auto_off(18, 30)
  607.     arret_off(18, 32)
  608.     rs.setBundledOutput(s_commande,colors.lightblue,255)
  609.     rs.setBundledOutput(s_commande,colors.magenta,0)
  610.     marche_on(30, 28)
  611.     auto_off(31, 30)
  612.     arret_off(31, 32)
  613.     rs.setBundledOutput(s_commande,colors.orange,255)
  614.     rs.setBundledOutput(s_commande,colors.white,0)
  615.     marche_on(43, 28)
  616.     auto_off(44, 30)
  617.     arret_off(44, 32)  
  618.    
  619.   elseif x>4 and x<9 and y==30 then
  620.     rs.setBundledOutput(s_commande,colors.gray,0)
  621.     rs.setBundledOutput(s_commande,colors.pink,0)
  622.     marche_off(4, 28)
  623.     auto_on(5, 30)
  624.     arret_off(5, 32)
  625.  
  626.   elseif x>17 and x<22 and y==30 then
  627.     rs.setBundledOutput(s_commande,colors.lime,0)
  628.     rs.setBundledOutput(s_commande,colors.yellow,0)
  629.     marche_off(17, 28)
  630.     auto_on(18, 30)
  631.     arret_off(18, 32)
  632.  
  633.   elseif x>30 and x<35 and y==30 then
  634.     rs.setBundledOutput(s_commande,colors.lightblue,0)
  635.     rs.setBundledOutput(s_commande,colors.magenta,0)
  636.     marche_off(30, 28)
  637.     auto_on(31, 30)
  638.     arret_off(31, 32)
  639.  
  640.   elseif x>43 and x<48 and y==30 then
  641.     rs.setBundledOutput(s_commande,colors.orange,0)
  642.     rs.setBundledOutput(s_commande,colors.white,0)
  643.     marche_off(43, 28)
  644.     auto_on(44, 30)
  645.     arret_off(44, 32)
  646.  
  647.   elseif x>57 and x<62 and y==30 then
  648.     rs.setBundledOutput(s_commande,colors.gray,0)
  649.     rs.setBundledOutput(s_commande,colors.pink,0)
  650.     marche_off(4, 28)
  651.     auto_on(5, 30)
  652.     arret_off(5, 32)
  653.     rs.setBundledOutput(s_commande,colors.lime,0)
  654.     rs.setBundledOutput(s_commande,colors.yellow,0)
  655.     marche_off(17, 28)
  656.     auto_on(18, 30)
  657.     arret_off(18, 32)
  658.     rs.setBundledOutput(s_commande,colors.lightblue,0)
  659.     rs.setBundledOutput(s_commande,colors.magenta,0)
  660.     marche_off(30, 28)
  661.     auto_on(31, 30)
  662.     arret_off(31, 32)
  663.     rs.setBundledOutput(s_commande,colors.orange,0)
  664.     rs.setBundledOutput(s_commande,colors.white,0)
  665.     marche_off(43, 28)
  666.     auto_on(44, 30)
  667.     arret_off(44, 32)  
  668.  
  669.   elseif x>4 and x<10 and y==32 then
  670.     rs.setBundledOutput(s_commande,colors.gray,0)
  671.     rs.setBundledOutput(s_commande,colors.pink,255)
  672.     marche_off(4, 28)
  673.     auto_off(5, 30)
  674.     arret_on(5, 32)
  675.  
  676.   elseif x>17 and x<23 and y==32 then
  677.     rs.setBundledOutput(s_commande,colors.lime,0)
  678.     rs.setBundledOutput(s_commande,colors.yellow,255)
  679.     marche_off(17, 28)
  680.     auto_off(18, 30)
  681.     arret_on(18, 32)
  682.  
  683.   elseif x>30 and x<36 and y==32 then
  684.     rs.setBundledOutput(s_commande,colors.lightblue,0)
  685.     rs.setBundledOutput(s_commande,colors.magenta,255)
  686.     marche_off(30, 28)
  687.     auto_off(31, 30)
  688.     arret_on(31, 32)
  689.  
  690.   elseif x>43 and x<49 and y==32 then
  691.     rs.setBundledOutput(s_commande,colors.orange,0)
  692.     rs.setBundledOutput(s_commande,colors.white,255)
  693.     marche_off(43, 28)
  694.     auto_off(44, 30)
  695.     arret_on(44, 32)
  696.  
  697.   elseif x>57 and x<63 and y==32 then
  698.     rs.setBundledOutput(s_commande,colors.gray,0)
  699.     rs.setBundledOutput(s_commande,colors.pink,255)
  700.     marche_off(4, 28)
  701.     auto_off(5, 30)
  702.     arret_on(5, 32)
  703.     rs.setBundledOutput(s_commande,colors.lime,0)
  704.     rs.setBundledOutput(s_commande,colors.yellow,255)
  705.     marche_off(17, 28)
  706.     auto_off(18, 30)
  707.     arret_on(18, 32)
  708.     rs.setBundledOutput(s_commande,colors.lightblue,0)
  709.     rs.setBundledOutput(s_commande,colors.magenta,255)
  710.     marche_off(30, 28)
  711.     auto_off(31, 30)
  712.     arret_on(31, 32)
  713.     rs.setBundledOutput(s_commande,colors.orange,0)
  714.     rs.setBundledOutput(s_commande,colors.white,255)
  715.     marche_off(43, 28)
  716.     auto_off(44, 30)
  717.     arret_on(44, 32)  
  718.    
  719.   elseif x>22 and x<32 and y==35 then  
  720.     rs.setBundledOutput(retour_info,colors.green,0)
  721.     connexion_on(23,35)
  722.     deconnexion_off(36,35)    
  723.    
  724.   elseif x>35 and x<47 and y==35 then  
  725.     rs.setBundledOutput(retour_info,colors.blue,255)
  726.     connexion_off(23,35)
  727.     deconnexion_on(36,35)
  728.  
  729.   elseif x==1 and y==1 then
  730.     event.ignore("redstone_changed", onRedstone)
  731.     computer.pushSignal("stop")
  732.     return false
  733.   end
  734.  
  735. --  print(x..y)
  736.  
  737. end
  738.  
  739. event.listen("touch", onTouch)
  740. event.listen("redstone_changed", onRedstone)
  741. event.pull("stop")
  742.  
  743. --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