Advertisement
psychedelixx

Minecraft Turtle: Stairs

May 20th, 2013
1,160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.90 KB | None | 0 0
  1. --[[
  2.     2013 (c) psychedelixx
  3.     Minecraft Turtle: Stairs
  4.     2013-05-21
  5.  
  6.     Digs a simple stair and places missing ground blocks and torches (every 4th horizontal block).
  7.  
  8.     Usage:
  9.     - use turtle and type "label set <name>"
  10.       (to give your turtle an unique name so it remembers its programs)
  11.     - type "pastebin get R9NXSxDx stairs"
  12.     - place solid blocks in slot 16 (lower right corner)
  13.     - place torches in slot 15 (left of slot 16)
  14.     - type "stairs <height> [<limit>]"
  15.         • where <height> represents the height of the hallway (3-5 seems good)
  16.         • and <limit> (optional) represents the Y coordinates digged down
  17.           (if you're at y64 and type in 10, it will dig until it's at y54)
  18. --]]
  19.  
  20. local args = { ... }
  21. if #args < 1 then
  22.   print( "Usage: stairs <height> [<limit>]" )
  23.   error()
  24. end
  25. height = tonumber(args[1])
  26. limit = 256
  27. if #args == 2 then
  28.     limit = tonumber(args[2])
  29. end
  30.  
  31. if height < 2 then
  32.   print( "The height must be >= 2." )
  33.   error()
  34. end
  35.     print("======== 2013 (c) psychedelixx ========")
  36.     print("Let's go!")
  37.  
  38.     while limit > 0 do
  39.  
  40.             if turtle.getFuelLevel() < height*2 then
  41.                     turtle.refuel()
  42.             end
  43.             if turtle.getFuelLevel() < height*2 then
  44.                     print("Fuel is almost empty!")
  45.             end
  46.  
  47.         print("")
  48.         print("Remaining: " .. limit)
  49.         print("Next torch in: " .. limit%4 .. "m")
  50.    
  51.         for var = 0, height-3 do
  52.             turtle.digUp()
  53.             if var < height-3 then
  54.                 turtle.up()
  55.             end
  56.             if var == 0 and limit%4 == 0 then
  57.                 turtle.turnRight()
  58.                 turtle.dig()
  59.                 turtle.select(15)
  60.                 turtle.place()
  61.                 turtle.turnLeft()
  62.             end
  63.         end
  64.         for var = 0, height-4 do turtle.down() end
  65.         turtle.digDown()
  66.         turtle.down()
  67.         if not turtle.detectDown() then
  68.             turtle.select(16)
  69.             turtle.placeDown()
  70.         end
  71.  
  72.             while not turtle.forward() do
  73.                    turtle.dig()
  74.             end
  75.  
  76.         turtle.forward()
  77.         limit = limit-1
  78.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement