Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("left")
- local id,floor = rednet.receive()
- if fs.exists("movequeue") then
- local h = fs.open("movequeue", "r")
- local dir = -1
- local dest = h.readLine()
- local distFromDest = 0
- local distWork = tonumber(h.readLine())
- local distMain = tonumber(h.readLine())
- local distBase = tonumber(h.readLine())
- h.close()
- if dest = "Workshop" then
- distFromDest = distWork
- dir = 1
- elseif dest = "Main" then
- distFromDest = distMain
- if distMain < 0 then
- dir = 0
- elseif distMain > 0 then
- dir = 1
- elseif dest = "Basement" then
- distFromDest = distBase
- dir = 0
- local carriage = peripheral.wrap("bottom")
- if dir = 1 and distFromDest > 0 then
- distFromDest = distFromDest - 1
- distWork = distWork-1
- distMain = distMain-1
- distBase = distBase-1
- elseif dir = 0 and distFromDest <0 then
- distFromDest = distFromDest - 1
- distWork = distWork-1
- distMain = distMain-1
- distBase = distBase-1
- h = fs.open("movequeue", "w")
- h.writeLine(floor)
- h.writeLine(distWork)
- h.writeLine(distMain)
- h.writeLine(distBase)
- h.close()
- carriage.move(dir, false, false)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement