Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local t = turtle; local f=t.forward;t.forward=function() while not f() do end end; t.r,t.x,t.y,t.z=0,0,0,0; t.tr=t.turnRight;
- t.tl=t.turnLeft; t.tt=function(r) local d=t.r>r and t.r-r or r-t.r; if (d==0) then return true end; if (d==2) then t.tr() t.tr() end;
- if (d==1) then if (t.r>r) then t.tl() else t.tr() end end; if (d==3) then if (t.r>r) then t.tr() else t.tl() end end; t.r=r; end;
- t.goto=function(x,y,z) local tX,tZ=(x>t.x and 1 or 3), (z>t.z and 0 or 2); local dX,dY,dZ=(x>t.x and 1 or -1), (y>t.y and 1 or -1),
- (z>t.z and 1 or -1); while (t.x~=x) do t.tt(tX) t.forward() t.x=t.x+dX end; while (t.z~=z) do t.tt(tZ) t.forward()
- t.z=t.z+dZ end; while (t.y~=y) do if (dY==1) then t.up() else t.down() end t.y=t.y+dY end; end; t.turnTo=t.tt;
Advertisement
Add Comment
Please, Sign In to add comment