-
-
Save wolfgangmeyers/5894095433ce96596a85 to your computer and use it in GitHub Desktop.
Computercraft turtle script for carving out paths
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- navigate through a path | |
function digDown() | |
while not turtle.down() do | |
turtle.digDown() | |
end | |
end | |
function digUp() | |
while not turtle.up() do | |
turtle.digUp() | |
end | |
end | |
function dig() | |
while not turtle.forward() do | |
turtle.dig() | |
end | |
end | |
pathmap = { | |
w=dig, | |
a=turtle.turnLeft, | |
d=turtle.turnRight, | |
r=digUp, | |
f=digDown | |
} | |
function nav(path) | |
for i=1,string.len(path) do | |
command = string.sub(path, i, i) | |
while not pathmap[command]() do | |
digmap[command]() | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment