mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
[Feature] Improves ForeignDocumentUUIDArrayField for can use documents to update it. (#963)
Fixes #389 Co-authored-by: Joaquin Pereyra <joaquinpereyra98@users.noreply.github.com>
This commit is contained in:
parent
16591cd327
commit
18b6194afe
2 changed files with 10 additions and 1 deletions
|
|
@ -38,4 +38,13 @@ export default class ForeignDocumentUUIDField extends foundry.data.fields.Docume
|
||||||
toObject(value) {
|
toObject(value) {
|
||||||
return value?.uuid ?? value;
|
return value?.uuid ?? value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @override */
|
||||||
|
_cast(value) {
|
||||||
|
if (typeof value === 'string') return value;
|
||||||
|
if (value instanceof foundry.abstract.Document) return value.uuid;
|
||||||
|
throw new Error(
|
||||||
|
`The value provided to a ForeignDocumentUUIDField must be a ${foundry.abstract.Document.name} instance or a UUID string.`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ Roll.replaceFormulaData = function (formula, data = {}, { missing, warn = false
|
||||||
return nativeReplaceFormulaData(formula, data, { missing, warn });
|
return nativeReplaceFormulaData(formula, data, { missing, warn });
|
||||||
};
|
};
|
||||||
|
|
||||||
foundry.dice.terms.Die.MODIFIERS.sc = 'selfCorrecting';
|
foundry.utils.setProperty(foundry, 'dice.terms.Die.MODIFIERS.sc', 'selfCorrecting');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the configured value as result if 1 is rolled
|
* Return the configured value as result if 1 is rolled
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue