Created System Modules (markdown)

WBHarry 2026-03-11 11:25:07 +01:00
parent 57712ad342
commit c38c2ba0a0

54
System-Modules.md Normal file

@ -0,0 +1,54 @@
Various intended ways modules can alter the system.
## Custom Resources
In the `init` hook, you can register custom resources for characters. This is done by defining new key/object pairs on `CONFIG.DH.RESOURCE.character.custom`.
The data structure is:
```json
{
id - the resource key
initial - the initial numerical value of the resource (stress starts at 6 for instance)
max - the maximum numerical value the resource can reach
label - the label shown for the resource, preferably a i18n localizable string
}
```
Optionally, you can also define custom full and empty icons for the resource together with the above,
```json
{
images: {
full: {
value - the FontAwesome icon class or the filepath to the image if 'isIcon' is false
isIcon - if the image is a fontAwesome icon or an image in your filesystem
noColorFilter - normally a uniform color is applied to the image via a css filter. If you're using a non-transparent background or just don't want it, then set this to true
},
empty: {
value - see above
isIcon - see above
noColorFilter - see above
}
}
}
```
Example
```js
Hooks.once('init', () => {
CONFIG.DH.RESOURCE.character.custom.corruption = {
id: 'corruption',
initial: 0,
max: 4,
label: 'Corruption',
images: {
full: {
value: 'systems/daggerheart/assets/icons/domains/sage.svg',
isIcon: false
},
empty: {
value: 'systems/daggerheart/assets/icons/domains/sage.svg',
isIcon: false
}
}
};
}
```