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 Move(direction)
- PosOffset.x=PosOffset.x+Forward.x
- PosOffset.y=PosOffset.y+Forward.y
- PosOffset.z=PosOffset.z+Forward.z
- end
- function shift(direction)
- local x,z = Forward.x,Forward.z
- if direction=="right" then
- Forward.x = (z == 1 and -1) or (z == -1 and 1) or (x ~= 0 and 0)
- Forward.z = (x == 1 and 1) or (x == -1 and -1) or (z ~= 0 and 0)
- end
- if direction=="left" then
- Forward.z = (x == 1 and -1) or (x == -1 and 1) or (z ~= 0 and 0)
- Forward.x = (z == 1 and 1) or (z == -1 and -1) or (x ~= 0 and 0)
- end
- end
- function GetDirection()
- if Forward.x==1 then
- return "forward"
- elseif Forward.x==-1 then
- return "backwards"
- elseif Forward.z==1 then
- return "right"
- elseif Forward.z==-1 then
- return "left"
- end
- end
- function IsFull()
- local f = true
- for i = 1,16 do
- if turtle.getItemCount(i) == 0 then
- f=false
- end
- end
- return f
- end
- function Return()
- end
- function SetDirection(dir)
- local DIR = GetDirection()
- if DIR~=dir:lower() then
- local l,r = 0,0
- if DIR == "left" then
- l,r = ((dir=="backwards"and 1)or 0),((dir=="forward"and 1)or(dir=="right"and 2)or 0)
- elseif DIR == "right" then
- l,r = ((dir=="forward"and 1)or 0),((dir=="backwards"and 1)or(dir=="left"and 2)or 0)
- elseif DIR == "backwards" then
- l,r = ((dir=="right"and 1)or 0),((dir=="left"and 1)or(dir=="forward"and 2)or 0)
- elseif DIR == "forward" then
- l,r = ((dir=="left"and 1)or 0),((dir=="right"and 1)or(dir=="backwards"and 2)or 0)
- end
- for i = 1,r do shift("right") turtle.turnRight() end
- for i = 1,l do shift("left") turtle.turnLeft() end
- end
- end
- function Quarry(x,y,z)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement