[Fix] Simplify GoldField by using DataField's built-in initial property

This commit is contained in:
Iohan Trézze 2026-06-06 15:07:51 -03:00
parent 83b25f4771
commit d0410304cf

View file

@ -116,7 +116,7 @@ class ResourcesField extends fields.TypedObjectField {
} }
class GoldField extends fields.SchemaField { class GoldField extends fields.SchemaField {
constructor({ initial, ...options } = {}) { constructor(options = {}) {
super( super(
{ {
coins: new fields.NumberField({ initial: 0, integer: true }), coins: new fields.NumberField({ initial: 0, integer: true }),
@ -126,18 +126,6 @@ class GoldField extends fields.SchemaField {
}, },
options options
); );
this._initialCallback = initial;
}
getInitialValue(data) {
if (this._initialCallback) {
try {
return this._initialCallback(data);
} catch {
/* settings not yet available */
}
}
return super.getInitialValue(data);
} }
} }