r/ComputerCraft • u/Existing-Strength-21 • Nov 17 '24
Another TIOS (Turtle Input Output System) Update: Added loop commands to allow for easily executing complex behavior (info in comments)
22
Upvotes
View all comments
Show parent comment
2
u/fatboychummy Nov 17 '24 edited Nov 17 '24
I never worry about inspecting/detecting first, because some blocks the turtle can move through. You'd need to filter those out. Digging also does not mean there is no block in front anymore (falling blocks).
Just do something like
There is no "speed loss" from doing it this way, I've done it in all my programs since ages ago and it's exactly as fast as any other implementation. This impmementation also makes the turtle "gravel/sand-proof".
If there's a stack of a falling block in front of the turtle, normally the falling block will cause the turtle to fail to move. In this case, it'll clear the entire stack before moving.
Edit: The only issue this has is if the turtle runs into bedrock, it will freeze. I believe
turtle.digreturns astatus, errorMessagethough, so you could probably just check that, i.e: