Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 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 = mon.getSize()
  24. xPos = (x - string.len(text))/2 - xOffsett - xOff
  25. mon.setCursorPos(xPos,yPos)
  26. mon.write(text)
  27. end
  28.  
  29. function UI()
  30. cText("Tank sensor by _TheSettler_", 2, 0)
  31. cText("Tank contents: " .. tank1.contents.rawName, 4, 0)
  32. cText("tank volume: " .. oStored .. " / " .. oCap, 5, 0)
  33. end
  34.  
  35. while true do
  36.  
  37. tank1 = m1.getTankInfo()[1]
  38. tank2 = m2.getTankInfo()[1]
  39. tank3 = m3.getTankInfo()[1]
  40.  
  41. if tank1.contents ~= nil then
  42. t1 = tank1.contents.amount *tn
  43. else
  44. t1 = 0
  45. end
  46. if tank2.contents ~= nil then
  47. t2 = tank2.contents.amount *tn
  48. if tank3.contents ~= nil then
  49. t3 = tank3.contents.amount * tn
  50. else
  51. t3 = 0
  52. end
  53. else
  54. t2 = 0
  55. t3 = 0
  56. end
  57.  
  58.  
  59. oStored = t1 + t2 + t3
  60.  
  61. rednet.broadcast(oStored .. " / " .. oCap, tank1.contents.rawName)
  62. UI()
  63. sleep(5)
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement