Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- h = vector.new(gps.locate(5)) or vector.new(0,0,0)
- a = {...}
- k=tonumber
- d = vector.new(k(a[1]),k(a[2]),k(a[3]))
- if a[4]=="r" then
- t = d
- else
- t=d-h
- end
- m=math.abs
- f=m(t.x)+m(t.y)+m(t.z)
- b=turtle
- e=b.forward
- n=b.turnRight
- o=b.turnLeft
- p=b.dig
- q=b.attack
- r=b.up
- s=b.down
- u=b.detect
- if b.getFuelLevel() < f then
- for i=1,16 do
- b.select(i)
- b.refuel()
- end
- end
- function w(l,h,d)
- for i=l,h do
- if u() then
- if not q() then
- p()
- end
- end
- d()
- end
- end
- function v()
- n()
- n()
- end
- if d.x>h.x then
- w(h.x,d.x,e)
- else
- v()
- w(d.x,h.x,e)
- v()
- end
- if d.y>h.y then
- n()
- w(h.y,d.y,e)
- o()
- else
- o()
- w(d.y,h.y,e)
- n()
- end
- if d.z>h.z then
- w(h.z,d.z,r)
- else
- w(d.z,h.z,s)
- end
Add Comment
Please, Sign In to add comment