Advertisement
demonhuntern

Untitled

May 8th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. rednet.open("left")
  2. local id,floor = rednet.receive()
  3.  
  4.  
  5.  
  6.  
  7. if fs.exists("movequeue") then
  8.   local h = fs.open("movequeue", "r")
  9.   local dir = -1
  10.   local dest = h.readLine()
  11.   local distFromDest = 0
  12.   local distWork = tonumber(h.readLine())
  13.   local distMain = tonumber(h.readLine())
  14.   local distBase = tonumber(h.readLine())
  15.   h.close()
  16.   if dest = "Workshop" then
  17.     distFromDest = distWork
  18.     dir = 1
  19.   elseif dest = "Main" then
  20.     distFromDest = distMain
  21.     if distMain < 0 then
  22.     dir = 0
  23.     elseif distMain > 0 then
  24.         dir = 1
  25.   elseif dest = "Basement" then
  26.     distFromDest = distBase
  27.     dir = 0
  28.  
  29.   local carriage = peripheral.wrap("bottom")
  30.  
  31.   if dir = 1 and distFromDest > 0 then
  32.     distFromDest = distFromDest - 1
  33.     distWork = distWork-1
  34.     distMain = distMain-1
  35.     distBase = distBase-1
  36.   elseif dir = 0 and distFromDest <0 then
  37.     distFromDest = distFromDest - 1
  38.     distWork = distWork-1
  39.     distMain = distMain-1
  40.     distBase = distBase-1
  41.  
  42.     h = fs.open("movequeue", "w")
  43.     h.writeLine(floor)
  44.     h.writeLine(distWork)
  45.     h.writeLine(distMain)
  46.     h.writeLine(distBase)
  47.     h.close()
  48.    
  49.     carriage.move(dir, false, false)
  50.   end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement