Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PosOffset = {x=0,y=0,z=0}
- Forward = {x=1,y=0,z=0}
- function ShiftOffsetForward()
- PosOffset.x=PosOffset.x+Forward.x
- PosOffset.y=PosOffset.y+Forward.y
- PosOffset.z=PosOffset.z+Forward.z
- end
- function shift(direction)
- if direction=="right" then
- if Forward.x==1 then
- Forward.x=0
- Forward.z=1
- elseif Forward.z==1 then
- Forward.x=-1
- Forward.z=0
- elseif Forward.x==-1 then
- Forward.x=0
- Forward.z=-1
- elseif Forward.z==-1 then
- Forward.z=0
- Forward.x=1
- end
- end
- if direction=="left" then
- if Forward.x==1 then
- Forward.x=0
- Forward.z=-1
- elseif Forward.z==-1 then
- Forward.x=-1
- Forward.z=0
- elseif Forward.x==-1 then
- Forward.x=0
- Forward.z=1
- elseif Forward.z==1 then
- Forward.z=0
- Forward.x=1
- end
- end
- end
- function forward(shift)
- if shift and turtle.forward() then
- ShiftOffsetForward()
- end
- end
- function left(move)
- shift("left")
- turtle.turnLeft()
- if move then forward(true) end
- end
- function right(move)
- shift("right")
- turtle.turnRight()
- if move then forward(true) end
- end
- left(true)
- forward(true)
- forward(true)
- while true do
- right(true)
- print("Pos:"..PosOffset.x..","..PosOffset.y..","..PosOffset.z.." Rot:"..Forward.x..","..Forward.y..","..Forward.z)
- forward(true)
- print("Pos:"..PosOffset.x..","..PosOffset.y..","..PosOffset.z.." Rot:"..Forward.x..","..Forward.y..","..Forward.z)
- forward(true)
- print("Pos:"..PosOffset.x..","..PosOffset.y..","..PosOffset.z.." Rot:"..Forward.x..","..Forward.y..","..Forward.z)
- right(true)
- print("Pos:"..PosOffset.x..","..PosOffset.y..","..PosOffset.z.." Rot:"..Forward.x..","..Forward.y..","..Forward.z)
- forward(true)
- print("Pos:"..PosOffset.x..","..PosOffset.y..","..PosOffset.z.." Rot:"..Forward.x..","..Forward.y..","..Forward.z)
- forward(true)
- print("Pos:"..PosOffset.x..","..PosOffset.y..","..PosOffset.z.." Rot:"..Forward.x..","..Forward.y..","..Forward.z)
- right(true)
- print("Pos:"..PosOffset.x..","..PosOffset.y..","..PosOffset.z.." Rot:"..Forward.x..","..Forward.y..","..Forward.z)
- forward(true)
- print("Pos:"..PosOffset.x..","..PosOffset.y..","..PosOffset.z.." Rot:"..Forward.x..","..Forward.y..","..Forward.z)
- forward(true)
- print("Pos:"..PosOffset.x..","..PosOffset.y..","..PosOffset.z.." Rot:"..Forward.x..","..Forward.y..","..Forward.z)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement