peter-kish / gloot

A universal inventory system for the Godot game engine.
MIT License
658 stars 28 forks source link

How to rotate the holding item? #249

Closed Visnicio closed 2 months ago

Visnicio commented 2 months ago

I'm using a StackGrid type inventory but I dont seem to find any method that can return me the holding item so I can pass it to rotate_item

Theres only the get_selected_inventory_item in the control node but it does not return the holding item

Visnicio commented 2 months ago

image

peter-kish commented 2 months ago

Hi! Can you clarify what you mean by "holding item"? Is that item equipped in an item slot?

If it's the newly created item in _on_button_pressed() in your screenshot, you should be able to rotate it with inventory_manager.rotate_item(new_item).

Visnicio commented 2 months ago

sorry for the confusion, by "holding item" I mean the item that the player is currently dragging, I would like to be able to rotate the item while I'm dragging it in the inventory

peter-kish commented 2 months ago

Yeah, that is sadly not implemented in the current version. I will look into implementing something like CtrlInventoryGrid.get_grabbed_inventory_item() or similar. Then it will be just a matter of calling InventoryGrid.rotate_item(item) on it.

Visnicio commented 2 months ago

Nice, gonna wait patiently for the next update then :)