diff --git a/src/data/backwardsCompatibility/backwardsCompatibility.js b/src/data/backwardsCompatibility/backwardsCompatibility.js index 47ccd2b288ed4fa71568bd4d59ca1ca5dc5ac16d..40abd0c6db6bcbee5713a7bd7a9a61e9c6c1d171 100644 --- a/src/data/backwardsCompatibility/backwardsCompatibility.js +++ b/src/data/backwardsCompatibility/backwardsCompatibility.js @@ -1821,7 +1821,7 @@ App.Update.human = (actor, slaveType, node=undefined) => { } // traitor and boomerang slaves have a `missingParentTag` property, but other slaves shouldn't have it - if (key === "missingParentTag" && !["V.boomerangSlave", "V.traitor"].includes(slaveLoc)) { + if ("missingParentTag" in actor && !["V.boomerangSlave", "V.traitor"].includes(slaveLoc)) { App.Update.deleteProperties(actor, "missingParentTag"); } @@ -1837,11 +1837,14 @@ App.Update.human = (actor, slaveType, node=undefined) => { App.Update.deleteProperties(actor, ["growTime"]); // ----------------------------------- automated beyond this point ----------------------------------- - console.log(`Adding any missing properties to HumanState with ID: ${actor.ID}`); - const base = (actor.ID === -1) ? new App.Entity.PlayerState() : new App.Entity.SlaveState(); - const baseKeys = Object.keys(base); - _.merge(base, actor); // (deep) write values that are in actor to base overwritting as needed - actor = base; // set actor to base, now actor has any keys that it was missing from base + if (slaveType !== "hero") { + console.log(`Adding any missing properties to HumanState with ID: ${actor.ID}`); + const base = (actor.ID === -1) ? new App.Entity.PlayerState() : new App.Entity.SlaveState(); + _.merge(base, actor); // (deep) write values that are in actor to base overwritting as needed + actor = base; // set actor to base, now actor has any keys that it was missing from base + } + + const baseKeys = Object.keys((actor.ID === -1) ? new App.Entity.PlayerState() : new App.Entity.SlaveState()); console.log(`Checking HumanState with ID '${actor.ID}' for unexpected keys`); Object.keys(actor).forEach((key) => {