mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-08 13:48:11 +02:00
[Fix] Simplify GoldField by using DataField's built-in initial property
This commit is contained in:
parent
83b25f4771
commit
d0410304cf
1 changed files with 1 additions and 13 deletions
|
|
@ -116,7 +116,7 @@ class ResourcesField extends fields.TypedObjectField {
|
|||
}
|
||||
|
||||
class GoldField extends fields.SchemaField {
|
||||
constructor({ initial, ...options } = {}) {
|
||||
constructor(options = {}) {
|
||||
super(
|
||||
{
|
||||
coins: new fields.NumberField({ initial: 0, integer: true }),
|
||||
|
|
@ -126,18 +126,6 @@ class GoldField extends fields.SchemaField {
|
|||
},
|
||||
options
|
||||
);
|
||||
this._initialCallback = initial;
|
||||
}
|
||||
|
||||
getInitialValue(data) {
|
||||
if (this._initialCallback) {
|
||||
try {
|
||||
return this._initialCallback(data);
|
||||
} catch {
|
||||
/* settings not yet available */
|
||||
}
|
||||
}
|
||||
return super.getInitialValue(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue