This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Blitzsy's profile picture

Turtle equipment slots and getEquippedSlots

Started by Blitzsy, 07 January 2016 - 12:07 AM
Blitzsy #1
Posted 07 January 2016 - 01:07 AM
While I was writing my own custom api to detect if a list of features is present ona computer, I noticed that there really isn't a good way to detect what a turtle currently has equipped to the left and right side unless you unequip it, check it, and then reequip it. I was wondering if it would be possible to add 2 slots to the turtle where it could keep the left and right equipped items that could be accessed through getEquippedLeft and getEquippedRight.
Lupus590 #2
Posted 07 January 2016 - 08:13 AM
What the turtle has equipped are normal peripherals, there is a function in the peripheral API which shows the names of the equipped/attched peripherals.
Blitzsy #3
Posted 07 January 2016 - 11:35 AM
What the turtle has equipped are normal peripherals, there is a function in the peripheral API which shows the names of the equipped/attched peripherals.

This doesn't account for things like tools, it only really works on a few upgrades, It would be nice if everything attached would show up there.
Edited on 07 January 2016 - 10:36 AM
Lupus590 #4
Posted 07 January 2016 - 11:39 AM
I guess they are not quite normal peripherals then, perhaps the peripheral API should be updated to provide this.
HPWebcamAble #5
Posted 20 January 2016 - 04:12 AM
Bump

It's a major flaw, since picks, axes, ect must be unequipped to get their name, but this requires a free slot
Lyqyd #6
Posted 20 January 2016 - 06:20 AM
IIRC, having a tool equipped on a side means that you cannot use a peripheral on that side, so it would seem logical for the peripheral getType call to return a string provided by the tool.