skipper_is

SmelteryMk2

Jan 7th, 2018
93
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local drain = peripheral.wrap("back")
  2.  
  3. function on(side,time)
  4.   redstone.setOutput(side,true)
  5.   sleep(1)
  6.   redstone.setOutput(side,false)
  7.   sleep(time-1)
  8. end
  9.  
  10. function getQuantity(drainObject)
  11.   local tank = drainObject.getTankInfo()[1]
  12.   local contentsTable = tank["contents"]
  13.   quantity = contentsTable["amount"]
  14.   return quantity
  15.  
  16. end
  17.  
  18. local ingotVol = 1296 --volume of a full ingot in mB
  19. local smallIngotVol = 143
  20.  
  21. while true do
  22.  
  23.   if getQuantity(drain) > ingotVol then
  24.     print("Contents is: "..getQuantity(drain))
  25.     on("back",15)
  26.     print("Contents is now: "..getQuantity(drain))
  27.   elseif getQuantity(drain) > smallIngotVol then
  28.     on("right",5)
  29.   else
  30.     print("Quantity is less than 1 block")
  31.     sleep(15)
  32.   end
  33. end
RAW Paste Data