[Feature] Improves ForeignDocumentUUIDArrayField for can use documents to update it.

Fixes #389
This commit is contained in:
Joaquin Pereyra 2025-08-15 15:13:44 -03:00
parent b3c0344b91
commit 30fc66b87d
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) {
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 });
};
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