Advertisement
Muzze77

UUInterface

May 10th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.94 KB | None | 0 0
  1. shell.run("clear")
  2. shell.run("monitor top clear")
  3. rs.setOutput("bottom",false)
  4.  
  5.  
  6. os.loadAPI("ocs/apis/sensor")
  7. sen = sensor.wrap("left")
  8. sen2 = sensor.wrap("right")
  9. mon = peripheral.wrap("top")
  10. mon.setTextScale(0.5)
  11. rb = 0
  12. while true do
  13. s = sen2.getTargets()
  14. n = 1
  15. n2 = 3
  16. n3 = 1
  17. for v, k in pairs(s) do
  18.  
  19. if k.Name == "MFE" then
  20. if rb < 6 then
  21. I = sen2.getTargetDetails(v)
  22.  
  23. pos = I.Position.X .. "," .. I.Position.Y .. "," .. I.Position.Z
  24. term.setCursorPos(1,n2)
  25.  
  26. n2 = n2 + 1
  27. icname = "MFE " .. n3
  28. n3 = n3 + 1
  29.  
  30. term.setCursorPos(1,n)
  31. term.clearLine(n)
  32. print(icname .. " " .. I.Stored .. " / " .. I.Capacity)
  33.  
  34. mon.setCursorPos(1,n)
  35. mon.clearLine(n)
  36. mon.write(icname .. " MFE " .. I.Stored)
  37. mon.setCursorPos(20,n)
  38. mon.write(" / " .. I.Capacity)
  39. n = n + 1
  40. if maxCap == nil then
  41.   maxCap = I.Capacity
  42. else
  43.   maxCap = maxCap + I.Capacity
  44. end
  45.  
  46. if isCap == nil then
  47.   isCap = I.Stored
  48. else
  49.   isCap = isCap + I.Stored
  50. end
  51.  
  52.  
  53. x, y = mon.getSize()
  54.  
  55. mon.setCursorPos(1,y - 1)
  56. mon.clearLine(y-1)
  57. mon.write("Gesamtstrom: " .. isCap)
  58. mon.setCursorPos(20,y-1)
  59. mon.write(" / " .. maxCap)
  60. mon.setCursorPos(x-4,y-1)
  61. --mon.clearLine(y)
  62. mon.write(math.floor(100 / maxCap * isCap) .. "%")
  63.  
  64.  
  65.  
  66. --end
  67.  
  68.  
  69. tanks = sen.getTargets()
  70. for vr, kr in pairs(tanks) do
  71.  
  72.   if kr.Name == "Ender Chest" then
  73.     infos = sen.getTargetDetails(vr)
  74.  
  75.     mon.setCursorPos(1,y-3)
  76.     mon.clearLine(y-3)
  77.     for b1, k2 in pairs(infos.Tanks) do
  78.     mon.clearLine(y-3)
  79.     r2 = k2.Amount
  80.     a2 = k2.Capacity
  81.     mon.write("Tankinhalt: " ..k2.Amount )
  82.     mon.setCursorPos(20,y-3)
  83.     mon.write(" / " .. k2.Capacity)
  84.     end
  85.    
  86.   end
  87.  
  88.  
  89. end
  90.  
  91.  print(isCap)
  92.  print(maxCap)
  93.  print(r2)
  94.  print(a2)
  95. if isCap < (maxCap/2) and r2 > (a2/4) then
  96.   rs.setOutput("bottom",true)
  97.  
  98.  
  99. else
  100.   rs.setOutput("bottom",false)
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107. end
  108. rb = rb + 1
  109. else
  110. rb = 6
  111.  
  112. end
  113. end
  114. end
  115.  
  116. sleep(1)
  117. maxCap = 0
  118. isCap = 0
  119. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement