From 6ff32b54f2c8f11932b2b3f29419411e80f9e40a Mon Sep 17 00:00:00 2001
From: Pregmodder <pregmodder@gmail.com>
Date: Sat, 7 Mar 2020 13:28:11 -0500
Subject: [PATCH] Clinic observes pregnancy toggle

---
 js/003-data/gameVariableData.js                  |  5 +++--
 src/002-config/fc-version.js                     |  2 +-
 .../backwardsCompatibility/datatypeCleanup.js    |  1 +
 src/facilities/clinic/clinicFramework.js         |  3 ++-
 src/js/slaveCostJS.js                            | 13 +++++++++----
 src/uncategorized/clinic.tw                      | 16 ++++++++++++++++
 src/uncategorized/clinicReport.tw                |  6 +++---
 7 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js
index 3038ee6dd17..aacf42e2c64 100644
--- a/js/003-data/gameVariableData.js
+++ b/js/003-data/gameVariableData.js
@@ -768,6 +768,9 @@ App.Data.resetOnNGPlus = {
 	clinicUpgradeFilters: 0,
 	clinicUpgradeScanner: 0,
 	clinicUpgradePurge: 0,
+	clinicObservePregnancy: 1,
+	clinicInflateBelly: 0,
+	clinicSpeedGestation: 0,
 	clinicName: "the Clinic",
 	clinicNameCaps: "The Clinic",
 	arcadeDecoration: "standard",
@@ -1013,7 +1016,6 @@ App.Data.resetOnNGPlus = {
 	wcPiping: 0,
 	burstee: 0,
 	slaveDeath: 0,
-	clinicInflateBelly: 0,
 	playerBred: 0,
 	propOutcome: 0,
 	EliteSires: ["crazy", "futa", "moves", "preggo", "quick", "virgin"],
@@ -1028,7 +1030,6 @@ App.Data.resetOnNGPlus = {
 	originOveride: 0,
 	playerAging: 2,
 	pregSpeedControl: 0,
-	clinicSpeedGestation: 0,
 	playerSurgery: 0,
 	playerGetsMilked: 0,
 	bodyswapAnnounced: 0,
diff --git a/src/002-config/fc-version.js b/src/002-config/fc-version.js
index ac380329229..39e3def103f 100644
--- a/src/002-config/fc-version.js
+++ b/src/002-config/fc-version.js
@@ -1,7 +1,7 @@
 App.Version = {
 	base: "0.10.7.1", // The vanilla version the mod is based off of, this should never be changed.
 	pmod: "3.3.3",
-	release: 1062,
+	release: 1063,
 };
 
 /* Use release as save version */
diff --git a/src/data/backwardsCompatibility/datatypeCleanup.js b/src/data/backwardsCompatibility/datatypeCleanup.js
index 80342a4fac2..2fdc6b01af5 100644
--- a/src/data/backwardsCompatibility/datatypeCleanup.js
+++ b/src/data/backwardsCompatibility/datatypeCleanup.js
@@ -2169,6 +2169,7 @@ window.FacilityDatatypeCleanup = (function() {
 		V.clinicUpgradeScanner = Math.clamp(+V.clinicUpgradeScanner, 0, 1) || 0;
 		V.clinicUpgradeFilters = Math.clamp(+V.clinicUpgradeFilters, 0, 1) || 0;
 		V.clinicUpgradePurge = Math.clamp(+V.clinicUpgradePurge, 0, 3) || 0;
+		V.clinicObservePregnancy = Math.clamp(+V.clinicObservePregnancy, 0, 1) || 1;
 		V.clinicInflateBelly = Math.clamp(+V.clinicInflateBelly, 0, 1) || 0;
 		V.clinicSpeedGestation = Math.clamp(+V.clinicSpeedGestation, 0, 1) || 0;
 		/* nurse */
diff --git a/src/facilities/clinic/clinicFramework.js b/src/facilities/clinic/clinicFramework.js
index acc9642d966..0551343c577 100644
--- a/src/facilities/clinic/clinicFramework.js
+++ b/src/facilities/clinic/clinicFramework.js
@@ -44,7 +44,8 @@ App.Entity.Facilities.ClinicPatientJob = class extends App.Entity.Facilities.Fac
 		if ((slave.health.illness === 0 && slave.health.shortDamage < 20 && slave.health.condition >= 40) &&
 			(V.Nurse === 0 || ((slave.chem <= 15 || this.facility.upgrade("Filters") !== 1) &&
 				(V.bellyImplants !== 1 || slave.bellyImplant <= -1) &&
-				(slave.pregKnown !== 1 || (this.facility.option("SpeedGestation") <= 0 && slave.pregControl !== "speed up")) && (slave.pregAdaptation * 1000 >= slave.bellyPreg && slave.preg <= slave.pregData.normalBirth / 1.33)))) {
+				(slave.pregKnown !== 1 || (this.facility.option("SpeedGestation") <= 0 && slave.pregControl !== "speed up")) &&
+				(this.facility.option("ObservePregnancy") !== 1 || slave.pregAdaptation * 1000 >= slave.bellyPreg && slave.preg <= slave.pregData.normalBirth / 1.33)))) {
 			r.push(`${slave.slaveName} cannot benefit from ${this.facility.name}.`);
 		}
 
diff --git a/src/js/slaveCostJS.js b/src/js/slaveCostJS.js
index 01e8744a58e..8a52282cc21 100644
--- a/src/js/slaveCostJS.js
+++ b/src/js/slaveCostJS.js
@@ -1189,10 +1189,12 @@ window.BeautyArray = (function() {
 	 * @param {App.Entity.SlaveState} slave
 	 */
 	function calcLimbsBeauty(slave) {
-		// missing limbs
-		adjustBeauty("Limbs: Missing", -(getLimbCount(slave, 0) * 2.5));
-		// non-beauty prosthetics
-		adjustBeauty("Limbs: Non-beauty Prothetics", -((getLimbCount(slave, 102) - getLimbCount(slave, 104)) * 0.5));
+		if (arcology.FSDegradationist !== "unset") {
+			// missing limbs
+			adjustBeauty("Limbs: Missing", -(getLimbCount(slave, 0) * 2.5));
+			// non-beauty prosthetics
+			adjustBeauty("Limbs: Non-beauty Prosthetics", -((getLimbCount(slave, 102) - getLimbCount(slave, 104)) * 0.5));
+		}
 	}
 
 	/**
@@ -1223,6 +1225,9 @@ window.BeautyArray = (function() {
 			if (slave.hips === 3) {
 				adjustBeauty("Hips: Transformation Fetishist", (10));
 			}
+			if (hasAnyProstheticLimbs(slave)) {
+				adjustBeauty("Artificial Limbs: Transformation Fetishist", (arcology.FSTransformationFetishist / 5));
+			}
 			if (slave.horn !== "none" || slave.tail !== "none" || (slave.earShape !== "normal" && slave.earShape !== "damaged") || slave.earT !== "none") {
 				adjustBeauty("Horn/Tail/Odd Ears: Transformation Fetishist", (10));
 			}
diff --git a/src/uncategorized/clinic.tw b/src/uncategorized/clinic.tw
index a7afdb2a7d5..6490c567bc5 100644
--- a/src/uncategorized/clinic.tw
+++ b/src/uncategorized/clinic.tw
@@ -174,6 +174,22 @@
 	<</if>>
 </div>
 
+<div>
+	<<if $seePreg == 1>>
+		<<if $clinicObservePregnancy != 1>>
+			Pregnant patients will not be kept under observation.
+			<div class="choices">
+				[[Keep high-risk pregnancies under observation|Clinic][$clinicObservePregnancy = 1]]
+			</div>
+		<<else>>
+			Patients undergoing a high-risk pregnancy or are close to giving birth will be kept under observation.
+			<div class="choices">
+				[[Stop observing pregnancies|Clinic][$clinicObservePregnancy = 0]]
+			</div>
+		<</if>>
+	<</if>>
+</div>
+
 <div>
 	<<if $pregSpeedControl == 1 && $Nurse == 0>>
 		A resident nurse could be used to supervise patients under rapid gestation agents while minimizing strain and health complications.
diff --git a/src/uncategorized/clinicReport.tw b/src/uncategorized/clinicReport.tw
index ca96d227f4b..bfcaff902d4 100644
--- a/src/uncategorized/clinicReport.tw
+++ b/src/uncategorized/clinicReport.tw
@@ -294,7 +294,7 @@
 	<<elseif ($slaves[$i].health.condition <= 40)>>
 	<<elseif ($Nurse != 0) && ($slaves[$i].chem > 15) && ($clinicUpgradeFilters == 1)>>
 	<<elseif ($Nurse != 0) && ($slaves[$i].pregKnown == 1) && ($clinicSpeedGestation > 0 || $slaves[$i].pregControl == "speed up")>>
-	<<elseif ($Nurse != 0) && ($slaves[$i].pregAdaptation*1000 < $slaves[$i].bellyPreg || $slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.33)>>
+	<<elseif ($Nurse != 0) && ($clinicObservePregnancy == 1) && ($slaves[$i].pregAdaptation*1000 < $slaves[$i].bellyPreg || $slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.33)>>
 	<<elseif ($Nurse != 0) && ($clinicInflateBelly > 0) && ($slaves[$i].bellyImplant >= 0) && ($slaves[$i].bellyImplant <= ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000))>>
 	<<else>>
 		<p>
@@ -349,10 +349,10 @@
 			$He stays in the clinic as unhealthy chemicals are still being flushed from $his system.
 		<<elseif ($Nurse != 0) && ($slaves[$i].pregKnown == 1) && ($clinicSpeedGestation > 0 || $slaves[$i].pregControl == "speed up")>>
 			$He stays in the clinic to hurry $his pregnancy along safely.
-		<<elseif ($Nurse != 0) && ($slaves[$i].pregAdaptation*1000 < $slaves[$i].bellyPreg || $slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.33)>>
-			$He stays in the clinic waiting for the child to be born.
 		<<elseif ($Nurse != 0) && ($clinicInflateBelly > 0) && ($slaves[$i].bellyImplant >= 0) && ($slaves[$i].bellyImplant <= ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000))>>
 			$He stays in the clinic as $his implants can still receive more filling.
+		<<elseif ($Nurse != 0) && ($clinicObservePregnancy == 1) && ($slaves[$i].pregAdaptation*1000 < $slaves[$i].bellyPreg || $slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.33)>>
+			$He stays in the clinic waiting for the child to be born.
 		<</if>>
 		<br>&nbsp;&nbsp;&nbsp;
 		<<= saChoosesOwnClothes($slaves[$i])>>
-- 
GitLab