mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Changed so that Feature(Item) has a primary field
This commit is contained in:
parent
34ae1f56f6
commit
e9967a27ca
7 changed files with 29 additions and 32 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||
import ForeignDocumentUUIDField from '../fields/foreignDocumentUUIDField.mjs';
|
||||
import BaseDataItem from './base.mjs';
|
||||
|
||||
export default class DHAncestry extends BaseDataItem {
|
||||
|
|
@ -16,9 +15,15 @@ export default class DHAncestry extends BaseDataItem {
|
|||
static defineSchema() {
|
||||
return {
|
||||
...super.defineSchema(),
|
||||
features: new ForeignDocumentUUIDArrayField({ type: 'Item' }),
|
||||
primaryFeature: new ForeignDocumentUUIDField({ type: 'Item' }),
|
||||
secondaryFeature: new ForeignDocumentUUIDField({ type: 'Item' })
|
||||
features: new ForeignDocumentUUIDArrayField({ type: 'Item' })
|
||||
};
|
||||
}
|
||||
|
||||
get primaryFeature() {
|
||||
return this.features.find(x => x?.system?.primary) ?? (this.features.length > 0 ? {} : null);
|
||||
}
|
||||
|
||||
get secondaryFeature() {
|
||||
return this.features.find(x => !x?.system?.primary);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ export default class DHFeature extends BaseDataItem {
|
|||
type: new fields.StringField({ choices: CONFIG.DH.ITEM.featureTypes, nullable: true, initial: null }),
|
||||
originId: new fields.StringField({ nullable: true, initial: null }),
|
||||
identifier: new fields.StringField(),
|
||||
actions: new fields.ArrayField(new ActionField())
|
||||
actions: new fields.ArrayField(new ActionField()),
|
||||
primary: new fields.BooleanField({ nullable: true, initial: null })
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue