Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- 2013 (c) psychedelixx
- Minecraft Turtle: Chest Tunnel
- 2013-05-22
- Digs a room with specified dimensions.
- Usage:
- - use turtle and type "label set <name>"
- (to give your turtle an unique name so it remembers its programs)
- - type "pastebin get YijBG3sz ctunnel "
- - type "ctunnel <length> [<return (0|1)>]"
- - place chests in slot 15
- - place torches in slot 16
- --]]
- i = 0
- ret = 0
- function move()
- i = i+1
- if turtle.getFuelLevel() < 2 then
- turtle.refuel()
- end
- print("----------------")
- print("Remaining fuel: " .. turtle.getFuelLevel())
- print("Digged: " .. i .. "/" .. length .. "(" .. math.floor(100/length*i) .. "%)")
- print("Next torch in " .. 9-i%8)
- print("Next chest in " .. 33-i%32)
- print("")
- --[[ Vorwärts graben und bewegen ]]--
- while not turtle.forward() do
- turtle.dig()
- end
- --[[ Hoch bzw. runter graben ]]--
- if i%2 == 1 then
- repeat
- turtle.digUp()
- until not turtle.detectUp()
- else
- turtle.digDown()
- end
- --[[ Links graben ]]--
- turtle.turnLeft()
- repeat
- turtle.dig()
- until not turtle.detect()
- --[[ Chest setzen und Items ablegen ]]--
- if i%32 == 1 and i > 5 then
- turtle.select(15)
- turtle.place()
- for slot = 1, 14 do
- turtle.select(slot)
- turtle.drop()
- end
- end
- --[[ Rechts graben ]]--
- turtle.turnLeft()
- turtle.turnLeft()
- repeat
- turtle.dig()
- until not turtle.detect()
- --[[ Fackel setzen ]]--
- if i%8 == 1 then
- turtle.select(16)
- turtle.place()
- end
- --[[ Hoch bzw. runter bewegen ]]--
- if i%2 == 1 then
- turtle.digDown()
- turtle.up()
- repeat
- turtle.digUp()
- until not turtle.detectUp()
- else
- repeat
- turtle.digUp()
- until not turtle.detectUp()
- turtle.down()
- turtle.digDown()
- end
- --[[ Rechts graben ]]--
- repeat
- turtle.dig()
- until not turtle.detect()
- --[[ Links graben ]]--
- turtle.turnLeft()
- turtle.turnLeft()
- repeat
- turtle.dig()
- until not turtle.detect()
- --[[ Nach vorne drehen ]]--
- turtle.turnRight()
- end
- local args = { ... }
- if #args < 1 then
- print("")
- print("ctunnel <length> [<return (0|1)>]")
- print("place chests in slot 15")
- print("place torches in slot 16")
- print("")
- error()
- end
- length = tonumber(args[1])
- if #args == 2 then
- ret = 1
- end
- 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!")
- print("Digging " .. length)
- move()
- print("")
- print("Fuel: " .. turtle.getFuelLevel())
- for l = 1, length-1 do
- move()
- end
- if ret == 1 then
- turtle.turnLeft()
- turtle.turnLeft()
- while i > 0 do
- turtle.forward()
- i = i-1
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement