Advertisement
An93l0fD3ath

sewageplant

Jul 19th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 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. -- Acquire helper libraries
  6. local sides = require("sides")
  7. local colors = require("colors")
  8. local os = require("os")
  9. local term = require("term")
  10. local event = require("event")
  11. -- Acquire the GERTi library and open a connection to the base computer
  12. local GERTi = require("GERTiClient")
  13. local socket = GERTi.openSocket(0.1, false, 1) -- This tells it to open a connection to the GERTi computer with an address of 0.1, not to use an event singal on incoming messages, and to use connection ID 1
  14.  
  15. --local holding = redstone.getBundledInput(sides.back, colors.green)
  16.  
  17.  
  18. local TankInfo = tank.getFluidInTank(sides.up) --useded to get amount in tank
  19.  
  20. local Safe = 256000
  21. -- if TankInfo[1]["amount"] < Safe then
  22.  
  23. --if event.pull(holding) == 0 then
  24. --end
  25.  
  26.  
  27.  while true do
  28.  TankInfo = tank.getFluidInTank(sides.up)
  29.  if TankInfo[1]["amount"] < Safe then
  30.     socket:write("SewageRequest") -- Sends a message to the other end of the socket (Computer 0.1) the data "Requesting Train"
  31.     print(TankInfo[1]["amount"],"Sewage Low")
  32.     print("message sent train requested")
  33.     os.sleep(60)
  34.     term.setCursor(1,1)
  35.     term.clearLine()
  36.     term.clear()
  37.   else
  38.     print(TankInfo[1]["amount"],"Sewage Level Safe")
  39.     os.sleep(5)
  40.     term.setCursor(1,1)
  41.     term.clearLine()
  42.     term.clear()
  43.   end
  44. end
  45.  
  46. --redstone.setBundledOutput(sides.back, colors.blue, 0)
  47. --redstone.setBundledOutput(sides.back, colors.purple, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement