psychedelixx

Minecraft Turtle: Hallway small

Apr 23rd, 2019
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.     2013 (c) psychedelixx
  3.     Minecraft Turtle: Hallway
  4.     2013-05-21
  5.  
  6.     Digs a simple hallway and places missing ground blocks and torches (every 11th 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 9GAFmVc1 hallwaysmall"
  12.     - place solid blocks in slot 16 (lower right corner)
  13.     - place torches in slot 15 (left of slot 16)
  14.     - type "hallway <length>"
  15.         • where <length> represents the maximum length of the hallway
  16. --]]
  17.  
  18. local args = { ... }
  19. if #args < 1 then
  20.   print( "Usage: hallway <length>" )
  21.   error()
  22. end
  23. limit = tonumber(args[1])
  24.  
  25. if turtle.getFuelLevel() == 0 then
  26.     turtle.refuel()
  27. end
  28.  
  29. if turtle.getFuelLevel() == 0 then
  30.     print("I need fuel!")
  31. else
  32.     print("======== 2013 (c) psychedelixx ========")
  33.     print("Let's go!")
  34.  
  35.     torchCount = 0
  36.    
  37.     while turtle.getFuelLevel() > 0 and limit > 0 do
  38.         print("")
  39.         print("Remaining: " .. limit)
  40.         print("Fuel: " .. turtle.getFuelLevel())
  41.         print("Next torch in: " .. 11-torchCount%11 .. "m")
  42.  
  43.         turtle.dig()
  44.         turtle.forward()
  45.  
  46.         if not turtle.detectDown() then
  47.             turtle.select(16)
  48.             turtle.placeDown()
  49.         end
  50.    
  51.         if torchCount%11 == 0 then
  52.             turtle.turnRight()
  53.             turtle.dig()
  54.             turtle.select(15)
  55.             turtle.place()
  56.             turtle.turnLeft()
  57.         end
  58.         limit = limit-1
  59.         torchCount = torchCount + 1
  60.         if limit > 0 and turtle.getFuelLevel() < 2 then
  61.             turtle.refuel()
  62.         end
  63.     end
  64. end
Advertisement
Add Comment
Please, Sign In to add comment