diff --git a/src/npc/surgery/organFarm.js b/src/npc/surgery/organFarm.js index 80a88e9e7ec7aed24497fd4e267aa600c5d9a6ee..083b4d6b80b4c55d849ff306be889b1e122d1bda 100644 --- a/src/npc/surgery/organFarm.js +++ b/src/npc/surgery/organFarm.js @@ -1,9 +1,8 @@ /** * @param {App.Entity.SlaveState} slave - * @param {string} slaveString - variable that refers to the slave, usually "$activeSlave" * @returns {string} */ -App.Medicine.OrganFarm.growActions = function(slave, slaveString) { +App.Medicine.OrganFarm.growActions = function(slave) { const organOrder = App.Medicine.OrganFarm.organDisplayOrder; const O = App.Medicine.OrganFarm.Organs; @@ -39,7 +38,7 @@ App.Medicine.OrganFarm.growActions = function(slave, slaveString) { for (const organ of organOrder) { if (slaveOrgans[organ] === 0) { if (O[organ].canGrow()) { - grow += `<div><<link "${O[organ].name}" "Remote Surgery">><<run App.Medicine.OrganFarm.growOrgan(${slaveString}, "${organ}")>><</link>></div>`; + grow += `<div>${App.UI.link(O[organ].name, App.Medicine.OrganFarm.growOrgan, [slave, organ], "Remote Surgery")}</div>`; grow += `<div class="detail">Costs ${cashFormat(O[organ].cost)}${O[organ].tooltip !== "" ? ` and ${O[organ].tooltip}` : ""}.</div>`; } } else if (slaveOrgans[organ] > 0) { @@ -78,10 +77,9 @@ App.Medicine.OrganFarm.growOrgan = function(slave, organType) { /** * @param {App.Entity.SlaveState} slave - * @param {string} slaveString - variable that refers to the slave, usually "$activeSlave" * @returns {string} */ -App.Medicine.OrganFarm.implantActions = function(slave, slaveString) { +App.Medicine.OrganFarm.implantActions = function(slave) { let slaveOrgans = V.completedOrgans.filter(o => o.ID === slave.ID); if (slaveOrgans.length === 0) { return ""; } @@ -96,7 +94,8 @@ App.Medicine.OrganFarm.implantActions = function(slave, slaveString) { for (let i = 0; i < F.Organs[organ.type].implantActions.length; i++) { const action = F.Organs[organ.type].implantActions[i]; if (action.canImplant(slave)) { - lines.push(`<span class="detail">${action.tooltip === "" ? "" : `${capFirstChar(action.tooltip)}: `}</span>[[${action.name}|Surgery Degradation][App.Medicine.OrganFarm.implant(${slaveString}, "${organ.type}", ${i})]]`); + const implantLink = App.UI.link(action.name, App.Medicine.OrganFarm.implant, [slave, organ.type, i], "Surgery Degradation"); + lines.push(`<span class="detail">${action.tooltip === "" ? "" : `${capFirstChar(action.tooltip)}: `}</span>${implantLink}`); anyAction = true; break; // there can only be one implant action } else { @@ -117,7 +116,7 @@ App.Medicine.OrganFarm.implantActions = function(slave, slaveString) { if (anyAction) { r += " | "; } - r += `[[Discard|Remote Surgery][App.Medicine.OrganFarm.removeOrgan(${slaveString}, "${organ.type}")]]</div></div>`; + r += `${App.UI.link("Discard", App.Medicine.OrganFarm.removeOrgan, [slave, organ.type], "Remote Surgery")}</div></div>`; } return `The fabricator has completed ${slaveOrgans.length} organ(s):<div class="organContainer">${r}</div>`; @@ -187,20 +186,18 @@ App.Medicine.OrganFarm.getSortedOrgans = function(slave) { * Returns the full organ farm menu, hiding empty parts * * @param {App.Entity.SlaveState} slave - * @param {string} slaveString - variable that refers to the slave, usually "$activeSlave" * @return {string} */ -App.Medicine.OrganFarm.fullMenu = function(slave, slaveString) { +App.Medicine.OrganFarm.fullMenu = function(slave) { if (V.organFarmUpgrade >= 1 && slave.indentureRestrictions < 2) { - let r = ""; - let actions = App.Medicine.OrganFarm.growActions(slave, slaveString); + let actions = App.Medicine.OrganFarm.growActions(slave); if (actions !== "") { r += `<h3>Grow new organs</h3><div class="indent">${actions}</div>`; } - actions = App.Medicine.OrganFarm.implantActions(slave, slaveString); + actions = App.Medicine.OrganFarm.implantActions(slave); if (actions !== "") { r += `<h3>Implant organs</h3><div class="indent">${actions}</div>`; } diff --git a/src/uncategorized/remoteSurgery.tw b/src/uncategorized/remoteSurgery.tw index dafb80ff2e1e6d977f3a8c0c3ff3cc3f1a410495..dca5d3f72d51ef63c98a9d046b67a64867d0c62c 100644 --- a/src/uncategorized/remoteSurgery.tw +++ b/src/uncategorized/remoteSurgery.tw @@ -1726,7 +1726,7 @@ <</if>> </div> -<<print App.Medicine.OrganFarm.fullMenu($activeSlave, "$activeSlave")>> +<<print App.Medicine.OrganFarm.fullMenu($activeSlave)>> <<if $geneticMappingUpgrade >= 1>> <h3>Retro-virus treatments:</h3>