From 2346a191e92152432c7688842134bbde8aac672c Mon Sep 17 00:00:00 2001
From: Arkerthan <arkerthan@gmail.com>
Date: Sun, 14 Apr 2019 21:31:59 +0200
Subject: [PATCH] arrays to objects

---
 src/init/setupVars.tw              | 53 +++++++++++-------------------
 src/init/storyInit.tw              | 13 ++++----
 src/interaction/cyberConfig.tw     | 50 +++++++++++++++++++---------
 src/interaction/researchLab.tw     | 26 +++++++--------
 src/js/SlaveState.js               |  4 +--
 src/uncategorized/remoteSurgery.tw | 16 ++++-----
 6 files changed, 83 insertions(+), 79 deletions(-)

diff --git a/src/init/setupVars.tw b/src/init/setupVars.tw
index d5a55c32b5f..a8c99ef9b9f 100644
--- a/src/init/setupVars.tw
+++ b/src/init/setupVars.tw
@@ -5,41 +5,26 @@
 */
 
 /* prosthetic stuff */
-<<set setup.prostheticIDs = {
-	interfaceP1: 0,
-	interfaceP2: 1,
-	basicL: 2,
-	sexL: 3,
-	beautyL: 4,
-	combatL: 5,
-	cyberneticL: 6,
-	ocular: 7,
-	cochlear: 8,
-	electrolarynx: 9,
-	interfaceTail: 10,
-	modT: 11,
-	combatT: 12,
-	sexT: 13,
-	erectile: 14
-}>>
+<<set setup.prostheticIDs = ["interfaceP1", "interfaceP2", "basicL", "sexL", "beautyL", "combatL", "cyberneticL", "ocular", "cochlear", "electrolarynx", "interfaceTail", "modT", "combatT", "sexT", "erectile"]>>
+
 /* 10 = 1 week at level 1*/
-<<set setup.prosthetics = [
-	{name: "Basic prosthetic interface", adjust: 40, craft: 50, research: 100, level: 1, costs: 5000},
-	{name: "Advanced prosthetic interface", adjust: 80, craft: 80, research: 160, level: 2, costs: 10000},
-	{name: "Basic prosthetic limbs", adjust: 40, craft: 40, research: 80, level: 1, costs: 7000},
-	{name: "Advanced sex limbs", adjust: 60, craft: 70, research: 140, level: 2, costs: 15000},
-	{name: "Advanced beauty limbs", adjust: 60, craft: 70, research: 140, level: 2, costs: 15000},
-	{name: "Advanced combat limbs", adjust: 60, craft: 70, research: 140, level: 2, costs: 15000},
-	{name: "Cybernetic limbs", adjust: 80, craft: 150, research: 250, level: 3, costs: 25000},
-	{name: "Ocular implant", adjust: 60, craft: 80, research: 150, level: 2, costs: 20000},
-	{name: "Cochlear implant", adjust: 40, craft: 40, research: 80, level: 1, costs: 5000},
-	{name: "Electrolarynx", adjust: 40, craft: 40, research: 40, level: 1, costs: 5000},
-	{name: "Prosthetic tail interface", adjust: 50, craft: 60, research: 120, level: 1, costs: 5000},
-	{name: "Modular tail", adjust: 40, craft: 40, research: 80, level: 1, costs: 5000},
-	{name: "Combat tail", adjust: 70, craft: 70, research: 140, level: 2, costs: 15000},
-	{name: "Pleasure Tail", adjust: 60, craft: 60, research: 120, level: 2, costs: 10000},
-	{name: "Erectile implant", adjust: 40, craft: 50, research: 100, level: 1, costs: 7000}
-]>>
+<<set setup.prosthetics = {
+	interfaceP1: {name: "Basic prosthetic interface", adjust: 40, craft: 50, research: 100, level: 1, costs: 5000},
+	interfaceP2: {name: "Advanced prosthetic interface", adjust: 80, craft: 80, research: 160, level: 2, costs: 10000},
+	basicL: {name: "Basic prosthetic limbs", adjust: 40, craft: 40, research: 80, level: 1, costs: 7000},
+	sexL: {name: "Advanced sex limbs", adjust: 60, craft: 70, research: 140, level: 2, costs: 15000},
+	beautyL: {name: "Advanced beauty limbs", adjust: 60, craft: 70, research: 140, level: 2, costs: 15000},
+	combatL: {name: "Advanced combat limbs", adjust: 60, craft: 70, research: 140, level: 2, costs: 15000},
+	cyberneticL: {name: "Cybernetic limbs", adjust: 80, craft: 150, research: 250, level: 3, costs: 25000},
+	ocular: {name: "Ocular implant", adjust: 60, craft: 80, research: 150, level: 2, costs: 20000},
+	cochlear: {name: "Cochlear implant", adjust: 40, craft: 40, research: 80, level: 1, costs: 5000},
+	electrolarynx: {name: "Electrolarynx", adjust: 40, craft: 40, research: 40, level: 1, costs: 5000},
+	interfaceTail: {name: "Prosthetic tail interface", adjust: 50, craft: 60, research: 120, level: 1, costs: 5000},
+	modT: {name: "Modular tail", adjust: 40, craft: 40, research: 80, level: 1, costs: 5000},
+	combatT: {name: "Combat tail", adjust: 70, craft: 70, research: 140, level: 2, costs: 15000},
+	sexT: {name: "Pleasure Tail", adjust: 60, craft: 60, research: 120, level: 2, costs: 10000},
+	erectile: {name: "Erectile implant", adjust: 40, craft: 50, research: 100, level: 1, costs: 7000}
+}>>
 /* prosthetic stuff end */
 
 /*** pregmod exclusive start ***/
diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw
index 0b0ab00d1fc..e534c55c5f7 100644
--- a/src/init/storyInit.tw
+++ b/src/init/storyInit.tw
@@ -1456,8 +1456,8 @@ You should have received a copy of the GNU General Public License along with thi
 
 <<set $prostheticsUpgrade = 0>>
 <<set $adjustProstheticsCompleted = 0>>
-<<set $adjustProsthetics = []>> /*format: {id: int, workleft: int, slaveID: int}*/
-/*task: {type: "research"/"craft", id: int, workLeft: int}*/
+<<set $adjustProsthetics = []>> /*format: {id: string, workleft: int, slaveID: int}*/
+/*task: {type: "research"/"craft", id: string, workLeft: int}*/
 <<set $researchLab = {
 	level: 0,
 	aiModule: 1,
@@ -1467,11 +1467,10 @@ You should have received a copy of the GNU General Public License along with thi
 	hired: 0,
 	menials: 0,
 }>>
-/*when adding new prosthetics do not leave spaces between the IDs */
-<<set $prosthetics = []>>
-<<for _i = 0; _i < 15; _i++>>
-	<<set $prosthetics.push({amount: 0, research: 0})>>
-<</for>>
+<<set $prosthetics = {}>>
+<<run setup.prostheticIDs.forEach(function (id) {
+	$prosthetics[id] = {amount: 0, research: 0};
+})>>
 /*
 <<set $limbsCompleted = 0>>    cybermod
 <<set $limbs = []>>*/
diff --git a/src/interaction/cyberConfig.tw b/src/interaction/cyberConfig.tw
index 161c9a12e32..4947cc921ff 100644
--- a/src/interaction/cyberConfig.tw
+++ b/src/interaction/cyberConfig.tw
@@ -145,25 +145,25 @@ This room is lined with shelves and cabinets, it could be easily mistaken for a
 		// $He must have a prosthetic interface installed to attach prosthetic limbs. //
 	<<else>>
 		/*TODO save .legsTat and .armsTat / link them to prosthetic*/
-		<<if $activeSlave.amp != -1 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == setup.prostheticIDs.basicL})>>
-			[[Attach <<print setup.prosthetics[setup.prostheticIDs.basicL].name>>|Prosthetics][$activeSlave.amp = -1, $prostheticsConfig = "basicPLimbs"]]
+		<<if $activeSlave.amp != -1 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "basicL"})>>
+			[[Attach <<print setup.prosthetics.basicL.name>>|Prosthetics][$activeSlave.amp = -1, $prostheticsConfig = "basicPLimbs"]]
 			<br>
 		<</if>>
-		<<if $activeSlave.amp != -2 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == setup.prostheticIDs.sexL})>>
-			[[Attach <<print setup.prosthetics[setup.prostheticIDs.sexL].name>>|Prosthetics][$activeSlave.amp = -1, $prostheticsConfig = "sexPLimbs"]]
+		<<if $activeSlave.amp != -2 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "sexL"})>>
+			[[Attach <<print setup.prosthetics.sexL.name>>|Prosthetics][$activeSlave.amp = -1, $prostheticsConfig = "sexPLimbs"]]
 			<br>
 		<</if>>
-		<<if $activeSlave.amp != -3 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == setup.prostheticIDs.beautyL})>>
-			[[Attach <<print setup.prosthetics[setup.prostheticIDs.beautyL].name>>|Prosthetics][$activeSlave.amp = -1, $prostheticsConfig = "beautyPLimbs"]]
+		<<if $activeSlave.amp != -3 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "beauty"})>>
+			[[Attach <<print setup.prosthetics.beautyL.name>>|Prosthetics][$activeSlave.amp = -1, $prostheticsConfig = "beautyPLimbs"]]
 			<br>
 		<</if>>
-		<<if $activeSlave.amp != -4 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == setup.prostheticIDs.combatL})>>
-			[[Attach <<print setup.prosthetics[setup.prostheticIDs.combatL].name>>|Prosthetics][$activeSlave.amp = -1, $prostheticsConfig = "combatPLimbs"]]
+		<<if $activeSlave.amp != -4 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "combatL"})>>
+			[[Attach <<print setup.prosthetics.combatL.name>>|Prosthetics][$activeSlave.amp = -1, $prostheticsConfig = "combatPLimbs"]]
 			<br>
 		<</if>>
-		<<if $activeSlave.amp != -5 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == setup.prostheticIDs.cyberneticL})>>
+		<<if $activeSlave.amp != -5 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "cyberneticL"})>>
 			<<if $activeSlave.amp == 2>>
-				[[Attach <<print setup.prosthetics[setup.prostheticIDs.basicL].name>>|Prosthetics][$activeSlave.amp = -1, $prostheticsConfig = "cyberPLimbs"]]
+				[[Attach <<print setup.prosthetics.basicL.name>>|Prosthetics][$activeSlave.amp = -1, $prostheticsConfig = "cyberPLimbs"]]
 			<<else>>
 				// $He must have an advanced prosthetic interface installed to attach cybernetic limbs. //
 			<</if>>
@@ -182,7 +182,7 @@ This room is lined with shelves and cabinets, it could be easily mistaken for a
 		$He currently has a tail attached, if you wish to change it you will first need to detach it.<br>
 		[[Detach|Prosthetics][$prostheticsConfig = "detachTail",$nextButton = "Continue", $nextLink = "Prosthetics"]]
 	<<else>><br>&nbsp;
-		<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == setup.prostheticIDs.modT})>>
+		<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "modT"})>>
 			Attach a modular tail designed to look like a:<br>
 			[[Cat's Tail|Prosthetics][$prostheticsConfig = "attachTail", $activeSlave.tail = "mod", $activeSlave.tailShape = "neko", $activeSlave.tailColor = $activeSlave.hColor]]
 			| [[Dog's Tail|Prosthetics][$prostheticsConfig = "attachTail", $activeSlave.tail = "mod", $activeSlave.tailShape = "inu", $activeSlave.tailColor = $activeSlave.hColor]]
@@ -192,10 +192,10 @@ This room is lined with shelves and cabinets, it could be easily mistaken for a
 			| [[Cow's Tail|Prosthetics][$prostheticsConfig = "attachTail", $activeSlave.tail = "mod", $activeSlave.tailColor = "ushi", $activeSlave.tailColor = $activeSlave.hColor]]
 			<br>
 		<</if>>
-		<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == setup.prostheticIDs.combatT})>>
+		<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "combatT"})>>
 			[[Attach Combat Tail|Prosthetics][$prostheticsConfig = "attachTail", $activeSlave.tail = "combat", $activeSlave.tailColor = "jet black"]]
 		<</if>>
-		<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == setup.prostheticIDs.sexT})>>
+		<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "sexT"})>>
 			| [[Attach Pleasure Tail|Prosthetics][$prostheticsConfig = "attachTail", $activeSlave.tail = "sex", $activeSlave.tailColor = "pink"]]
 		<</if>>
 	<</if>>
@@ -230,9 +230,29 @@ This room is lined with shelves and cabinets, it could be easily mistaken for a
 
 <br><br>
 Fit prosthetics to this slave:
+<<for _p range setup.prostheticIDs>>
+	<<if _p != "erectile">> /* exclude erectile implant */
+	<<if $adjustProsthetics.findIndex(function(p) {return p.id == _p && p.slaveID == $activeSlave.ID}) == -1 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == _p}) == -1 && setup.prosthetics[_p].level <= $prostheticsUpgrade>>
+	<br>
+	<<capture _p>>
+	<<if $prosthetics[_p].amount > 0>>
+		<<link "Fit a <<print addA(setup.prosthetics[_p].name)>> from storage to this slave" "Prosthetics">>
+			<<set $adjustProsthetics.push({id: _p, workLeft: setup.prosthetics[_p].adjust, slaveID: $activeSlave.ID}), $prosthetics[_p].amount -= 1>>
+		<</link>>
+	<<else>>
+		<<link "Buy and fit <<print addA(setup.prosthetics[_p].name)>> to this slave" "Prosthetics">>
+			<<set $adjustProsthetics.push({id: _p, workLeft: setup.prosthetics[_p].adjust, slaveID: $activeSlave.ID}), cashX(forceNeg(setup.prosthetics[_p].costs), "slaveMod", $activeSlave)>>
+			//Costs <<print cashFormat(setup.prosthetics[_p].costs)>>.//
+		<</link>>
+	<</if>>
+	<</capture>>
+	<</if>>
+	<</if>>
+<</for>>
+/*
 <<for _i = 0; _i < $prosthetics.length; _i++>>
 	<<if _i != setup.prostheticIDs.erectile>> /* exclude erectile implant */
-	<<if $adjustProsthetics.findIndex(function(p) {return p.id == _i && p.slaveID == $activeSlave.ID}) == -1 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == _i}) == -1>>
+/*	<<if $adjustProsthetics.findIndex(function(p) {return p.id == _i && p.slaveID == $activeSlave.ID}) == -1 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == _i}) == -1>>
 	<br>
 	<<capture _i>>
 	<<if $prosthetics[_i].amount > 0>>
@@ -248,7 +268,7 @@ Fit prosthetics to this slave:
 	<</capture>>
 	<</if>>
 	<</if>>
-<</for>>
+<</for>>*/
 
 /* base screen END */
 
diff --git a/src/interaction/researchLab.tw b/src/interaction/researchLab.tw
index 16bb6919013..95e8583d47f 100644
--- a/src/interaction/researchLab.tw
+++ b/src/interaction/researchLab.tw
@@ -159,18 +159,18 @@ __Research__
 <br><br>&nbsp;
 
 Available research projects:<br>
-<<for _i = 0; _i < $prosthetics.length; _i++>>
-	<<if $prosthetics[_i].research == 0>>
-		<<if _i != setup.prostheticIDs.erectile>> /*excludes erectile*/
-		<<if $researchLab.level >= setup.prosthetics[_i].level>>
+<<for _p range setup.prostheticIDs>>
+	<<if $prosthetics[_p].research == 0>>
+		<<if _p != setup.prostheticIDs.erectile>> /*excludes erectile*/
+		<<if setup.prosthetics[_p].level <= prostheticsUpgrade>>
 			<<capture _i>>
