Advertisement
An93l0fD3ath

Loader Computer V3

Jul 25th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.96 KB | None | 0 0
  1. local component = require("component")
  2. local loaderInfo = component.proxy(component.get("7dfe"))
  3. local rs = component.redstone
  4. local colors = require("colors")
  5. local sides = require("sides")
  6. local myTable = loaderInfo.getFluidInTank(sides.down)
  7. local transposers = {}
  8. transposers["milk"] = component.proxy(component.get("8969"))
  9. transposers["sewage"] = component.proxy(component.get("9f87"))
  10.  
  11. local GERTi = require("GERTiClient")
  12. local socket = GERTi.openSocket(0.4, true, 1) --Tablet
  13. local socket = GERTi.openSocket(0.1, true, 1) --Holding_Bay
  14. local socket = GERTi.openSocket(0.2, true, 1) --SewagaePlant
  15.  
  16. local serialize = require("serialization")
  17.  
  18. local data = {}
  19. local function receiveData(eventname, origin, ID)
  20.   if ID == 0.4 then
  21.     data = socket1:read() --- If it's coming with the tablet connectionID, use the tablet socket
  22.   elseif ID == 0.2 then
  23.     data = socket2:read() --- If it's coming with the sewage connectionID, use the sewage socket
  24.   end
  25.   actData(data) -- Some imaginary function that acts on the data received
  26. end
  27.  
  28.  
  29. event.listen("GERTData", receiveData)
  30.  
  31.  
  32. serTable = data[1]
  33. receipt = serialize.unserialize(serTable)
  34. print(receipt)
  35.  
  36. local order = receipt["amount"]
  37. local fluid = receipt["type"]
  38.  
  39. local function cartRelease()
  40. myTable = loaderInfo.getFluidInTank(sides.down)
  41. rs.setBundledOutput(sides.east, colors.blue, 253)
  42. os.sleep(1)
  43. rs.setBundledOutput(sides.east, colors.blue, 0)
  44.  
  45. rs.setBundledOutput(sides.east, colors.blue, 253)
  46. os.sleep(1)
  47. rs.setBundledOutput(sides.east, colors.blue, 0)
  48.  
  49. print(myTable[1]["amount"],"cartRelease")
  50. end
  51.  
  52. local function loaderCheck()
  53. myTable = loaderInfo.getFluidInTank(sides.down)
  54. while myTable[1]["amount"] > 0 do
  55. print(myTable[1]["amount"],"loaderCheck1")
  56. cartRelease()
  57. os.sleep(70)
  58. end
  59. end
  60.  
  61. local function getRemainder()
  62. if myTable[1]["amount"] <= 32000 then
  63. print(myTable[1]["amount"],"getRemainder")
  64. end
  65. end
  66.  
  67. transposers[fluid].transferFluid(sides.north, sides.south, order)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement