Add turtle.getTurn() #473
Add turtle.getTurn() #473
Conversation
It might be worth looking at the discussion in #383. I'm won't re-iterate what was said there, but it does highlight some conceptual problems with such a function. |
What essentially was said in that PR was turtles having the ability to get their direction is giving them "magic" knowledge. And I have to agree with this, this doesn't seem like something that belongs in a turtle, as they don't have any sort of "compass" built in. Think of it this way: a player get's teleported randomly in a radius 10000 blocks away from his base, and has to find his way back. Assuming the player is unfamiliar with the land around him, how is he supposed to know which way to start walking? Players aren't given a direction unless they open the debug screen, which is comparable to a GPS. And even then, the player has to do some small movements to figure out which way is +X, and +Z (the rest from there can be assumed). One of the things brought up in #383 was turtles should be able to do what players can do, I.E. read a compass. And I absolutely agree with this. If a player can get their direction just by looking at a compass, then so should a turtle. So what I would recommend is turning a compass into a peripheral, and THEN if it is equipped, provide this as a method (and maybe a EDIT: |
I don't support this, getting a turtle orientation pretty much falls in the same category as getting a turtle coordinate, which you can only get with GPS. |
Without GPS and since ComputerCraft 1.76 you can get Direction of a Turtle, by placing a block with facing block.state and then inspect it : ex: |
Two parts:
..1.. |
Can one of the admins verify this patch? |
With this function you can get the Direction of a Turtle. The return value is a number, because it can be used in Loops. Here are the return value:
1
4 2
3
Note:
This is not compatible to #462. If it get merged, I will change case 42 to case 44.