Advertisement
Plazter

DeepResonance Tank Control[OPENCOMPUTERS]

Jan 28th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. comp = require("component")
  2. tank = comp.deepresonance_tank
  3. rs = comp.redstone
  4. sides = require("sides")
  5. term = require("term")
  6. gpu = comp.gpu
  7.  
  8. -- Local vars
  9. Local SignalSide = sides.north
  10. local purity = tank.getPurity()
  11. local efficiency = tank.getEfficiency()
  12. local strength = tank.getStrength()
  13. -- End of local vars
  14.  
  15. -- Functions
  16. local function GetLevels()
  17.   if tank.getEfficiency() > 0.65 and tank.getStrength() > 0.65 and tank.getFluidAmount() < 6000 then
  18.     rs.setOutput(SignalSide , 0)
  19.     elseif tank.getEfficiency() < 0.65 and tank.getStrength() < 0.65 and tank.getFluidAmount() > 6000 then
  20.     rs.setOutput(SignalSide , 15)
  21.   end
  22. end
  23. -- End of Functions
  24.  
  25. -- Screen Fix
  26. os.sleep(10)
  27. gpu.setResolution(23,10)
  28. -- End of Screen Fix
  29.  
  30. -- Main Loop
  31. while true do
  32.   term.clear()
  33.  
  34.   GetLevels()
  35.  
  36.   print("Fluid Amount: ".. tank.getFluidAmount().."mB")
  37.   print("Efficiency..: ".. tonumber(string.format("%.1f", (100*efficiency))).."%")
  38.   print("Strength....: ".. tonumber(string.format("%.1f", (100*strength))).."%")
  39.   print("Purity......: ".. tonumber(string.format("%.1f", (100*purity))).."%")
  40.   os.sleep(10)
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement