[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:
joaquinpereyra98 2025-08-17 13:55:33 -03:00 committed by GitHub
parent 16591cd327
commit 18b6194afe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -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.`
);
}
} }

View file

@ -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