Fix error in saving vehicle sheet;

By restricting unnatural logic to to unnatural sheets only
This commit is contained in:
jalensailin
2026-04-15 23:22:20 -04:00
parent 328c121e9b
commit 01cc0f9d08
+22
View File
@@ -63,6 +63,28 @@ export default class DGActorSheet extends DGSheetMixin(ActorSheetV2) {
},
});
/** @override */
async _processSubmitData(event, form, submitData, options) {
const submittedData = foundry.utils.expandObject(submitData);
if (this.actor.type !== "unnatural")
return super._processSubmitData(event, form, submittedData, options);
// we need to update max WP if POW has changed (only for unnatural, but doesn't hurt others)
submittedData.system.wp.maxNeedsUpdate =
submittedData.system?.statistics.pow.value !==
this.actor.system.statistics.pow.value;
// we need to update max HP if STR or CON have changed (only for unnatural, but doesn't hurt others)
submittedData.system.health.maxNeedsUpdate =
submittedData.system?.statistics.str.value !==
this.actor.system.statistics.str.value ||
submittedData.system?.statistics.con.value !==
this.actor.system.statistics.con.value;
return super._processSubmitData(event, form, submittedData, options);
}
/** @override */
async _prepareContext(options) {
const context = await super._prepareContext(options);