Advertisement
se7enek

Untitled

May 23rd, 2015
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.75 KB | None | 0 0
  1. rednet.close("back")
  2. sleep(.5)
  3. rednet.open("back")
  4.  
  5. drillid = 15
  6. energyid = 17
  7. reaktorid = 18
  8. fireworkid = 19
  9. armataid = 21
  10. turbineid = 34
  11.  
  12. local function sluchaj(x,y)
  13.     rednet.send(x,y)
  14.     id,msg = rednet.receive()
  15.     return msg
  16. end
  17.  
  18. while true do
  19.     drill = sluchaj(drillid,"drill")
  20.     energy = sluchaj(energyid,"energy")
  21.     reaktor = sluchaj(reaktorid,"reaktor")
  22.     reaktorp = sluchaj(reaktorid,"reaktorp")
  23.     reaktore = sluchaj(turbineid,"reaktore")
  24.     reaktore = math.floor(reaktore/100)/10
  25.     reaktort = sluchaj(reaktorid,"reaktort")
  26.     armata = sluchaj(armataid,"armata")
  27.    
  28.     if energy >= 0 and energy <= 33 then energycolor = colors.red
  29.     elseif energy > 33 and energy <= 66 then energycolor = colors.orange
  30.     elseif energy > 66 and energy < 99 then energycolor = colors.green
  31.     elseif energy >= 99 then energycolor = colors.green energy = 100 end
  32.  
  33.     if drill == "on" then drillcolor = colors.green
  34.     else drillcolor = colors.red end
  35.    
  36.     if reaktor == "on" then reaktorcolor = colors.green
  37.     else reaktorcolor = colors.red end
  38.  
  39.     if armata == "on" then armatacolor = colors.green
  40.     else armatacolor = colors.red end
  41.  
  42.     term.clear()
  43.     term.setCursorPos(1,1)
  44.     print("Panel Sterowania")
  45.     term.setCursorPos(19,1)
  46.     print(textutils.formatTime(os.time(),false))
  47.     term.setBackgroundColor(energycolor)
  48.     term.setCursorPos(8,3)
  49.     print("Energia: ")
  50.     term.setCursorPos(17,3)
  51.     print(energy.."%")
  52.  
  53.     paintutils.drawFilledBox(2,5,10,7,drillcolor) -- x2,9 y4,6
  54.    
  55.         paintutils.drawFilledBox(2,9,10,11,colors.cyan)
  56.         paintutils.drawFilledBox(2,13,10,15,colors.lime)
  57.     paintutils.drawFilledBox(14,7,25,13,reaktorcolor)
  58.     paintutils.drawFilledBox(14,15,25,17,armatacolor)
  59.     paintutils.drawFilledBox(2,17,12,17,colors.gray)
  60.     paintutils.drawFilledBox(12,5,12,17,colors.gray)
  61.     paintutils.drawFilledBox(2,19,25,19,colors.green)
  62.     term.setCursorPos(14,5)
  63.     term.setBackgroundColor(colors.cyan)
  64.     print("   Odswiez  ")
  65.         term.setCursorPos(4,6)
  66.         term.setBackgroundColor(drillcolor)
  67.         print("DRILL")
  68.         term.setCursorPos(5,10)
  69.     term.setBackgroundColor(colors.cyan)
  70.         print("[-]")
  71.     term.setCursorPos(5,14)
  72.     term.setBackgroundColor(colors.lime)
  73.         print("[-]")
  74.     term.setCursorPos(16,8)
  75.     term.setBackgroundColor(reaktorcolor)
  76.     print("Reaktor")
  77.     term.setCursorPos(15,10)
  78.     print("Fuel: "..reaktorp.."%")
  79.     term.setCursorPos(15,11)
  80.     print("RF/t: "..reaktore.."K")
  81.     term.setCursorPos(15,12)
  82.     print("Temp: "..reaktort.."C")
  83.     term.setBackgroundColor(armatacolor)
  84.     term.setCursorPos(17,16)
  85.     print("Armata")
  86.     term.setBackgroundColor(colors.green)
  87.     term.setCursorPos(8,19)
  88.     print("Fajerwerki!")
  89.     term.setBackgroundColor(colors.gray)
  90.     term.setCursorPos(3,17)
  91.     print("by se7en")
  92.    
  93.  
  94.         term.setBackgroundColor(colors.black)
  95.         term.setCursorPos(2,17)
  96.  
  97.         local evnt = { os.pullEvent("mouse_click") }
  98.         local x = evnt[3]
  99.         local y = evnt[4]
  100.         if y >= 5 and y <= 7 and x >= 2 and x <= 10 then
  101.         if drill == "on" then
  102.                     rednet.send(drillid,"drilloff")
  103.         else
  104.             rednet.send(drillid,"drillon")
  105.         end
  106.                 sleep(.5)
  107.         end
  108.  
  109.     if y >= 7 and y <= 13 and x >= 14 and x <= 25 then
  110.         if reaktor == "on" then
  111.                     rednet.send(reaktorid,"reaktoroff")
  112.         else
  113.             rednet.send(reaktorid,"reaktoron")
  114.         end
  115.                 sleep(.5)
  116.         end
  117.  
  118.     if y >= 17 and y <= 17 and x >= 2 and x <= 12 then
  119.                 sleep(.1)
  120.         end
  121.  
  122.     if y >= 19 and y <= 19 and x >= 1 and x <= 25 then
  123.         rednet.send(fireworkid,"go")
  124.                 sleep(.1)
  125.         end
  126.  
  127.     if y >= 15 and y <= 17 and x >= 14 and x <= 25 then
  128.         if armata == "on" then
  129.                     rednet.send(armataid,"armataoff")
  130.         else
  131.             rednet.send(armataid,"armataon")
  132.         end
  133.                 sleep(.5)
  134.         end
  135. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement