ComputerCraft

ComputerCraft

21M Downloads

[1.80pr0] Ghost turtle peripheral when moving

kovaxis opened this issue ยท 1 comments

commented

When a turtle-moving function is called from a sub-coroutine, turtle_response events are generated as usual, but I noticed there are also some "peripheral" and "peripheral_detach" events being generated from the side the turtle is moving towards. This phantom peripheral is of type "turtle", and has all normal turtle methods, almost like the turtle can see itself as a peripheral.
However, calling the getID() method on this peripheral gives a new ID, different from any other, just like if a new computer had been created.

To recreate, use MC 1.9.4/MC 1.10.2 and CC1.80pr0. Yes, it works in both MC versions.
Then download and run the code on the 'sGfyYhbb' pastebin. (This pastebin)

This code will call the turtle.up and turtle.down functions repeatedly while listening for events in another coroutine. Calling getID() before the peripheral is detached seems to be hard, so it's done immediately after the 'peripheral' event is received, and even then it works sometimes, so please be patient.

On CC1.79/MC1.8.9 this doesn't happen (only 'turtle_response' events are generated).

commented

Fixed. Thanks squiddev!