-
Notifications
You must be signed in to change notification settings - Fork 117
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
Added Grid Inventory that can be enabled or disabled #194
Conversation
- Added size to InventoryItemPD - Added origin_index to InventorySlotPD to indicate reference point for where the item starts - Able to move a 2x2 battery around the grid so far
- Added Grid bool so grids can be turned on or off at the designers convenience - Hotbar is chosen by item order from top left to bottom right - Quantity, Ammo and item textures scale based on the grid size of the item - Green highlights if an object can be placed, yellow if it will swap out a colliding object, or red if it collides with multiple objects or doesn't fit - Should work with controller as well, but not fully tested
This is mighty impressive! Great job! Especially cool that it can really be toggled on/off with relative ease.
|
Thanks for the feedback! I'll take a look and investigate the items getting overriden issue and the hotbar slots. I'll also look into adding tooltips, although the inventory slots array should automatically get resized to fit the X and Y dimensions specified. I was meaning to hide that from the inspector since the starter inventory array would be the grid-agnostic replacement. |
The more I think about it, the more I feel like this could potentially be a permanent replacement of the "legacy" inventory system. I'd have to dive a bit deeper into the code and would like to give polishing the UI a shot, but here are my thoughts:
Let me know if and when you'll work on certain parts on this, 'cause I might want to push an update to this PR myself next week. 😇 |
- Hotbar should now work correctly in grid mode, added an array to keep track of which hotbar is assigned to which origin index - Added tooltips to grid bool and starter inventory to make it clear that interactables and player should both have enabled - Fixed larger items overriding bigger items by adding a pickup check to the is_enough_space() function which was unintentionally swapping the smaller item out into nothingness - Fixed an issue where "Take All" was throwing an index bounds error due to the source slot having its origin index changed. Made the parameter a duplicate to keep the original source index (darn pass-by-ref :|)
Hey, I've fixed the issues you mentioned, details of what broke and how I fixed it are in the commit details. I'll be away to London next week so any other feedback I can look into after I get back! |
- Updated inventory grid margins to 0 to make it look less "chopped up" - Updated some variable names to be more explicit (so many variables were just called size, I tried to differentiate them a bit more) - Added some input device checks to offer some QoL features like smoother grabbed items and info panel. - Made it so mouse ignores the grabbed item panel, making it feel nicer when moving items around. ISSUES: - Inventory Slot navigation with gamepad is borked. I'll have to look into exactly what causes this, as this seems new. Should be fixable though. Worst case we have to overwrite the focus navigation on runtime.
Hey y'all, I've taken a small dive into this and made some changes/updates. Mostly cleaned up some variable naming and added some QoL stuff. Overall I think it's shaping up really well and I'm confident we can put this into main soon. |
I'm still working on getting Read The Docs to build, so for now please ignore any errors that the check has failed from Read the Docs for the purpose of merging. |
Fixed the gamepad navigation for the grid inventory by manually setting the focus neighbors on instantiation of slots. One remaining cosmetic issue: When an item is being moved with the gamepad, the grabbed item icon always first moves to the center of the first slot (instead of the currently focused slot). As soon as the focus is moved the grabbed item positions correctly, so it is updated correctly, just that initial "pick up" seems off.
Pushed some updates and will now try to merge this into main. |
convenience
item
out a colliding object, or red if it collides with multiple objects
or doesn't fit