The current inventory component could be a valid argument for a constructor invocation but probably the way the component is used is not optimal in the first place
The logic of expanding the inventory to internal slots is 'logic' which could go in a system rather than a component.
If you really need large inventories, you could write something like:
Code:
"SizedInventory": {
"width"=10,
"height"=100
}
or:
Code:
"CustomInventory": {
"slots"=1000
}
Assumed you implement the required components.
On startup, we can convert the marker components to a inventory with entity-refs, lists, tables, etc. in an internal component by the system.
This would also separate the internal representation from the declaration.
Side note: Just some fast thoughts by looking at InventoryComponent and the player.prefab in the Core module deltas. No need to do it now or do it exactly this way
maybe I missed some stuff which already exists somewhere.
To sum this up for the topic: I think it is possible to set all fields in a component without a constructor and the need of a constructor could also be a design smell, that a component does more than just holding data.
Still open for discussion if a simple for loop is too much logic for a component