Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local t_args = {...};
- local x,y,z = tonumber(t_args[1]),tonumber(t_args[2]),tonumber(t_args[3]);
- local cx, cy, cz = 1,1,1;
- down = function()
- if(cy<=1)then return false; end
- cy = cy-1;
- if(turtle.detectDown())then turtle.digDown(); end
- turtle.down();
- return true;
- end
- up = function()
- if(cy>=y)then return false; end
- cy = cy+1;
- if(turtle.detectUp())then turtle.digUp(); end
- turtle.up();
- return true;
- end
- local left = function()
- -- if(cz<=1)then return false; end
- cz = cz + 1;
- turtle.turnLeft();
- if(turtle.detect())then turtle.dig(); end
- turtle.forward();
- turtle.turnLeft();
- return true;
- end
- local right = function()
- -- if(cz>=z)then return false; end
- cz = cz+1;
- turtle.turnRight();
- if(turtle.detect())then turtle.dig(); end
- turtle.forward();
- turtle.turnRight();
- return true;
- end
- forward = function()
- if(turtle.detect)then turtle.dig(); end
- if(turtle.forward())then
- cx = cx + 1;
- else
- print("Can't Move Forward");
- end
- return true;
- end
- while(cx<x or cz<z)do
- if(cy<y)then
- while(cy<y)do
- up();
- end
- else
- while(cy>1)do
- down();
- end
- end
- if(cx < x)then --not at end of row
- forward();
- elseif(cx==x)then
- if(cz%2==1)then right(); else left(); end
- cx = 0;
- end
- if(cx>=x and cz>=z)then
- if(cy<y)then
- while(cy<y)do
- up();
- end
- else
- while(cy>1)do
- down();
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment