From eb2aa5a33fbe4223122eb0ba13fe55b0042c09dd Mon Sep 17 00:00:00 2001
From: DCoded <dcoded@live.com>
Date: Sun, 11 Oct 2020 12:38:27 -0400
Subject: [PATCH] Replaced active* animal variables with active.*

---
 sanityCheck.sh                             |  2 +-
 src/facilities/farmyard/animals/animals.js |  6 +--
 src/facilities/farmyard/farmyard.js        |  1 +
 src/facilities/pit/pit.js                  |  8 +--
 src/facilities/pit/pitAnimals.js           | 60 +++++++++++-----------
 src/interaction/siWork.js                  | 12 ++---
 src/npc/children/childInteract.tw          | 12 ++---
 src/npc/interaction/fAnimal.js             | 50 ++++++++----------
 8 files changed, 71 insertions(+), 80 deletions(-)

diff --git a/sanityCheck.sh b/sanityCheck.sh
index 0b793fee70c..f0d3b9bcc8f 100755
--- a/sanityCheck.sh
+++ b/sanityCheck.sh
@@ -40,7 +40,7 @@ $GREP -e "<<.*[(][^<>)]*[(][^<>)]*)\?[^<>)]*>>" -- "src/*" | myprint "MissingClo
 # Check for too many >>>.  e.g.: <</if>>>
 $GREP "<<[^<>]*[<>]\?[^<>]*>>>" -- "src/*.tw" | myprint "TooManyAngleBrackets"
 # Check for wrong capitalization on 'activeslave' and other common typos
-$GREP -e "\$act" --and --not -e "\$\(activeSlave\|activeChild\|activeArcology\|activeOrgan\|activeLimbs\|activeUnits\|activeCanine\|activeHooved\|activeFeline\|activeLurcher\)" -- "src/*" | myprint "WrongCapitalization"
+$GREP -e "\$act" --and --not -e "\$\(activeSlave\|activeChild\|activeArcology\|activeOrgan\|activeLimbs\|activeUnits\|activeLurcher\)" -- "src/*" | myprint "WrongCapitalization"
 # Check for strange spaces e.g.  $slaves[$i]. lips
 $GREP "\$slaves\[\$i\]\. " -- 'src/*' | myprint "MissingPropertyAfterSlaves"
 # Check using refreshmentType instead of refreshment
diff --git a/src/facilities/farmyard/animals/animals.js b/src/facilities/farmyard/animals/animals.js
index eae64df26cf..0fcc1084fd8 100644
--- a/src/facilities/farmyard/animals/animals.js
+++ b/src/facilities/farmyard/animals/animals.js
@@ -58,7 +58,7 @@ App.Facilities.Farmyard.animals = function() {
 
 		App.UI.DOM.appendNewElement("span", canineDiv, 'Dogs', "farmyard-animal-type");
 
-		canineDiv.append(hr, animalList("canine", "domestic", 5000, "activeCanine"));
+		canineDiv.append(hr, animalList("canine", "domestic", 5000, "canine"));
 
 		return canineDiv;
 	}
@@ -101,7 +101,7 @@ App.Facilities.Farmyard.animals = function() {
 
 		App.UI.DOM.appendNewElement("span", canineDiv, 'Canines', "farmyard-animal-type");
 
-		canineDiv.append(hr, animalList("canine", "exotic", 50000, "activeCanine"));
+		canineDiv.append(hr, animalList("canine", "exotic", 50000, "canine"));
 
 		return canineDiv;
 	}
