From eb9a16b6cdee2c34d18aafcd737c838c8d14889b Mon Sep 17 00:00:00 2001
From: Frankly George <54015-franklygeorge@users.noreply.gitgud.io>
Date: Sat, 12 Oct 2024 00:56:26 +0000
Subject: [PATCH] Add `replacedLimbs` to `HeroSlaveTemplate`

---
 devTools/types/FC/human.d.ts                  |  7 ++++---
 .../slavesDatabase_000-Instructions.md        | 19 +++++++++++++++----
 .../databases/slavesDatabase_XX_Extreme.js    | 12 ++++++------
 .../databases/slavesDatabase_XY_Extreme.js    |  2 +-
 src/npc/generate/heroCreator.js               | 18 ++++++++++--------
 5 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/devTools/types/FC/human.d.ts b/devTools/types/FC/human.d.ts
index e2b74d81b11..f7f71555d25 100644
--- a/devTools/types/FC/human.d.ts
+++ b/devTools/types/FC/human.d.ts
@@ -37,10 +37,11 @@ declare global {
 			Pick<SlaveState, SlaveStateRequiredAttributes> {
 			/**
 			 * [left arm, right arm, left leg, right leg].
-			 * When 0 keep the limb, when 1 remove the limb from the generated slave.
-			 * [1, 1, 0, 0] would remove both arms, but keep the legs.
+			 * When 0 remove the limb, when 1+ sets the limb to the given LimbType.
+			 * [0, 0, 1, 1] would remove both arms, but keep the legs as normal.
+			 * [6, 6, 0, 1] would make both arms cybernetic prostetics and remove the left leg.
 			  */
-			removedLimbs?: number[];
+			_limbs?: [0 | LimbType, 0 | LimbType, 0 | LimbType, 0 | LimbType];
 		}
 
 		export interface GingeredSlave extends SlaveState {
diff --git a/src/npc/databases/slavesDatabase_000-Instructions.md b/src/npc/databases/slavesDatabase_000-Instructions.md
index acc74a9207f..dfee07c6757 100644
--- a/src/npc/databases/slavesDatabase_000-Instructions.md
+++ b/src/npc/databases/slavesDatabase_000-Instructions.md
@@ -58,15 +58,26 @@ To make a female Hero Slave infertile, give her an "ovaries" value of 1, and a "
 
 To make a male Hero Slave infertile without castrating him, set "ballType" to "sterile".
 
-## Removing Limbs From Hero Slaves
+## Removing Hero Slave limbs or making them prostetics
 
-Hero Slaves with missing limbs need to go in one of the extreme databases
+Hero Slaves with missing limbs need to go in one of the extreme databases.
+Hero Slaves with prostetics can usually go into any of the databases.
 
-To remove limbs from a Hero Slave you use the `removedLimbs` property.
-This property is an array with a 1 or 0 in 4 different positions. The positions are `[left arm, right arm, left leg, right leg]`. A 1 will remove that limb, while a 0 will keep it. For example `[1, 1, 1, 1]` would remove all limbs from the given slave and `[1, 1, 0, 0]` would only remove the arms.
+To modify a Hero Slave's limbs you use the `_limbs` property.
+This property is an array of 4 numbers. The positions are `[left arm, right arm, left leg, right leg]`. A 0 will remove that limb, while a 1 will keep it natural. Anything above 1 will set that limb to the prostetic corresponding to the given number. For example `[0, 0, 0, 0]` would remove all limbs from the given slave, `[0, 0, 1, 1]` would only remove the arms, and `[6, 6, 0, 1]` would make both arms cybernetic prostetics, remove the left leg, and keep the right leg natural.
 
 See existing extreme slaves for examples.
 
+Here are the different limb types available:
+
+* 0: removed
+* 1: normal
+* 2: simple prosthetic
+* 3: advanced - Sex
+* 4: advanced - Beauty
+* 5: advanced - Combat
+* 6: cybernetic
+
 ## Families
 
 Two slaves can be siblings (parent/child relationships can't easily be made to work with the Special Market, because the relationship is stored only on the child). To be siblings, two slaves must share at least one parent (a negative dummy ID, not the ID of a slave in the game--make sure it doesn't conflict with parent ID's already in the databases); it's helpful to match sure they match by setting their birth surname, race, and nationality explicitly, and setting twins' birth weeks explicitly.
diff --git a/src/npc/databases/slavesDatabase_XX_Extreme.js b/src/npc/databases/slavesDatabase_XX_Extreme.js
index 3dd6d67383c..d50bb1fb69c 100644
--- a/src/npc/databases/slavesDatabase_XX_Extreme.js
+++ b/src/npc/databases/slavesDatabase_XX_Extreme.js
@@ -40,7 +40,7 @@ App.Data.HeroSlaves.XXExtreme = [
 		fetishKnown: 1,
 		voice: 0,
 		nipples: "puffy",
-		removedLimbs: [1, 1, 1, 1]
+		_limbs: [0, 0, 0, 0]
 	},
 	{
 		/* put some of $his custom description in $his origin (box stuff), tagged as amp, lowered obedience, increased weight but lowered health, changed skin color from white to pale */
@@ -81,7 +81,7 @@ App.Data.HeroSlaves.XXExtreme = [
 		attrXY: 40,
 		fetishKnown: 1,
 		custom: {desc: "$His amputation sites have titanium rings that go through to the bone. $He has been chemically blinded."},
-		removedLimbs: [1, 1, 1, 1],
+		_limbs: [0, 0, 0, 0],
 		eye: {
 			left: {
 				vision: 0
@@ -122,7 +122,7 @@ App.Data.HeroSlaves.XXExtreme = [
 		behavioralFlaw: "odd",
 		custom: {desc: "$He is a work of art: stoic, mysterious, doll-like — and always smiling."},
 		voice: 0,
-		removedLimbs: [1, 1, 1, 1],
+		_limbs: [0, 0, 0, 0],
 	},
 	{
 		/* Added career to match origin. -DerangedLoner */
@@ -201,7 +201,7 @@ App.Data.HeroSlaves.XXExtreme = [
 			nipple: {weight: 2}, lips: {weight: 2}, tongue: {weight: 2}, vagina: {weight: 2}, anus: {weight: 2}, ear: {weight: 2}, nose: {weight: 2}, eyebrow: {weight: 2}, navel: {weight: 2}, genitals: {weight: 2, smart: true}
 		},
 		clitSetting: "boobs",
-		removedLimbs: [1, 1, 1, 1],
+		_limbs: [0, 0, 0, 0],
 		career: "homeless"
 	},
 	{
@@ -257,7 +257,7 @@ App.Data.HeroSlaves.XXExtreme = [
 		energy: 100,
 		attrXY: 40,
 		fetishKnown: 1,
-		removedLimbs: [1, 1, 1, 1],
+		_limbs: [0, 0, 0, 0],
 		career: "a political activist"
 	},
 	{
@@ -333,7 +333,7 @@ App.Data.HeroSlaves.XXExtreme = [
 		fetishKnown: 1,
 		behavioralFlaw: "bitchy",
 		custom: {desc: "$He fits perfectly into a pillowcase."},
-		removedLimbs: [1, 1, 1, 1],
+		_limbs: [0, 0, 0, 0],
 	},
 	{
 		/* mindbroken*/
diff --git a/src/npc/databases/slavesDatabase_XY_Extreme.js b/src/npc/databases/slavesDatabase_XY_Extreme.js
index f0da94e2c17..220e29c85c4 100644
--- a/src/npc/databases/slavesDatabase_XY_Extreme.js
+++ b/src/npc/databases/slavesDatabase_XY_Extreme.js
@@ -107,6 +107,6 @@ App.Data.HeroSlaves.XYExtreme = [
 		fetish: "submissive",
 		fetishKnown: 1,
 		behavioralQuirk: "advocate",
-		removedLimbs: [1, 1, 1, 1],
+		_limbs: [0, 0, 0, 0],
 	},
 ];
diff --git a/src/npc/generate/heroCreator.js b/src/npc/generate/heroCreator.js
index dbf3c8f647f..25fead1d792 100644
--- a/src/npc/generate/heroCreator.js
+++ b/src/npc/generate/heroCreator.js
@@ -102,20 +102,22 @@ App.Utils.getHeroSlave = function(heroTemplate, newAge = undefined) {
 	 * @param {FC.SlaveState & FC.HeroSlaveTemplate} slave
 	 */
 	function repairLimbs(slave) {
-		if (slave.hasOwnProperty("removedLimbs")) {
-			if (slave.removedLimbs[0] === 1) {
-				removeLimbs(slave, "left arm");
+		if (slave.hasOwnProperty("_limbs")) {
+			if (slave._limbs[0] >= 0) {
+				configureLimbs(slave, "left arm", slave._limbs[0]);
 			}
-			if (slave.removedLimbs[1] === 1) {
+			if (slave._limbs[1] >= 0) {
+				configureLimbs(slave, "right arm", slave._limbs[1]);
 				removeLimbs(slave, "right arm");
 			}
-			if (slave.removedLimbs[2] === 1) {
+			if (slave._limbs[2] >= 0) {
+				configureLimbs(slave, "left leg", slave._limbs[2]);
 				removeLimbs(slave, "left leg");
 			}
-			if (slave.removedLimbs[3] === 1) {
-				removeLimbs(slave, "right leg");
+			if (slave._limbs[3] >= 0) {
+				configureLimbs(slave, "right leg", slave._limbs[3]);
 			}
-			delete slave.removedLimbs;
+			delete slave._limbs;
 		}
 	}
 
-- 
GitLab