Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- 2013 (c) psychedelixx
- Minecraft Turtle: Hallway
- 2013-05-21
- Digs a simple hallway and places missing ground blocks and torches (every 11th horizontal block).
- Usage:
- - use turtle and type "label set <name>"
- (to give your turtle an unique name so it remembers its programs)
- - type "pastebin get VnRd9e6C hallway"
- - place solid blocks in slot 16 (lower right corner)
- - place torches in slot 15 (left of slot 16)
- - type "hallway <length>"
- • where <length> represents the maximum length of the hallway
- --]]
- local args = { ... }
- if #args < 1 then
- print( "Usage: hallway <length>" )
- error()
- end
- limit = tonumber(args[1])
- if turtle.getFuelLevel() == 0 then
- turtle.refuel()
- end
- if turtle.getFuelLevel() == 0 then
- print("I need fuel!")
- else
- print("======== 2013 (c) psychedelixx ========")
- print("Let's go!")
- torchCount = 0
- while turtle.getFuelLevel() > 0 and limit > 0 do
- print("")
- print("Remaining: " .. limit)
- print("Fuel: " .. turtle.getFuelLevel())
- print("Next torch in: " .. 11-torchCount%11 .. "m")
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- if not turtle.detectDown() then
- turtle.select(16)
- turtle.placeDown()
- end
- if torchCount%11 == 0 then
- turtle.turnRight()
- turtle.dig()
- turtle.select(15)
- turtle.place()
- turtle.turnLeft()
- end
- limit = limit-1
- torchCount = torchCount + 1
- if limit > 0 and turtle.getFuelLevel() < 2 then
- turtle.refuel()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement