From 87119423fb941baff9d4408efa369066c1d493e7 Mon Sep 17 00:00:00 2001 From: franklygeorge <54015-franklygeorge@users.noreply.gitgud.io> Date: Thu, 18 Apr 2024 15:41:42 -0400 Subject: [PATCH] BC Fixes --- .../backwardsCompatibility.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/data/backwardsCompatibility/backwardsCompatibility.js b/src/data/backwardsCompatibility/backwardsCompatibility.js index 47ccd2b288e..40abd0c6db6 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) => { -- GitLab