peter-kish / gloot

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

Added InventoryGrid via code cannot be transferred items into from another inventory, unlike InventoryGrid added in the scene manually #252

Open ThePiroman opened 1 week ago

ThePiroman commented 1 week ago

Look, maybe i am not getting something, but here: When i interact with the container, it adds a new InventoryGrid node to my Inventory HUD scene, it is functional, i can transfer and move the items IN the inventory, but i can't move them to the player's inventory and vice versa. That issue dissapears when i add it in the Godot itself, manually.

peter-kish commented 1 week ago

I think I need a bit more information on this... So you're only working with InventoryGrids and no CtrlInventoryGrid, right? And you're also moving the items to/from the inventories via code?

Do you have some example that demonstrates this issue?

ThePiroman commented 1 week ago

Yeah, i just reread my message and indeed i should describe it just a litle bit better. So, i have a Container scene. It contains the mesh and the InventoryGrid node. When interacted with by the player, it calls the player's function open_inventory() and also stores the InventoryGrid in a separate variable that the player has, "container_inventory". "open_inventory()" reveals player's InventoryHUD scene, that has CtrlInventoryGridEx WITH Inventory Path and also the other CtrlInventoryGridEx WITHOUT Inventory Path. Then, it adds container_inventory as a child to the InventoryHUD scene, and set the CtrlInventoryGridEx's Inventory Path to it. Problem raises there: you can't move the items manually, in game, not via code, in the other inventory. Items will just return to their original spot. The problem is gone if you set up the Inventory in Godot itself. I could provide an example in the video format. Please, tell me how do you want me to share it with you.

peter-kish commented 6 days ago

Do the items in the CtrlInventoryGridEx that represents the container render correctly? The way I understand it you are able to drag the items around but not DROP them to a new spot, right? Sometimes transparent UI controls prevent other UI controls from being clicked if they are located on top of them, which is not always obvious.

A video can help (you can try to drag and drop it onto the text box on this page) but I was hoping more for a minimal reproducible example because it's hard to diagnose a problem without knowing the details of a whole project.

ThePiroman commented 3 days ago

Items in CtrlInventoryGridEx render correctly, yes. When i put them in another inventory, the space below them is colored white, like i can put in there, but it keeps tossing them for their original spot. Funny thing is: while i was preparing the MRE, i was basically clearing up some of the stuff and somehow made it work! I don't know what caused it to work, i was just deleting files and changing the item protoset. (I changed items id, icons and custom properties that i added) I am now quite confused on what to do.

peter-kish commented 1 day ago

I suggest we close the issue for now... Feel free to reopen it if you notice the problem again or if you come up with additional info about it.

ThePiroman commented 20 hours ago

Allright. I'll try to figure out things on my own. Thank your for your time!