diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index 23bc8c11e70bbe17b61f8897eba29914393b7ecf..8d4b01837a85c33f2096f891012c5fb8d484dbd3 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -831,11 +831,7 @@ App.Data.resetOnNGPlus = { cumPipeline: 0, wcPiping: 0, burstee: 0, - slaveDeath: { - oldAge: [], - overdosed: [], - lowHealth: [] - }, + slaveDeath: new Map(), playerBred: 0, propOutcome: 0, EliteSires: ["crazy", "futa", "moves", "preggo", "quick", "virgin"], diff --git a/src/data/backwardsCompatibility/backwardsCompatibility.js b/src/data/backwardsCompatibility/backwardsCompatibility.js index d39d44c741284755beb08c8aff633742fa8f94d3..bb258db12d9a57cf4cc1fd68bddb0751b9173788 100644 --- a/src/data/backwardsCompatibility/backwardsCompatibility.js +++ b/src/data/backwardsCompatibility/backwardsCompatibility.js @@ -1145,11 +1145,7 @@ App.Update.globalVariables = function(node) { // Slave death if (!isNaN(V.slaveDeath)) { - V.slaveDeath = { - oldAge: [], - overdosed: [], - lowHealth: [] - }; + V.slaveDeath = new Map() } FacilityDatatypeCleanup(); diff --git a/src/endWeek/death.js b/src/endWeek/death.js index d1bd26a61a66d51c30ad6899c58366b1f40bed00..87d3da2de6df821eef954c3392623db3d5598606 100644 --- a/src/endWeek/death.js +++ b/src/endWeek/death.js @@ -1,23 +1,26 @@ -globalThis.planDeath = function(slave, reason) { - V.slaveDeath[reason].push(slave.ID); +/** + * + * @param {App.Entity.SlaveState} slave + * @param {"oldAge"|"overdosed"|"lowHealth"} deathType + */ +globalThis.planDeath = function(slave, deathType) { + V.slaveDeath.set(slave.ID, deathType); }; globalThis.allDeaths = function() { const el = new DocumentFragment(); - for (const deathType in V.slaveDeath) { - for (const id of V.slaveDeath[deathType]) { - const deceased = getSlave(id); - if (deceased) { - App.UI.DOM.appendNewElement("p", el, death(deceased, deathType)); - el.append(sectionBreak()); - removeSlave(deceased); - } + for (const [id, deathType] of V.slaveDeath) { + const deceased = getSlave(id); + if (deceased) { + App.UI.DOM.appendNewElement("p", el, death(deceased, deathType)); + el.append(sectionBreak()); + removeSlave(deceased); } - - V.slaveDeath[deathType] = []; } + V.slaveDeath = new Map(); + return el; function sectionBreak() { @@ -28,7 +31,7 @@ globalThis.allDeaths = function() { }; /** - * + * * @param {App.Entity.SlaveState} slave * @param {"oldAge"|"overdosed"|"lowHealth"} deathType */ @@ -169,11 +172,3 @@ globalThis.death = function(slave, deathType) { return el; }; - -globalThis.deathCheck = function() { - for (const deathType in V.slaveDeath) { - if (V.slaveDeath[deathType].length > 0) { - return true; - } - } -}; diff --git a/src/uncategorized/scheduledEvent.tw b/src/uncategorized/scheduledEvent.tw index 66f86f17f2d97c06f1db323f239a5a60cd3159cd..d496164f619d38e12a26af9f097e62eba25ab2ab 100644 --- a/src/uncategorized/scheduledEvent.tw +++ b/src/uncategorized/scheduledEvent.tw @@ -111,7 +111,7 @@ <<elseif ($burstee != 0)>> <<set $burst = 0>> <<goto "SE Burst">> -<<elseif (deathCheck())>> +<<elseif ($slaveDeath.size)>> <<goto "SE Death">> <<elseif ($birthee != 0)>> <<goto "SE Birth">>