-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: allow to rotate items in the InventoryHud #24
feat: allow to rotate items in the InventoryHud #24
Conversation
Followed skaldarnar's directions on how to implicate this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to test in-game.
src/main/java/org/terasology/rendering/nui/layers/hud/InventoryHud.java
Outdated
Show resolved
Hide resolved
SelectedInventorySlotComponent component = | ||
localPlayer.getCharacterEntity().getComponent(SelectedInventorySlotComponent.class); | ||
return (component.slot + offset) % 10; | ||
//return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that still required? if not please remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TargetSlotBinding
gives an error if it has no getter, but are you referring to the code inside the getter instead of the getter itself? If yes, I should look more into it because that code was suggested by skaldarnar, who looked into the binding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay after looking a bit into this, I believe it is needed because one might not need the new kind of quickslot mode. I did try to remove parts I thought might be unuseful, but kept getting an error message each time. I shall tag @skaldarnar to give a second opinion.
src/main/java/org/terasology/rendering/nui/layers/hud/InventoryHud.java
Outdated
Show resolved
Hide resolved
…yHud.java Co-authored-by: jdrueckert <[email protected]>
…efaniamak/Inventory into ring-format-quickslot-for-LaS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid the empty set
method instead of implementing the base interface Binding
you can extend the abstract class ReadOnlyBinding
- which only requires to implement the get
method.
The setter is just empty in that abstract class, i.e., it's exactly the same logic 😉
Associated PR: Terasology/LightAndShadow#123
Result
Quickslot item selection changes completely. The active item is now stable, while the inventory items at the quickslot rotate within it in a ring-like style.
Changes
The main head behind the changes is @skaldarnar, who gave me the steps on how to implement this method.
rotateItems
to set which quickslot version you wantTargetSlotBinding
which provides the above resultIf you want the correct format and order of the inventory items, please run the test alongside Terasology/LightAndShadow#123.
Shortcut file
Not sure this file was created automatically, or by mistake from me. I committed it in case it was automatically created, so to prevent failed tests.
How to test
Test UI screenshot
Left image: selected item A at the bottom
Right image: quickslot after scrolling once downwards; previously selected item A went at the top, and the selected item became the one which was above the previously selected item A.
Note: Below format is done by Terasology/LightAndShadow#123. If you run tests without that PR, the selected inventory item would be the top inventory item from quickslot, and the scrolling rotation will be inverted.