-			<<link "Reverse engineer <<print setup.prosthetics[_i].name>>" "Research Lab">>
-				<<set cashX(forceNeg(setup.prosthetics[_i].costs), "lab"), $prosthetics[_i].research = -1, $researchLab.tasks.push({type: "research", id: _i, workLeft: setup.prosthetics[_i].research})>>
+			<<link "Reverse engineer <<print setup.prosthetics[_p].name>>" "Research Lab">>
+				<<set cashX(forceNeg(setup.prosthetics[_p].costs), "lab"), $prosthetics[_p].research = -1, $researchLab.tasks.push({type: "research", id: _p, workLeft: setup.prosthetics[_p].research})>>
 			<</link>>
 			<</capture>>
 				//Costs <<print cashFormat(setup.prosthetics[_i].costs)>> of initial investment.//
 		<<else>>
-			//You need to upgrade the research lab before you can research advanced technologies.//
+			//You need better contracts to get the needed research material before you can research advanced technologies.//
 		<</if>>
 		<br>
 		<</if>>
@@ -182,12 +182,12 @@ __Manufacture__
 <br><br>&nbsp;
 
 Available building projects:<br>
-<<for _i = 0; _i < $prosthetics.length; _i++>>
-	<<if $prosthetics[_i].research == 1>>
-		<<if _i != setup.prostheticIDs.erectile>> /*excludes erectile*/
-		<<capture _i>>
-		<<link "Build <<print setup.prosthetics[_i].name>>" "Research Lab">>
-			<<set $researchLab.tasks.push({type: "craft", id: _i, workLeft: setup.prosthetics[_i].craft})>>
+<<for _p range setup.prostheticIDs>>
+	<<if $prosthetics[_p].research == 1>>
+		<<if _p != setup.prostheticIDs.erectile>> /*excludes erectile*/
+		<<capture _p>>
+		<<link "Build <<print setup.prosthetics[_p].name>>" "Research Lab">>
+			<<set $researchLab.tasks.push({type: "craft", id: _p, workLeft: setup.prosthetics[_p].craft})>>
 		<</link>>
 		<</capture>>
 		<br>
diff --git a/src/js/SlaveState.js b/src/js/SlaveState.js
index 2ebf03d7fd6..3b8326da533 100644
--- a/src/js/SlaveState.js
+++ b/src/js/SlaveState.js
@@ -2222,10 +2222,10 @@ App.Entity.SlaveState = class SlaveState {
 		 * Array that holds a slaves fitted prosthetics
 		 *
 		 * Elements of the array should be objects.
-		 * * .id: ID of the prosthetic
+		 * * .id: ID of the prosthetic, see setup.prostheticIDs
 		 * * .armsTat: any string, see.armsTat for standard strings
 		 * * .legsTat: any string, see.legsTat for standard strings
-		 * @type {Array.<{type:number, armsTat:string, legsTat:string}>} */
+		 * @type {Array.<{id:string, armsTat:string, legsTat:string}>} */
 		this.readyProsthetics = [];
 		/**  */
 		this.ageAdjust = 0;
diff --git a/src/uncategorized/remoteSurgery.tw b/src/uncategorized/remoteSurgery.tw
index ed7faf31c0c..934e52674b9 100644
--- a/src/uncategorized/remoteSurgery.tw
+++ b/src/uncategorized/remoteSurgery.tw
@@ -144,7 +144,7 @@ $His $activeSlave.faceShape face is
 				| [[Remove eyes|Surgery Degradation][$activeSlave.eyes = -4, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "remove eyes"]]
 				<<if ($activeSlave.eyes > -2)>>//This will greatly restrict $him//<</if>>
 			<</if>>
-			<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == $prosthetics.ocular}) != -1>>
+			<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "ocular"}) != -1>>
 				| [["Give " + $him + " ocular implants"|Surgery Degradation][$activeSlave.eyesImplant = 1, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "ocular implant"]]
 			<</if>>
 		<</if>>
@@ -281,7 +281,7 @@ $He has
 		<<if ($activeSlave.hears > -2)>>
 			| [[Deafen|Surgery Degradation][$activeSlave.hears = -2,cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 10,$surgeryType = "deafen"]]
 		<</if>>
-		<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == $prosthetics.cochlear}) != -1>>
+		<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "cochlear"}) != -1>>
 			| [["Give " + $him + " cochlear implants"|Surgery Degradation][$activeSlave.earImplant = 1, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "cochlear implant"]]
 		<</if>>
 	<</if>>
@@ -451,7 +451,7 @@ $He has
 		<<if $seeExtreme == 1>>
 			| [[Remove vocal cords|Surgery Degradation][$activeSlave.voice = 0, $activeSlave.voiceImplant = 0, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 10, $surgeryType = "mute"]]
 		<</if>>
-	<<elseif $activeSlave.electrolarynx == 0 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == $prosthetics.electrolarynx}) != -1>>
+	<<elseif $activeSlave.electrolarynx == 0 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "electrolarynx"}) != -1>>
 		[["Give " + $him + " an electrolarynx"|Surgery Degradation][$activeSlave.electrolarynx = 1, $activeSlave.voice = 2, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "electrolarynx"]]
 	<</if>>
 <</if>>
@@ -1685,27 +1685,27 @@ Work on $him structurally:
 
 <<if $activeSlave.amp == 0>>
 	<<if $activeSlave.indentureRestrictions < 1 && $seeExtreme == 1>>
-	<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == $prosthetics.interfaceP1}) == -1 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == $prosthetics.interfaceP2}) == -1>>
+	<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "interfaceP1"}) == -1 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "interfaceP2"}) == -1>>
 		[[Remove arms and legs|Surgery Degradation][$activeSlave.amp = 1,$activeSlave.heels = 0,$activeSlave.shoes = "none", $activeSlave.legAccessory = "none", $activeSlave.heightImplant = 0, $activeSlave.legsTat = 0, $activeSlave.armsTat = 0, $activeSlave.releaseRules = "restrictive", cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 40, $activeSlave.nails = 0, $surgeryType = "amp"]] //This will greatly restrict $him//
 	<<else>>
 		[[Remove arms and legs|Surgery Degradation][$activeSlave.amp = 1, $activeSlave.heels = 0, $activeSlave.shoes = "none", $activeSlave.legAccessory = "none", $activeSlave.heightImplant = 0, $activeSlave.legsTat = 0, $activeSlave.armsTat = 0, $activeSlave.releaseRules = "restrictive", cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 40, $activeSlave.nails = 0, $surgeryType = "amp1"]] //This will greatly restrict $him//
 	<</if>>
 	<</if>>
 <<elseif ($activeSlave.amp == 1) && ($activeSlave.PLimb == 0)>>
-	<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == $prosthetics.interfaceP1}) != -1>> |
+	<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "interfaceP1"}) != -1>> |
 		[[Install basic prosthetic interface|Surgery Degradation][$activeSlave.PLimb = 1, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "PLimb interface1"]]
 	<</if>>
-	<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == $prosthetics.interfaceP2}) != -1>> |
+	<<if $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "interfaceP2"}) != -1>> |
 		[[Install advanced prosthetic interface|Surgery Degradation][$activeSlave.PLimb = 2, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 20, $surgeryType = "PLimb interface2"]]
 	<</if>>
-<<elseif $activeSlave.amp == 1 && $activeSlave.PLimb == 1 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == $prosthetics.interfaceP2}) != -1>> |
+<<elseif $activeSlave.amp == 1 && $activeSlave.PLimb == 1 && $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "interfaceP2"}) != -1>> |
 	[[Upgrade advanced prosthetic interface|Surgery Degradation][$activeSlave.PLimb = 2, cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 5, $surgeryType = "PLimb interface3"]]
 <</if>>
 
 <br>&nbsp;&nbsp;&nbsp;&nbsp;
 <<if $activeSlave.PTail == 1>>
 	$He has a neural interface allowing attachment of tails.
-<<elseif $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == $prosthetics.interfaceTail}) != -1>>
+<<elseif $activeSlave.readyProsthetics.findIndex(function(p) {return p.id == "interfaceTail"}) != -1>>
 	$He lacks a neural interface allowing attachment of tails.
 	[[Implant interface|Surgery Degradation][$activeSlave.PTail = 1, $activeSlave.tail = "none", $activeSlave.tailColor = "none", cashX(forceNeg($surgeryCost), "slaveSurgery", $activeSlave), $activeSlave.health -= 10, $surgeryType = "tailInterface"]]
 <<else>>
-- 
GitLab