@@ -179,7 +179,7 @@ App.Facilities.Farmyard.animals = function() {
 				optionSpan = document.createElement("span");
 
 			optionSpan.append(animalLink(filteredArray[i], active, type, price, () => {
-				V[`${active}`] = filteredArray[i];
+				V.active[active] = filteredArray[i];
 			}, () => {
 				cashX(forceNeg(price), "farmyard");
 				filteredArray[i].purchase();
diff --git a/src/facilities/farmyard/farmyard.js b/src/facilities/farmyard/farmyard.js
index 4d5597854b9..8a218744b2f 100644
--- a/src/facilities/farmyard/farmyard.js
+++ b/src/facilities/farmyard/farmyard.js
@@ -157,6 +157,7 @@ App.Facilities.Farmyard.farmyard = function() {
 			};
 
 			clearAnimalsPurchased();
+			// @ts-ignore
 			App.Arcology.cellUpgrade(V.building, App.Arcology.Cell.Manufacturing, "Farmyard", "Manufacturing");
 		}));
 
diff --git a/src/facilities/pit/pit.js b/src/facilities/pit/pit.js
index 1c223828f42..91021aa87d0 100644
--- a/src/facilities/pit/pit.js
+++ b/src/facilities/pit/pit.js
@@ -128,7 +128,7 @@ App.Facilities.Pit.pit = function() {
 
 		const links = [];
 
-		if (S.Bodyguard || V.activeCanine || V.activeHooved || V.activeFeline) {
+		if (S.Bodyguard || V.active.canine || V.active.hooved || V.active.feline) {
 			if (V.pit.bodyguardFights) {
 				mainDiv.append(`Your bodyguard ${S.Bodyguard.slaveName} will fight a slave selected from the pool at random.`);
 
@@ -137,13 +137,13 @@ App.Facilities.Pit.pit = function() {
 					V.pit.animal = null;
 
 					if (V.pit.fighterIDs.includes(V.BodyguardID)) {
-						V.pit.fighterIDs.delete(V.BodyguardID);
+						V.pit.fighterIDs.splice(V.pit.fighterIDs.indexOf(V.BodyguardID), 1);
 					}
 
 					App.UI.DOM.replace(mainDiv, fighters);
 				}));
 
-				// if (V.activeCanine || V.activeHooved || V.activeFeline) {
+				// if (V.active.canine || V.active.hooved || V.active.feline) {
 				// 	links.push(App.UI.DOM.link("Have a slave fight an animal", () => {
 				// 		V.pit.bodyguardFights = false;
 				// 		V.pit.animal = null;
@@ -186,7 +186,7 @@ App.Facilities.Pit.pit = function() {
 						);
 					}
 
-					// if (V.activeCanine || V.activeHooved || V.activeFeline) {
+					// if (V.active.canine || V.active.hooved || V.active.feline) {
 					// 	links.push(
 					// 		App.UI.DOM.link("Have a slave fight an animal", () => {
 					// 			V.pit.bodyguardFights = false;
diff --git a/src/facilities/pit/pitAnimals.js b/src/facilities/pit/pitAnimals.js
index 8f364559b04..559d5a6b67a 100644
--- a/src/facilities/pit/pitAnimals.js
+++ b/src/facilities/pit/pitAnimals.js
@@ -2,15 +2,15 @@ App.Facilities.Pit.animals = function() {
 	const frag = new DocumentFragment();
 	const cat = "cat";
 
-	if (V.activeCanine) {
+	if (V.active.canine) {
 		frag.append(canineSelect());
 	}
 
-	if (V.activeHooved) {
+	if (V.active.hooved) {
 		frag.append(hoovedSelect());
 	}
 
-	if (V.activeFeline) {
+	if (V.active.feline) {
 		frag.append(felineSelect());
 	}
 
@@ -22,8 +22,8 @@ App.Facilities.Pit.animals = function() {
 
 	function canineSelect() {
 		const mainDiv = document.createElement("div");
-		const nameSpan = App.UI.DOM.makeElement("span", `${V.activeCanine.name}.`, "bold");
-		const noteSpan = App.UI.DOM.makeElement("span", `${V.activeCanine.name}s are too small for a proper fight`, "note");
+		const nameSpan = App.UI.DOM.makeElement("span", `${V.active.canine.name}.`, "bold");
+		const noteSpan = App.UI.DOM.makeElement("span", `${V.active.canine.name}s are too small for a proper fight`, "note");
 
 		let animalEligible;
 		let an;
@@ -32,7 +32,7 @@ App.Facilities.Pit.animals = function() {
 			an = V.pit.animal.articleAn ? 'an' : 'a';
 		}
 
-		switch (V.activeCanine.name) {
+		switch (V.active.canine.name) {
 			case "beagle":
 			case "French bulldog":
 			case "poodle":
@@ -44,7 +44,7 @@ App.Facilities.Pit.animals = function() {
 				break;
 		}
 
-		if (V.pit.animal.name === V.activeCanine.name) {
+		if (V.pit.animal.name === V.active.canine.name) {
 			if (animalEligible) {
 				if (V.pit.lethal) {
 					mainDiv.append(`Your slave will fight ${an} `, nameSpan);
@@ -67,10 +67,10 @@ App.Facilities.Pit.animals = function() {
 
 	function hoovedSelect() {
 		const mainDiv = document.createElement("div");
-		const nameSpan = App.UI.DOM.makeElement("span", `${V.activeHooved.name}.`, "bold");
+		const nameSpan = App.UI.DOM.makeElement("span", `${V.active.hooved.name}.`, "bold");
 
-		if (V.pit.animal.name === V.activeHooved.name) {
-			if (V.activeHooved.species) {
+		if (V.pit.animal.name === V.active.hooved.name) {
+			if (V.active.hooved.species) {
 				mainDiv.append(`Your slave will fight a `, nameSpan);
 			}
 		}
@@ -84,11 +84,11 @@ App.Facilities.Pit.animals = function() {
 
 	function felineSelect() {
 		const mainDiv = document.createElement("div");
-		const nameSpan = App.UI.DOM.makeElement("span", `${V.activeFeline.name}.`, "bold");
-		const noteSpan = App.UI.DOM.makeElement("span", `${V.activeFeline.name}s are too small for a proper fight`, "note");
+		const nameSpan = App.UI.DOM.makeElement("span", `${V.active.feline.name}.`, "bold");
+		const noteSpan = App.UI.DOM.makeElement("span", `${V.active.feline.name}s are too small for a proper fight`, "note");
 
-		if (V.pit.animal.name === V.activeFeline.name) {
-			if (V.activeFeline.species === cat) {
+		if (V.pit.animal.name === V.active.feline.name) {
+			if (V.active.feline.species === cat) {
 				mainDiv.appendChild(noteSpan);
 			} else {
 				mainDiv.append(`Your slave will fight a `, nameSpan);
@@ -113,35 +113,35 @@ App.Facilities.Pit.animals = function() {
 		if (V.pit.animal) {
 			//
 		} else {
-			if (V.activeCanine || V.activeHooved || V.activeFeline) {
+			if (V.active.canine || V.active.hooved || V.active.feline) {
 				mainDiv.append(`Select an animal for your slave to fight: `);
 
-				if (V.activeCanine) {
-					if (V.activeCanine.name === V.pit.animal.name) {
-						mainDiv.append(capFirstChar(V.activeCanine.name));
+				if (V.active.canine) {
+					if (V.active.canine.name === V.pit.animal.name) {
+						mainDiv.append(capFirstChar(V.active.canine.name));
 					} else {
-						animalLinks.push(App.UI.DOM.passageLink(capFirstChar(V.activeCanine.name), "Pit", () => {
-							V.pit.animal = V.activeCanine;
+						animalLinks.push(App.UI.DOM.passageLink(capFirstChar(V.active.canine.name), "Pit", () => {
+							V.pit.animal = V.active.canine;
 						}));
 					}
 				}
 
-				if (V.activeHooved) {
-					if (V.activeHooved.name === V.pit.animal.name) {
-						mainDiv.append(capFirstChar(V.activeHooved.name));
+				if (V.active.hooved) {
+					if (V.active.hooved.name === V.pit.animal.name) {
+						mainDiv.append(capFirstChar(V.active.hooved.name));
 					} else {
-						animalLinks.push(App.UI.DOM.passageLink(capFirstChar(V.activeHooved.name), "Pit", () => {
-							V.pit.animal = V.activeHooved;
+						animalLinks.push(App.UI.DOM.passageLink(capFirstChar(V.active.hooved.name), "Pit", () => {
+							V.pit.animal = V.active.hooved;
 						}));
 					}
 				}
 
-				if (V.activeFeline) {
-					if (V.activeFeline.name === V.pit.animal.name) {
-						mainDiv.append(capFirstChar(V.activeFeline.name));
+				if (V.active.feline) {
+					if (V.active.feline.name === V.pit.animal.name) {
+						mainDiv.append(capFirstChar(V.active.feline.name));
 					} else {
-						animalLinks.push(App.UI.DOM.passageLink(capFirstChar(V.activeFeline.name), "Pit", () => {
-							V.pit.animal = V.activeFeline;
+						animalLinks.push(App.UI.DOM.passageLink(capFirstChar(V.active.feline.name), "Pit", () => {
+							V.pit.animal = V.active.feline;
 						}));
 					}
 				}
diff --git a/src/interaction/siWork.js b/src/interaction/siWork.js
index 7beac876dd4..a6045ded346 100644
--- a/src/interaction/siWork.js
+++ b/src/interaction/siWork.js
@@ -469,14 +469,14 @@ App.UI.SlaveInteract.work = function(slave) {
 					sexOptions.push({text: `Have another slave ride ${his} clit-dick`, scene: `FSlaveSlaveDick`});
 				}
 				if (V.seeBestiality) {
-					if (V.farmyardKennels > 0 && V.activeCanine) {
-						sexOptions.push({text: `Have a ${V.activeCanine.species} mount ${him}`, scene: `BeastFucked`, update: {animalType: "canine"}});
+					if (V.farmyardKennels > 0 && V.active.canine) {
+						sexOptions.push({text: `Have a ${V.active.canine.species} mount ${him}`, scene: `BeastFucked`, update: {animalType: "canine"}});
 					}
-					if (V.farmyardStables > 0 && V.activeHooved) {
-						sexOptions.push({text: `Let a ${V.activeHooved.species} mount ${him}`, scene: `BeastFucked`, update: {animalType: "hooved"}});
+					if (V.farmyardStables > 0 && V.active.hooved) {
+						sexOptions.push({text: `Let a ${V.active.hooved.species} mount ${him}`, scene: `BeastFucked`, update: {animalType: "hooved"}});
 					}
-					if (V.farmyardCages > 0 && V.activeFeline) {
-						sexOptions.push({text: `Have a ${V.activeFeline.species} mount ${him}`, scene: `BeastFucked`, update: {animalType: "feline"}});
+					if (V.farmyardCages > 0 && V.active.feline) {
+						sexOptions.push({text: `Have a ${V.active.feline.species} mount ${him}`, scene: `BeastFucked`, update: {animalType: "feline"}});
 					}
 				}
 				sexOptions.push({text: `Abuse ${him}`, scene: `FAbuse`});
diff --git a/src/npc/children/childInteract.tw b/src/npc/children/childInteract.tw
index 9a87dfe89c4..66c6d61c00f 100644
--- a/src/npc/children/childInteract.tw
+++ b/src/npc/children/childInteract.tw
@@ -300,20 +300,20 @@ FIXME:
 		<</link>> |
 	<</if>>
 	<<if $seeBestiality>>
-		<<if $farmyardKennels > 0 && $activeCanine != 0>>
-			<<link "Have a $activeCanine.species mount $him">>
+		<<if $farmyardKennels > 0 && $active.canine>>
+			<<link "Have a $active.canine.species mount $him">>
 				<<set $animalType = "canine">>
 				<<replace "#mini-scene">><<include "BeastFucked">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>>
 			<</link>> |
 		<</if>>
-		<<if $farmyardStables > 0 && $activeHooved.species != 0>>
-			<<link "Let a $activeHooved.species mount $him">>
+		<<if $farmyardStables > 0 && $active.hooved.species>>
+			<<link "Let a $active.hooved.species mount $him">>
 				<<set $animalType = "hooved">>
 				<<replace "#mini-scene">><<include "BeastFucked">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>>
 			<</link>> |
 		<</if>>
-		<<if $farmyardCages > 0 && $activeFeline != 0>>
-			<<link "Have a $activeFeline.species mount $him">>
+		<<if $farmyardCages > 0 && $active.feline>>
+			<<link "Have a $active.feline.species mount $him">>
 				<<set $animalType = "feline">>
 				<<replace "#mini-scene">><<include "BeastFucked">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>>
 			<</link>> |
diff --git a/src/npc/interaction/fAnimal.js b/src/npc/interaction/fAnimal.js
index 11e4b3f50ed..b7950e2af04 100644
--- a/src/npc/interaction/fAnimal.js
+++ b/src/npc/interaction/fAnimal.js
@@ -1,6 +1,7 @@
 
 /**
  * @param {App.Entity.SlaveState} slave
+ * @param {string} type
  */
 App.Interact.fAnimal = function(slave, type) {
 	const frag = new DocumentFragment();
@@ -19,24 +20,13 @@ App.Interact.fAnimal = function(slave, type) {
 
 	const approvingFetishes = ["masochist", "humiliation", "perverted", "sinful"];	// not strictly fetishes, but approvingFetishesAndBehavioralQuirksAndSexualQuirks doesn't have the same ring to it
 
-	let animal;
+	const animal = V.active[type];
+
 	let fetishDesc;
 	let act;
 	let hole;
 	let orifice = [];
 
-	switch (type) {
-		case "canine":
-			animal = V.activeCanine;
-			break;
-		case "hooved":
-			animal = V.activeHooved;
-			break;
-		case "feline":
-			animal = V.activeFeline;
-			break;
-	}
-
 	const anAnimal = animal.articleAn ? `an ${animal.name}` : `a ${animal.name}`;
 
 	if (slave.assignment === Job.FUCKTOY || slave.assignment === Job.MASTERSUITE) {
@@ -198,7 +188,7 @@ App.Interact.fAnimal = function(slave, type) {
 					if (slaveApproves()) {
 						mainSpan.append(`${slave.slaveName} doesn't seem terribly keen on the idea of fucking an animal, but the thought of ${fetishDesc} seems to be enough to win ${him} over. `);
 					} else {
-						mainSpan.append(`${slave.slaveName} tries in vain to coneal ${his} horror at the thought of fucking an animal, but quickly regains ${his} composure. `);
+						mainSpan.append(`${slave.slaveName} tries in vain to conceal ${his} horror at the thought of fucking an animal, but quickly regains ${his} composure. `);
 					}
 				} else {
 					if (slaveApproves()) {
@@ -226,7 +216,7 @@ App.Interact.fAnimal = function(slave, type) {
 					if (slaveApproves()) {
 						mainSpan.append(`${slave.slaveName} looks disgusted at the thought of fucking an animal at first, but the thought of the ${fetishDesc} that comes with it seems to spark a small flame of lust in ${him}. `);
 					} else {
-						mainSpan.append(`${slave.slaveName} tries in vain to coneal ${his} horror at the thought of fucking an animal${canWalk(slave) ? `, and only the threat of worse punishment keeps ${him} from running away as fast as ${he} can` : ``}. `);
+						mainSpan.append(`${slave.slaveName} tries in vain to conceal ${his} horror at the thought of fucking an animal${canWalk(slave) ? `, and only the threat of worse punishment keeps ${him} from running away as fast as ${he} can` : ``}. `);
 					}
 				} else {
 					if (slaveApproves()) {
@@ -278,13 +268,13 @@ App.Interact.fAnimal = function(slave, type) {
 			}
 
 			switch (animal) {
-				case V.activeCanine:
+				case V.active.canine:
 					consummationDevotedCanine(act);
 					break;
-				case V.activeHooved:
+				case V.active.hooved:
 					consummationDevotedHooved(act);
 					break;
-				case V.activeFeline:
+				case V.active.feline:
 					consummationDevotedFeline(act);
 					break;
 				default:
@@ -354,13 +344,13 @@ App.Interact.fAnimal = function(slave, type) {
 			}
 
 			switch (animal) {
-				case V.activeCanine:
+				case V.active.canine:
 					consummationNondevotedCanine(act);
 					break;
-				case V.activeHooved:
+				case V.active.hooved:
 					consummationNondevotedHooved(act);
 					break;
-				case V.activeFeline:
+				case V.active.feline:
 					consummationNondevotedFeline(act);
 					break;
 				default:
@@ -430,13 +420,13 @@ App.Interact.fAnimal = function(slave, type) {
 			}
 
 			switch (animal) {
-				case V.activeCanine:
+				case V.active.canine:
 					consummationNonresistantCanine(act);
 					break;
-				case V.activeHooved:
+				case V.active.hooved:
 					consummationNonresistantHooved(act);
 					break;
-				case V.activeFeline:
+				case V.active.feline:
 					consummationNonresistantFeline(act);
 					break;
 				default:
@@ -506,13 +496,13 @@ App.Interact.fAnimal = function(slave, type) {
 			}
 
 			switch (animal) {
-				case V.activeCanine:
+				case V.active.canine:
 					consummationResistantCanine(act);
 					break;
-				case V.activeHooved:
+				case V.active.hooved:
 					consummationResistantHooved(act);
 					break;
-				case V.activeFeline:
+				case V.active.feline:
 					consummationResistantFeline(act);
 					break;
 				default:
@@ -602,13 +592,13 @@ App.Interact.fAnimal = function(slave, type) {
 			r = [];
 
 		switch (animal) {
-			case V.activeCanine:
+			case V.active.canine:
 				completionCanine();
 				break;
-			case V.activeHooved:
+			case V.active.hooved:
 				completionHooved();
 				break;
-			case V.activeFeline:
+			case V.active.feline:
 				completionFeline();
 				break;
 			default:
-- 
GitLab