Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. -- Config
  2. tankSide = "back"
  3. wirelessModemSide = "bottom"
  4. numberOfTanksPrLevel = 27
  5. tankHigth = 3
  6. xOffsett = -1
  7.  
  8. m1 = peripheral.wrap(tankSide)
  9. m2 = peripheral.wrap("openblocks_tank_0")
  10. m3 = peripheral.wrap("openblocks_tank_5")
  11.  
  12.  
  13. -- end of Config
  14.  
  15.  
  16. rednet.open(wirelessModemSide)
  17. tank1 = m1.getTankInfo()[1]
  18.  
  19. tn = numberOfTanksPrLevel
  20. oCap = tn * tankHigth * 16000
  21.  
  22. function cText(text, yPos, xOff)
  23. x,y = Term.getSize()
  24. xPos = (x - string.len(text))/2 - xOffsett - xOff
  25. term.setCursorPos(xPos,yPos)
  26. term.pritn(text)
  27. end
  28.  
  29. function UI()
  30. term.clear()
  31. cText("Tank sensor by _TheSettler_", 3, 0)
  32. cText("Tank contents: " .. tank1.contents.rawName, 5, 0)
  33. cText("Tank volume: " .. oStored .. " / " .. oCap, 6, 0)
  34. end
  35.  
  36. while true do
  37.  
  38. tank1 = m1.getTankInfo()[1]
  39. tank2 = m2.getTankInfo()[1]
  40. tank3 = m3.getTankInfo()[1]
  41.  
  42. if tank1.contents ~= nil then
  43. t1 = tank1.contents.amount *tn
  44. else
  45. t1 = 0
  46. end
  47. if tank2.contents ~= nil then
  48. t2 = tank2.contents.amount *tn
  49. if tank3.contents ~= nil then
  50. t3 = tank3.contents.amount * tn
  51. else
  52. t3 = 0
  53. end
  54. else
  55. t2 = 0
  56. t3 = 0
  57. end
  58.  
  59.  
  60. oStored = t1 + t2 + t3
  61.  
  62. rednet.broadcast(oStored .. " / " .. oCap, tank1.contents.rawName)
  63. UI()
  64. sleep(5)
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement