mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
actions types - attack roll
This commit is contained in:
parent
4c7f3a02c4
commit
edaf5df9e0
35 changed files with 1015 additions and 165 deletions
11
module/data/fields/actionField.mjs
Normal file
11
module/data/fields/actionField.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { actionsTypes } from "../action/_module.mjs";
|
||||
|
||||
// Temporary Solution
|
||||
export default class ActionField extends foundry.data.fields.EmbeddedDataField {
|
||||
/** @override */
|
||||
initialize(value, model, options={}) {
|
||||
this.model = actionsTypes[value?.type] ?? actionsTypes.attack;
|
||||
this.fields = this._initialize(this.model.defineSchema());
|
||||
return super.initialize(value, model, options)
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ export default class ForeignDocumentUUIDField extends foundry.data.fields.Docume
|
|||
/**@override */
|
||||
initialize(value, _model, _options = {}) {
|
||||
if (this.idOnly) return value;
|
||||
return () => {
|
||||
return (() => {
|
||||
try {
|
||||
const doc = fromUuidSync(value);
|
||||
return doc;
|
||||
|
|
@ -32,7 +32,7 @@ export default class ForeignDocumentUUIDField extends foundry.data.fields.Docume
|
|||
console.error(error);
|
||||
return value ?? null;
|
||||
}
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
/**@override */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue