From e6842c5e137b38d56aa4ca361f83eb39ee2a3ecd Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Tue, 9 Nov 2021 00:31:53 -0500 Subject: [PATCH] gate geneTherapy for sick and indentured slaves --- .../surgery/surgeryPassageExotic.js | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/facilities/surgery/surgeryPassageExotic.js b/src/facilities/surgery/surgeryPassageExotic.js index 29e99c9e661..df7cb0717b5 100644 --- a/src/facilities/surgery/surgeryPassageExotic.js +++ b/src/facilities/surgery/surgeryPassageExotic.js @@ -50,13 +50,12 @@ App.UI.surgeryPassageExotic = function(slave, refreshParent, cheat = false) { function geneTherapy() { const el = new DocumentFragment(); - const r = []; - const linkArray = []; if (slave.indentureRestrictions >= 1) { App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["choices", "note"]); } else if (slave.health.health < 0) { App.UI.DOM.appendNewElement("div", el, `${He}'s too unhealthy to undergo gene therapy`, ["choices", "note"]); } else { + const linkArray = []; if (V.arcologies[0].childhoodFertilityInducedNCSResearch === 1) { if (slave.geneMods.NCS === 0) { linkArray.push(App.Medicine.Surgery.makeLink( @@ -86,16 +85,16 @@ App.UI.surgeryPassageExotic = function(slave, refreshParent, cheat = false) { App.UI.DOM.appendNewElement("div", el, `${He} already is already immortal`, ["choices", "note"]); } } + App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices"); } - App.Events.addNode(el, r, "div"); - App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices"); el.append(retroVirus()); return el; function retroVirus() { const el = new DocumentFragment(); const slaveGeneList = App.UI.DOM.appendNewElement("ul", el); - const select = App.UI.DOM.appendNewElement("select", el); + const select = document.createElement("select"); + const canEditGenes = slave.indentureRestrictions === 0 && slave.health.health >= 0; select.classList.add("rajs-list"); const description = App.UI.DOM.appendNewElement("div", el, null); for (const gene in slave.geneticQuirks) { @@ -120,15 +119,20 @@ App.UI.surgeryPassageExotic = function(slave, refreshParent, cheat = false) { ) { continue; } - const choice = App.UI.DOM.appendNewElement("option", select, capFirstChar(geneData.title)); - choice.value = gene; - select.append(choice); + if (canEditGenes) { + const choice = App.UI.DOM.appendNewElement("option", select, capFirstChar(geneData.title)); + choice.value = gene; + select.append(choice); + } + } + if (canEditGenes) { + select.selectedIndex = -1; + select.onchange = () => { + // selectedGene = select.options[select.selectedIndex]; + jQuery(description).empty().append(describeGene(select.value)); + }; + el.append(select); } - select.selectedIndex = -1; - select.onchange = () => { - // selectedGene = select.options[select.selectedIndex]; - jQuery(description).empty().append(describeGene(select.value)); - }; return el; -- GitLab