This could be done in a couple of ways, and in fact all of these APIs may be needed:
Have an API to set the default slots and configure them. For instance:
paperdoll.register(config); // This could be a config of all possible parts/slots!
// or
paperdoll.setDefaultParts(config); // These are the default slots. Could be an object mapping slotnames to configs, or an array of slot names if they are registered.
// later
paperdoll.init(player);
(API name subject to change)
Where config is an object mapping slot names to their configuration.
Behind the scenes, this API would set up a standard set of properties on the characters metadata, recognized by paperdoll, something like:
```javascript
metadata: { slots: head: { /* etc */ }, torso: { /* etc */ }
Have an API to programmatically change the slots for a character. This could mean adding or removing a slot based on name, or replacing the slots completely:
// in an input event during character creation, or an NPC's spawn event handler...
paperdoll.remove(character, 'head'); // deletes character's head slot
paperdoll.add(character, 'proboscis'); // add a proboscis instead, assuming that proboscis was registered...
paperdoll.add(character, tentaclesConfig); // add tentacles based on a config object similar to above
// or
PaperDoll.replace(character, config); // This replaces the default slots with entirely new ones, config can be an object or an array of registered slot names.
Have a paperdoll behavior that handles all of this in .yaml
# npcs.yml
- id: tentacle-monster
# ...
behaviors:
paperdoll:
parts: ['tentacles', 'proboscis', 'torso'] # could also be a config object
This could be done in a couple of ways, and in fact all of these APIs may be needed:
// or
paperdoll.setDefaultParts(config); // These are the default slots. Could be an object mapping slotnames to configs, or an array of slot names if they are registered.
// later paperdoll.init(player);