Advertisement
iPeer

Untitled

Jan 29th, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. -- Platform script, written by iPeer
  2.  
  3. local args = { ... }
  4. local len = tonumber(args[1]) or 9999
  5. local width = tonumber(args[2]) or 9999
  6. local curwidth = width
  7. local dir = tonumber(args[3]) or 0
  8. local curlen = 0
  9.  
  10. print("Creating a "..len.."x"..width.." platform")
  11.  
  12. function hasBlocks()
  13.   for s = 1, 16 do
  14.     if turtle.getItemCount(s) > 0 then
  15.       turtle.select(s)
  16.       return true
  17.     end
  18.   end
  19.   return false
  20. end
  21.  
  22. for z = width-1, 0, -1 do
  23.   for x = 0, len-1 do
  24.     if not hasBlocks() then
  25.       print("Out of blocks.")
  26.             return
  27.     end
  28.     if not turtle.detectDown() then
  29.       turtle.placeDown()
  30.     end
  31.     if (x < len-1) then
  32.       if not turtle.forward() then
  33.         break
  34.       end
  35.     end
  36.   end
  37.   if z > 0 then
  38.     if dir == 1 then
  39.       dir = 0
  40.       turtle.turnRight()
  41.       if not turtle.forward() then
  42.         print("There\'s an obstruction.")
  43.         break
  44.       end
  45.       turtle.turnRight()
  46.     else
  47.       dir = 1
  48.       turtle.turnLeft()
  49.       if not turtle.forward() then
  50.         print("There\'s an obstruction.")
  51.         break
  52.       end
  53.       turtle.turnLeft()
  54.     end
  55.   end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement