I’m new to godot and was wondering what is a good way of storing and then loading a weapon in system which allows player to choose parts for their weapon. Like they choose handle then blade and other attachment.
However my problem isn’t about doing something like inventory. More like doing inventory with items that give you more inventory space, but when you clear one od those items, slots added by that exact object also are cleared.
Resources will be a big part of your system, but you’re asking for a huge system. You haven’t presented a significant portion of the work required to what you ask, so forum folk can only give very basic advice. Inventory systems are asked a lot here, maybe you can pull from other threads or tutorials.
Doing it with resources would still be optimal. A basic setup can be made with a single resource class that represents a part. It stores the part info (name, image etc), an array of references to other parts, and a limit of how many parts can be added. This allows for assembling “trees” of parts of any complexity.
Thanks to all of you guys. I think I now know how to do this.
I just didn’t thought about doing this like inventory with items that add additional slots and then storing it as a list of resources with saved parent instead of having wierd hierarchy so when item get destroyed its attachment can also be removed.
For anyone from future searching for answers:
Create slot based inventory with only one slot. Then create resources for parts with number and type off additional slots. At the end create script that creates new slots based on chosen part and saves part used to create that slot so when parenting part is changed its children part can be deleted.