peter-kish / gloot

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

[3.0.0] Protosets inheritance and aggregation #227

Open Nordsoft91 opened 3 months ago

Nordsoft91 commented 3 months ago

When more and more items appear in the game, it become hard to support items, split them by groups, etc.

I suggest to introduce possibility to split protests on multiple files.

Inheritance

Inheritance could be extremely useful as it helps to set default set of parameters:

...
{
  "id": "armor_base",
  "type": "armor",
  "covers": ["body"],
  "defence": 1,
  "weight": 0
},
{
  "id": "leather_armor",
  "base": "armor_base", //takes parameters from base item, override specified only
  "defence": 3,
  "weight": 12
}
...

aggregation

may be not the best way to enable splitting protoset on several files, but one of them. structure and format may vary, again just one of possible options

{
  "version": "1.0.0" //json schema version
  "include": ["res://protosets/armors.json", "res://protosets/weapons.json"]
  "items":
  [
    {"id": "item1"}, {"id": "item2"} //inheritance should work for included items as well
  ]
}
peter-kish commented 3 months ago

I suggest to introduce possibility to split protests on multiple files

aggregation

Agreed. It shouldn't be too hard to implement, but I'd leave it for v.3.0.1 so I can focus on releasing v.3.0.0 sooner.

Inheritance

There's already something very similar to what you suggested in v3.0.0: https://github.com/peter-kish/gloot/tree/dev_v3.0.0?tab=readme-ov-file#prototype-inheritance.