mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 16:09:03 +01:00
Changed ItemLinksField makeup
This commit is contained in:
parent
600c08cb23
commit
30f31e77dd
13 changed files with 120 additions and 96 deletions
|
|
@ -4,15 +4,7 @@ export default class ItemLinksField extends foundry.data.fields.TypedObjectField
|
|||
* @param {DataFieldContext} [context] Additional context which describes the field
|
||||
*/
|
||||
constructor(options, context) {
|
||||
super(
|
||||
new foundry.data.fields.StringField({
|
||||
choices: CONFIG.DH.ITEM.itemLinkTypes,
|
||||
nullable: true,
|
||||
initial: null
|
||||
}),
|
||||
options,
|
||||
context
|
||||
);
|
||||
super(new foundry.data.fields.SetField(new foundry.data.fields.DocumentUUIDField()), options, context);
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
|
|
@ -24,15 +16,6 @@ export default class ItemLinksField extends foundry.data.fields.TypedObjectField
|
|||
* @param {Object} [value] The candidate object to be added.
|
||||
*/
|
||||
static validateKey(value) {
|
||||
const parsed = foundry.utils.parseUuid(value);
|
||||
if (!parsed || parsed.type !== foundry.documents.Item.documentName) return false;
|
||||
if (!foundry.data.validators.isValidId(parsed.documentId)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
_cast(value) {
|
||||
value = super._cast(value);
|
||||
return foundry.utils.flattenObject(value);
|
||||
return Boolean(CONFIG.DH.ITEM.itemLinkTypes[value]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue