Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- 2014 (c) psychedelixx
- Minecraft Turtle: Tesseract Tunnel (Robust)
- 2014-04-13
- Digs a tunnel and places mined items in a tesseract.
- Robust API:
- http://computercraft.info/wiki/Robust_Turtle_API
- Usage:
- - use turtle and type "label set <name>"
- (to give your turtle an unique name so it remembers its programs)
- - type "pastebin get TnEEWzLJ tt"
- - type "tt <length> [<return (0|1)>]"
- - place torches in slot 16
- --]]
- i = 0
- ret = 1
- function move()
- i = i+1
- print("----------------")
- print("Remaining fuel: " .. turtle.getFuelLevel())
- print("Digged: " .. i .. "/" .. length .. "(" .. math.floor(100/length*i) .. "%)")
- print("Next torch in " .. 9-i%8)
- print("")
- --[[ Vorwärts graben und bewegen ]]--
- t.dig()
- t.forward()
- --[[ Hoch bzw. runter graben ]]--
- if i%2 == 1 then
- t.digUp()
- else
- t.digDown()
- end
- --[[ Links graben ]]--
- t.left()
- t.dig()
- --[[ Rechts graben ]]--
- t.turnAround()
- t.dig()
- --[[ Fackel setzen ]]--
- if i%8 == 1 then
- turtle.select(16)
- turtle.place()
- end
- --[[ Hoch bzw. runter bewegen ]]--
- if i%2 == 1 then
- t.up()
- t.digUp()
- else
- t.digUp()
- t.down()
- end
- --[[ Rechts graben ]]--
- t.dig()
- --[[ Links graben ]]--
- t.turnAround()
- t.dig()
- --[[ Nach vorne drehen ]]--
- t.right()
- --[[ Sand/Kies entfernen ]]--
- t.digUp()
- end
- local args = { ... }
- if #args < 1 then
- print("")
- print("tt <length> [<return (0|1)>]")
- print("place torches in slot 16")
- print("")
- error()
- end
- length = tonumber(args[1])
- if #args == 2 then
- ret = tonumber(args[2])
- end
- if turtle.getFuelLevel() < length*2 + length*ret then
- print("I need fuel!")
- print((length*2 + length*ret) - turtle.getFuelLevel() .. " fuel missing")
- print("Refuel with " .. ((length*2 + length*ret) - turtle.getFuelLevel())/80+1 .. " pieces of coal")
- else
- print("======== 2014 (c) psychedelixx ========")
- print("Let's go!")
- print("Digging " .. length)
- for l = 1, length do
- move()
- if i%2 == 0 then
- empty = 0
- for slot = 1, 15 do
- if turtle.getItemCount(slot) == 0 then
- empty = empty + 1
- if empty >= 2 then break end
- end
- end
- if empty <= 1 then
- t.turnAround()
- t.forward(l)
- for slot = 1, 15 do
- turtle.select(slot)
- turtle.drop()
- end
- t.turnAround()
- t.forward(l)
- end
- end
- end
- if ret == 1 then
- t.turnAround()
- t.forward(length)
- if i%2 == 1 then t.down() end
- for slot = 1, 16 do
- turtle.select(slot)
- turtle.drop()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement