diff --git a/src/data/backwardsCompatibility/datatypeCleanup.js b/src/data/backwardsCompatibility/datatypeCleanup.js index c08fd9325c4e8f783d7e131888154c81c562239a..45bc576820f92932b41316e755add9611e6f5190 100644 --- a/src/data/backwardsCompatibility/datatypeCleanup.js +++ b/src/data/backwardsCompatibility/datatypeCleanup.js @@ -38,13 +38,14 @@ App.Entity.Utils.SlaveDataSchemeCleanup = (function() { function migrateHealth(slave) { if (typeof slave.health === "number") { const condition = slave.health; - slave.health = {}; - slave.health.condition = condition; - slave.health.shortDamage = 0; - slave.health.longDamage = 0; - slave.health.illness = 0; - slave.health.tired = 0; - slave.health.health = condition; + slave.health = { + condition: condition, + shortDamage: 0, + longDamage: 0, + illness: 0, + tired: 0, + health: condition + }; } } @@ -524,11 +525,7 @@ globalThis.SlaveDatatypeCleanup = (function SlaveDatatypeCleanup() { if (typeof slave.minorInjury !== "string") { slave.minorInjury = 0; } - if (typeof slave.health === "number") { - const condition = slave.health; - slave.health = {}; - slave.health.condition = condition; - } + slave.health.condition = Math.clamp(slave.health.condition, -100, 100) || 0; slave.health.shortDamage = Math.max(+slave.health.shortDamage, 0) || 0; slave.health.longDamage = Math.max(+slave.health.longDamage, 0) || 0;