ComputerCraft

ComputerCraft

21M Downloads

Option to use fuel on turn-related functions

Tjstretchalot opened this issue · 18 comments

commented

(Feature request incoming)

Currently the turtle does not use fuel when turning, which prevents checking fuel to determine if a turn completes or not like you can with move. This makes persistence require gps as far as my research has shown, since the program can halt at any point when unloaded/terminated.

An option to use fuel when turning would be greatly appreciated!

commented

don't the turn functions return a boolean indicating success like the moving functions do?

commented
commented

if they always return true i would call that a bug, it should return false of failure or nothing on success and failure

commented

They do return true/false for success/failure, there's just nothing that can cause them to fail.

commented

You can keep track of the turtle's facing and override the turtle.turnRight and turtle.turnLeft functions to track facing.

commented

Nah

commented

@Tjstretchalot If I remember correctly, the turtle's information (including position and fuel levels) are only updated when the movement completes and the function returns. This means that unless you get REALLY unlucky timing, tracking based on the result of the turtle movement functions should always be accurate even with chunk/world unloads.

commented

The issue is closed, please take this discussion elsewhere, you're blowing
up my inbox
On 21 Jun 2016 8:57 p.m., "apemanzilla" [email protected] wrote:

@Tjstretchalot https://github.com/Tjstretchalot If I remember
correctly, the turtle's information (including position and fuel levels)
are only updated when the movement completes and the function returns. This
means that unless you get REALLY unlucky timing, tracking based on the
result of the turtle movement functions should always be accurate even with
chunk/world unloads.


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#110 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AB3bbEaBwSxKL606FhYmWS9zDCjDDGZJks5qOEIygaJpZM4I6WhK
.

commented

For future reference:
Image

commented

Hello dan200!

The problem arises when the turtle unloads. I am aware that you can normally track the state of a turtle by creating your own turn-related functions, however consider the following pseudo-code (simplified to get the point across):

Line A1: myOrientation = leftOf(myOrientation)
Line A2: saveOrientation()
Line A3: turtle.turnLeft()

Alternatively:

Line B1: turtle.turnLeft()
Line B2: myOrientation = leftOf(myOrientation)
Line B3: saveOrientation()

I am under the impression that since the turtle can be unloaded at any point in the program, it is possible that the turtle is unloaded after A2 but before A3. Similarly, it's possible the turtle is unloaded after B1 and before B3. Am I misunderstanding how the turtle behaves when unloaded?

Thank you for the mod either way dan200!

commented

I don't add many options to CC, because 99% of people play on the default configuration. If I added this option and made it default I would break a lot of existing code. If I added this option and didn't make it the default it would be a waste of time.

commented

what about the ability to add a listener function for when the computer shuts down? calling movement functions would cause an error and termination so the shutdown isn't blocked but it would allow quick writing of variables to a file

commented

No. I have higher priority things to spend my time on

commented

alright, we'll all stick to the gps then, thanks for your time and consideration

commented

That's what GPS is for. It's not ever difficult to set up now we have Ender Modems.

commented

true, ender modems make it so much easier, been able to take down some gps towers as a result :)

commented

Alright, I figured out how to mod computercraft to do it myself.

Thanks again!

commented

Modifying ComputerCraft is not allowed. Do not distribute your modified version.