From 4d67bef90366ac889ba0c60473ea92bcc7802047 Mon Sep 17 00:00:00 2001 From: supervj <64861570+supervj@users.noreply.github.com> Date: Tue, 16 Mar 2021 12:24:29 -0400 Subject: [PATCH] Update default values of temp data Update defaults to null from 0 to allow descriptor of fields to show Noted by Bacalla: https://discord.com/channels/727847839631278110/820388080123904050/820677484344246322 I followed suit from the HP model, need to test to make sure this doesn't break anything. All the code appears to default to 0 if it is null. --- module/actor/entity.js | 12 ++++++------ module/migration.js | 8 ++++---- template.json | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/module/actor/entity.js b/module/actor/entity.js index 27c3936f..733cf637 100644 --- a/module/actor/entity.js +++ b/module/actor/entity.js @@ -1256,14 +1256,14 @@ export default class Actor5e extends Actor { const dfp = data.attributes.force.points.max - data.attributes.force.points.value; const updateData = { "data.attributes.hp.value": data.attributes.hp.max, - "data.attributes.hp.temp": 0, - "data.attributes.hp.tempmax": 0, + "data.attributes.hp.temp": null, + "data.attributes.hp.tempmax": null, "data.attributes.tech.points.value": data.attributes.tech.points.max, - "data.attributes.tech.points.temp": 0, - "data.attributes.tech.points.tempmax": 0, + "data.attributes.tech.points.temp": null, + "data.attributes.tech.points.tempmax": null, "data.attributes.force.points.value": data.attributes.force.points.max, - "data.attributes.force.points.temp": 0, - "data.attributes.force.points.tempmax": 0 + "data.attributes.force.points.temp": null, + "data.attributes.force.points.tempmax": null }; // Recover character resources diff --git a/module/migration.js b/module/migration.js index 857fb9d6..60401489 100644 --- a/module/migration.js +++ b/module/migration.js @@ -366,16 +366,16 @@ function _migrateActorPowers(actorData, updateData) { updateData["data.attributes.force.points.value"] = 0; updateData["data.attributes.force.points.min"] = 0; updateData["data.attributes.force.points.max"] = 0; - updateData["data.attributes.force.points.temp"] = 0; - updateData["data.attributes.force.points.tempmax"] = 0; + updateData["data.attributes.force.points.temp"] = null; + updateData["data.attributes.force.points.tempmax"] = null; updateData["data.attributes.force.level"] = 0; updateData["data.attributes.tech.known.value"] = 0; updateData["data.attributes.tech.known.max"] = 0; updateData["data.attributes.tech.points.value"] = 0; updateData["data.attributes.tech.points.min"] = 0; updateData["data.attributes.tech.points.max"] = 0; - updateData["data.attributes.tech.points.temp"] = 0; - updateData["data.attributes.tech.points.tempmax"] = 0; + updateData["data.attributes.tech.points.temp"] = null; + updateData["data.attributes.tech.points.tempmax"] = null; updateData["data.attributes.tech.level"] = 0; } diff --git a/template.json b/template.json index 52ceebc8..685e65df 100644 --- a/template.json +++ b/template.json @@ -37,8 +37,8 @@ "value": 10, "min": 0, "max": 10, - "temp": 0, - "tempmax": 0 + "temp": null, + "tempmax": null }, "init": { "value": 0, @@ -103,8 +103,8 @@ "value": 0, "min": 0, "max": 0, - "temp": 0, - "tempmax": 0 + "temp": null, + "tempmax": null }, "level": 0 }, @@ -117,8 +117,8 @@ "value": 0, "min": 0, "max": 0, - "temp": 0, - "tempmax": 0 + "temp": null, + "tempmax": null }, "level": 0 }