Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local serialize = require("serialization")
- local GERTi = require("GERTiClient")
- local colors = require("colors")
- local sides = require("sides")
- local loaderInfo = component.proxy(component.get("7dfe"))
- local rs = component.redstone
- local myTable = loaderInfo.getFluidInTank(sides.down)
- local transposers = {}
- transposers["milk"] = component.proxy(component.get("8969"))
- transposers["sewage"] = component.proxy(component.get("9f87"))
- local socket = GERTi.openSocket(0.4, true, 1) --Tablet
- local socket = GERTi.openSocket(0.1, true, 1) --Holding_Bay
- local socket = GERTi.openSocket(0.2, true, 1) --SewagaePlant
- local socket1 = nil -- Create 2 sockets that we're going to populate as connections come in
- local socket2 = nil -- See above
- local function newConnection(eventname, origin, ID) -- This is a function that receives the 2 returned values by the event
- if ID == 0.4 then
- socket1 = GERTi.openSocket(origin, true, 0.4) -- If we're coming in from the tablet, open connection to tablet
- elseif ID == 0.2 then
- socket2 = GERTi.openSocket(origin, true, 0.2) -- If we're coming in from the sewage, open connection to sewage
- end
- end
- event.listen("GERTConnectionID", newConnection) -- Register event handler
- -- We now have 2 bi-directional sockets opened
- local data = {}
- local function receiveData(eventname, origin, ID)
- if ID == 0.4 then
- data = socket1:read() --- If it's coming with the tablet connectionID, use the tablet socket
- elseif ID == 0.2 then
- data = socket2:read() --- If it's coming with the sewage connectionID, use the sewage socket
- end
- actData(data) -- Some imaginary function that acts on the data received
- end
- event.listen("GERTData", receiveData)
- serTable = data[1]
- receipt = serialize.unserialize(serTable)
- print(receipt)
- local order = receipt["amount"]
- local fluid = receipt["type"]
- local function cartRelease()
- myTable = loaderInfo.getFluidInTank(sides.down)
- rs.setBundledOutput(sides.east, colors.blue, 253)
- os.sleep(1)
- rs.setBundledOutput(sides.east, colors.blue, 0)
- rs.setBundledOutput(sides.east, colors.blue, 253)
- os.sleep(1)
- rs.setBundledOutput(sides.east, colors.blue, 0)
- print(myTable[1]["amount"],"cartRelease")
- end
- local function loaderCheck()
- myTable = loaderInfo.getFluidInTank(sides.down)
- while myTable[1]["amount"] > 0 do
- print(myTable[1]["amount"],"loaderCheck1")
- cartRelease()
- os.sleep(70)
- end
- end
- local function getRemainder()
- if myTable[1]["amount"] <= 32000 then
- print(myTable[1]["amount"],"getRemainder")
- end
- end
- transposers[fluid].transferFluid(sides.north, sides.south, order)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement