New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add turtle.getEquipLeft() and turtle.getEquipRight() #462

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@Wilma456
Contributor

Wilma456 commented Sep 23, 2017

This functions allows you to get to equipped Item.

I know, this is already possible with unequip the Item, get Item Detail and reequip it. But the current methode has 2 Problems in my Opinion:

  1. The User see, that the Item is unequip and reequip.
  2. It will not work, if the Turtle had a full Inventory.
Add turtle.getEquipLeft() and turtle.getEquipRight()
This functions allows you to get to equipped Item.

I know, this is already possible with unequip the Item, get Item Detail and reequip it. But the current methode has 2 Problems in my Opinion:
1. The User see, that the Item is unequip and reequip.
2. It will not work, if the Turtle had a full Inventory.
@@ -446,6 +449,40 @@ else if( side.equalsIgnoreCase( "right" ) )
return new Object[] { null };
}
}
case 42:

This comment has been minimized.

@SquidDev

SquidDev Sep 23, 2017

Contributor

It'd probably be nicer to split this into a separate function so one is not duplicating functionality. Maybe do something like the main equip* functions, and create a separate TurtleGetEquipCommand class.

}
else
{
return new Object[] { null };

This comment has been minimized.

@Lignum

Lignum Sep 23, 2017

Contributor

It's probably nicer to just do return null;.

@Wilma456 Wilma456 referenced this pull request Oct 4, 2017

Open

Add turtle.getTurn() #473

@SquidDev

This comment has been minimized.

Contributor

SquidDev commented Dec 7, 2017

There's a bit of me which doesn't like leaking "internal" data such as upgrade IDs. I guess we already do this with speaker.playSound() and turtle.inspect() though so it's not the end of the world.

If we are adding this, would it also be worth adding such a method to the pocket API? This way we can keep the two libraries mostly in sync.

It might also be nice to have a program called something like upgrades which acts similarly to the existing peripherals: printing out the currently available upgrades.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment