Advertisement
An93l0fD3ath

SewagePlant V2

Jul 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. --Acquire the redstone component
  2. local component = require("component")
  3. local redstone = component.redstone
  4. local tank = component.transposer
  5.  
  6. -- Acquire helper libraries
  7. local sides = require("sides")
  8. local colors = require("colors")
  9. local os = require("os")
  10. local term = require("term")
  11. local event = require("event")
  12.  
  13. -- Acquire the GERTi library and open a connection to the base computer
  14. local GERTi = require("GERTiClient")
  15. local serialize = require("serialization")
  16. local socket = GERTi.openSocket(0.4, true, 2) -- Used connectionID 2 instead of 1
  17.  
  18. local TankInfo = tank.getFluidInTank(sides.up) --useded to get amount in tank
  19.  
  20. local Safe = 256000
  21. local order = 256000
  22. local fluid = sewage
  23.  
  24.  while true do
  25.  TankInfo = tank.getFluidInTank(sides.up)
  26.  if TankInfo[1]["amount"] < Safe then
  27.     table = {["amount"] = order, ["type"] = fluid}
  28.     socket:write(serialize.serialize(table))
  29.        
  30.     print(TankInfo[1]["amount"],"Sewage Low")
  31.     print("message sent train requested")
  32.         os.sleep(60)
  33.         term.setCursor(1,1)
  34.         term.clearLine()
  35.         term.clear()
  36.   else
  37.     print(TankInfo[1]["amount"],"Sewage Level Safe")
  38.         os.sleep(5)
  39.         term.setCursor(1,1)
  40.         term.clearLine()
  41.         term.clear()
  42.   end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement