diff --git a/src/facilities/incubator/incubatorInteract.js b/src/facilities/incubator/incubatorInteract.js index d2d1ca72247a3bf6f0a3e93ec1cc79d0e83c364d..af2756eb46b9dd9549e1f036c1c1d996940e58f0 100644 --- a/src/facilities/incubator/incubatorInteract.js +++ b/src/facilities/incubator/incubatorInteract.js @@ -12,6 +12,7 @@ App.UI.incubator = function() { V.reservedChildrenNursery = FetusGlobalReserveCount("nursery"); let linkArray = []; + let tankOrgans = {}; const el = new DocumentFragment(); const _SL = V.slaves.length; let _eligibility = 0; @@ -961,7 +962,7 @@ App.UI.incubator = function() { if ((V.incubatorUpgradeOrgans === 1) && (V.tanks[i].tankBaby !== 3)) { r = []; r.push(`You can extract a sample and prepare a new organ for ${him} to be implanted once ${he} exits ${his} tank.`); - V.tankOrgans = { // Global to survive refresh. Can be improved + tankOrgans = { ovaries: 0, penis: 0, testicles: 0, @@ -972,22 +973,22 @@ App.UI.incubator = function() { for (let _i = 0; _i < V.incubatorOrgans.length; _i++) { if (V.tanks[i].ID === V.incubatorOrgans[_i].ID) { if (V.incubatorOrgans[_i].type === "ovaries") { - V.tankOrgans.ovaries = 1; + tankOrgans.ovaries = 1; } if (V.incubatorOrgans[_i].type === "testicles") { - V.tankOrgans.testicles = 1; + tankOrgans.testicles = 1; } if (V.incubatorOrgans[_i].type === "penis") { - V.tankOrgans.penis = 1; + tankOrgans.penis = 1; } if (V.incubatorOrgans[_i].type === "rightEye") { - V.tankOrgans.rightEye = 1; + tankOrgans.rightEye = 1; } if (V.incubatorOrgans[_i].type === "leftEye") { - V.tankOrgans.leftEye = 1; + tankOrgans.leftEye = 1; } if (V.incubatorOrgans[_i].type === "voicebox") { - V.tankOrgans.voicebox = 1; + tankOrgans.voicebox = 1; } } } @@ -1001,7 +1002,7 @@ App.UI.incubator = function() { linkArray = []; if (V.tanks[i].ovaries === 0) { - if (V.tankOrgans.ovaries !== 1) { + if (tankOrgans.ovaries !== 1) { linkArray.push( makeLink( "Prepare ovaries", @@ -1016,7 +1017,7 @@ App.UI.incubator = function() { } } if (V.tanks[i].dick === 0) { - if (V.tankOrgans.penis !== 1) { + if (tankOrgans.penis !== 1) { linkArray.push( makeLink("Prepare penis", () => { App.Medicine.OrganFarm.growIncubatorOrgan(V.tanks[i], "penis"); }, refresh) ); @@ -1025,7 +1026,7 @@ App.UI.incubator = function() { } } if (V.tanks[i].balls === 0) { - if (V.tankOrgans.testicles !== 1) { + if (tankOrgans.testicles !== 1) { linkArray.push(makeLink("Prepare testicles", () => { App.Medicine.OrganFarm.growIncubatorOrgan(V.tanks[i], "testicles"); }, refresh)); } else { linkArray.push(App.UI.DOM.makeElement("span", `Testicles are already prepared.`, "detail")); @@ -1043,10 +1044,10 @@ App.UI.incubator = function() { } else { linkArray.push(App.UI.DOM.makeElement("span", `${He} appears to be blind in ${his} right eye:`)); } - if (vision.left === 0 && V.tankOrgans.leftEye !== 1) { + if (vision.left === 0 && tankOrgans.leftEye !== 1) { linkArray.push(makeLink("Prepare left eye", () => { App.Medicine.OrganFarm.growIncubatorOrgan(V.tanks[i], "leftEye"); }, refresh)); } - if (vision.right === 0 && V.tankOrgans.rightEye !== 1) { + if (vision.right === 0 && tankOrgans.rightEye !== 1) { linkArray.push(makeLink("Prepare right eye", () => { App.Medicine.OrganFarm.growIncubatorOrgan(V.tanks[i], "rightEye"); }, refresh)); } if (vision.left === 0 && vision.right === 0 && linkArray.length === 2) { @@ -1063,9 +1064,9 @@ App.UI.incubator = function() { } if (vision.left === 0 && vision.right === 0 && linkArray.length === 0) { linkArray.push(App.UI.DOM.makeElement("span", `Both eyes are already prepared.`, `detail`)); - } else if (V.tankOrgans.leftEye === 1) { + } else if (tankOrgans.leftEye === 1) { linkArray.push(App.UI.DOM.makeElement("span", `A left eye is already prepared.`, `detail`)); - } else if (V.tankOrgans.rightEye === 1) { + } else if (tankOrgans.rightEye === 1) { linkArray.push(App.UI.DOM.makeElement("span", `A right eye is already prepared.`, `detail`)); } } @@ -1073,7 +1074,7 @@ App.UI.incubator = function() { if (V.tanks[i].voice === 0) { r = []; r.push(`${He} appears to be mute: `); - if (V.tankOrgans.voicebox !== 1) { + if (tankOrgans.voicebox !== 1) { r.push(makeLink("Prepare vocal cords", () => { App.Medicine.OrganFarm.growIncubatorOrgan(V.tanks[i], "voicebox"); }, refresh)); } else { r.push(App.UI.DOM.makeElement("span", `Vocal cords are already prepared.`, `detail`));