Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x,y,z,dir=0,0,0,0
- fuelSlot=1
- function refuel()
- turtle.select(fuelSlot)
- turtle.refuel(1)
- end
- function forward()
- reussit=turtle.forward()
- if not reussit then
- if turtle.getFuelLevel()==0 then
- refuel()
- else
- turtle.dig()
- end
- reussit=turtle.forward()
- end
- if reussit then
- if dir==0 then
- x=x+1
- elseif dir==1 then
- y=y+1
- elseif dir==2 then
- x=x-1
- elseif dir==3 then
- y=y-1
- end
- end
- return reussit
- end
- function getPosition()
- return x,y,z,dir
- end
- function getX()
- return x
- end
- function getY()
- return y
- end
- function getZ()
- return z
- end
- function getDir()
- return dir
- end
- function reset()
- x,y,z,dir=0,0,0,0
- end
- function setFuelSlot(s)
- fuelSlot=s
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement