From 0877080d8f68840ecb4b20230526b0558ecb1cea Mon Sep 17 00:00:00 2001
From: klorpa <30924131+klorpa@users.noreply.github.com>
Date: Wed, 22 Aug 2018 00:22:16 -0500
Subject: [PATCH] Races

---
 devNotes/twine JS.txt                       |  1 +
 slave variables documentation - Pregmod.txt |  5 +++
 src/art/artJS.tw                            | 11 -----
 src/cheats/mod_editSlaveCheatNew.tw         | 34 +++++++--------
 src/js/assayJS.tw                           |  1 +
 src/npc/startingGirls/commitStartingGirl.tw |  1 +
 src/npc/startingGirls/moreCustomOptions.tw  |  1 +
 src/npc/uploadSlave.tw                      |  1 -
 src/pregmod/editGenetics.tw                 |  2 +-
 src/pregmod/generateChild.tw                | 46 ++++++++++-----------
 src/pregmod/huskSlave.tw                    |  4 +-
 src/pregmod/huskSlaveSwap.tw                |  2 +-
 src/pregmod/testGenetics.tw                 |  2 +-
 src/pregmod/widgets/bodyswapWidgets.tw      |  1 +
 src/pregmod/widgets/pregmodWidgets.tw       | 11 ++---
 src/uncategorized/BackwardsCompatibility.tw |  3 ++
 src/uncategorized/generateXXSlave.tw        |  1 +
 src/uncategorized/generateXYSlave.tw        |  1 +
 src/utility/slaveCreationWidgets.tw         |  2 +-
 19 files changed, 64 insertions(+), 66 deletions(-)

diff --git a/devNotes/twine JS.txt b/devNotes/twine JS.txt
index 51919dcc5ae..8f9e4cc7272 100644
--- a/devNotes/twine JS.txt	
+++ b/devNotes/twine JS.txt	
@@ -6917,6 +6917,7 @@ window.newSlave = function newSlave(slave) {
 			slave.origEye = slave.eyeColor;
 			break;
 	}
+	slave.origRace = slave.race;
 	slave.origHColor = slave.hColor;
 	slave.underArmHColor = slave.hColor;
 	slave.pubicHColor = slave.hColor;
diff --git a/slave variables documentation - Pregmod.txt b/slave variables documentation - Pregmod.txt
index 76c821be2be..0f846b4e348 100644
--- a/slave variables documentation - Pregmod.txt	
+++ b/slave variables documentation - Pregmod.txt	
@@ -1048,6 +1048,11 @@ accepts string
 "indo-aryan"
 "mixed race"
 
+origRace:
+
+slave's original race
+accepts string
+
 pubicHColor:
 
 pubic hair color
diff --git a/src/art/artJS.tw b/src/art/artJS.tw
index 1f9a72ed4e1..1ce5fb5d136 100644
--- a/src/art/artJS.tw
+++ b/src/art/artJS.tw
@@ -189,17 +189,6 @@ window.extractHairColor = function (hColor) {
 		["red", "#BB2027"],
 		["silver", "#cdc9c6"],
 		["strawberry-blonde", "#e5a88c"],
-		/* eye shapes, future plans to convert them from eyecolor to new value system */
-		["almond-shaped", "#555555"],
-		["bright", "#555555"],
-		["catlike", "#555555"],
-		["devilish", "#ffd42a"],
-		["heart-shaped", "#555555"],
-		["hypnotic", "#ff5599"],
-		["serpent-like", "#555555"],
-		["teary", "#555555"],
-		["vacant", "#555555"],
-		["wide-eyed", "#555555"],
 		/* these are not actually FreeCities canon, but like to appear in custom descriptions */
 		["brunette", "#8D4F21"],
 		["dark", "#463325"]
diff --git a/src/cheats/mod_editSlaveCheatNew.tw b/src/cheats/mod_editSlaveCheatNew.tw
index 1b54a28b5a4..221f3a33145 100644
--- a/src/cheats/mod_editSlaveCheatNew.tw
+++ b/src/cheats/mod_editSlaveCheatNew.tw
@@ -1397,23 +1397,23 @@
 	<br>
 	//For best results, use a short, uncapitalized and unpunctuated description; for example: 'back in a ponytail'//
 	<br>
-	<<radiobutton "$tempSlave.hStyle" "neat">>neat
-	<<radiobutton "$tempSlave.hStyle" "shaved">>shaved
-	<<radiobutton "$tempSlave.hStyle" "trimmed">>trimmed
-	<<radiobutton "$tempSlave.hStyle" "buzzcut">>buzzcut
-	<<radiobutton "$tempSlave.hStyle" "up">>up
-	<<radiobutton "$tempSlave.hStyle" "ponytail">>ponytail
-	<<radiobutton "$tempSlave.hStyle" "bun">>bun
-	<<radiobutton "$tempSlave.hStyle" "curled">>curls
-	<br>
-	<<radiobutton "$tempSlave.hStyle" "permed">>permed
-	<<radiobutton "$tempSlave.hStyle" "luxurious">>luxurious
-	<<radiobutton "$tempSlave.hStyle" "dreadlocks">>dreadlocks
-	<<radiobutton "$tempSlave.hStyle" "cornrows">>cornrows
-	<<radiobutton "$tempSlave.hStyle" "braided">>braided
-	<<radiobutton "$tempSlave.hStyle" "tails">>tails
-	<<radiobutton "$tempSlave.hStyle" "afro">>afro
-	<<radiobutton "$tempSlave.hStyle" "strip">>strip
+	<<radiobutton "$tempSlave.hStyle" "neat">> Neat
+	<<radiobutton "$tempSlave.hStyle" "shaved">> Shaved
+	<<radiobutton "$tempSlave.hStyle" "trimmed">> Trimmed
+	<<radiobutton "$tempSlave.hStyle" "buzzcut">> Buzzcut
+	<<radiobutton "$tempSlave.hStyle" "up">> Up
+	<<radiobutton "$tempSlave.hStyle" "ponytail">> Ponytail
+	<<radiobutton "$tempSlave.hStyle" "bun">> Bun
+	<<radiobutton "$tempSlave.hStyle" "curled">> Curls
+	<br>
+	<<radiobutton "$tempSlave.hStyle" "permed">> Permed
+	<<radiobutton "$tempSlave.hStyle" "luxurious">> Luxurious
+	<<radiobutton "$tempSlave.hStyle" "dreadlocks">> Dreadlocks
+	<<radiobutton "$tempSlave.hStyle" "cornrows">> Cornrows
+	<<radiobutton "$tempSlave.hStyle" "braided">> Braided
+	<<radiobutton "$tempSlave.hStyle" "tails">> Tails
+	<<radiobutton "$tempSlave.hStyle" "afro">> Afro
+	<<radiobutton "$tempSlave.hStyle" "strip">> Strip
 
 	<br><br>
 	Her hair is currently ''@@.yellow;$tempSlave.hColor@@'' in color
diff --git a/src/js/assayJS.tw b/src/js/assayJS.tw
index f3d27c81fa6..978032cbc20 100644
--- a/src/js/assayJS.tw
+++ b/src/js/assayJS.tw
@@ -251,6 +251,7 @@ window.newSlave = function newSlave(slave) {
 			slave.origEye = slave.eyeColor;
 			break;
 	}
+	slave.origRace = slave.race;
 	slave.origHColor = slave.hColor;
 	slave.underArmHColor = slave.hColor;
 	slave.pubicHColor = slave.hColor;
diff --git a/src/npc/startingGirls/commitStartingGirl.tw b/src/npc/startingGirls/commitStartingGirl.tw
index 8318ec63780..54cb7ac4058 100644
--- a/src/npc/startingGirls/commitStartingGirl.tw
+++ b/src/npc/startingGirls/commitStartingGirl.tw
@@ -11,6 +11,7 @@
 <</if>>
 <<set $activeSlave.height = Math.clamp($activeSlave.height, 85, 274) || 140>>
 <<set $activeSlave.boobs = Math.clamp(Math.trunc($activeSlave.boobs/50)*50, 0, 50000) || 200>>
+<<set $activeSlave.origRace = $activeSlave.race>>
 <<set $activeSlave.origSkin = $activeSlave.skin>>
 <<set $activeSlave.weekAcquired = 0>>
 
diff --git a/src/npc/startingGirls/moreCustomOptions.tw b/src/npc/startingGirls/moreCustomOptions.tw
index 2e3821f6327..1fd921215f3 100644
--- a/src/npc/startingGirls/moreCustomOptions.tw
+++ b/src/npc/startingGirls/moreCustomOptions.tw
@@ -4,6 +4,7 @@
 <<set $activeSlave.underArmHColor = $activeSlave.hColor>>
 <<set $activeSlave.origHColor = $activeSlave.hColor>>
 <<set $activeSlave.origEye = $activeSlave.eyeColor>>
+<<set $activeSlave.origRace = $activeSlave.race>>
 <<if $activeSlave.birthsTotal > 0>>
 	<<if $activeSlave.pubertyXX < 1>>
 		<<set $activeSlave.birthsTotal = 0>>
diff --git a/src/npc/uploadSlave.tw b/src/npc/uploadSlave.tw
index c32b857d5f8..3033bda1981 100644
--- a/src/npc/uploadSlave.tw
+++ b/src/npc/uploadSlave.tw
@@ -202,4 +202,3 @@ customLabel: "",
 customDesc: "$activeSlave.customDesc",
 customImage: 0,
 currentRules: $activeSlave.currentRules
-
diff --git a/src/pregmod/editGenetics.tw b/src/pregmod/editGenetics.tw
index 9d2575d5fdb..665f4ef077f 100644
--- a/src/pregmod/editGenetics.tw
+++ b/src/pregmod/editGenetics.tw
@@ -35,7 +35,7 @@
 		</tr>
 		<tr>
 			<th>Nationality</th><td colspan="2" class="editor string-editor" data-param="nationality"><%- s.nationality %></td>
-			<th>Ethnicity</th><td colspan="2" class="editor choice-editor" data-param="race" data-choices="amerindian, asian, black, indo-aryan, latina, middle eastern, pacific islander, semitic, southern european, white, mixed race"><%- s.race %></td>
+			<th>Ethnicity</th><td colspan="2" class="editor choice-editor" data-param="origRace" data-choices="amerindian, asian, black, indo-aryan, latina, middle eastern, pacific islander, semitic, southern european, white, mixed race"><%- s.origRace %></td>
 			<th>Career</th><td><i><%- s.career ? s.career : '' %></i></td>
 		</tr>
 		<tr>
diff --git a/src/pregmod/generateChild.tw b/src/pregmod/generateChild.tw
index f97226511c5..8c26c9d8ea6 100644
--- a/src/pregmod/generateChild.tw
+++ b/src/pregmod/generateChild.tw
@@ -36,14 +36,14 @@
 			<<set $activeSlave.nationality = $PC.nationality>>
 		<</if>>
 		<<if $PC.pregSource == -2 && $arcologies[0].FSSupremacist != "unset">>
-			<<set $activeSlave.race = either($PC.race, $arcologies[0].FSSubjugationistRace, $arcologies[0].FSSubjugationistRace)>>
-			<<if $PC.race != $arcologies[0].FSSubjugationistRace>>
+			<<set $activeSlave.origRace = either($PC.origRace, $arcologies[0].FSSubjugationistRace, $arcologies[0].FSSubjugationistRace)>>
+			<<if $PC.origRace != $arcologies[0].FSSubjugationistRace>>
 				<<if random(1,100) > 50>>
-					<<set $activeSlave.race = "mixed race">>
+					<<set $activeSlave.origRace = "mixed race">>
 				<</if>>
 			<</if>>
 		<<else>>
-			<<set $activeSlave.race = $PC.race>>
+			<<set $activeSlave.origRace = $PC.origRace>>
 		<</if>>
 		<<set $activeSlave.skin = $PC.origSkin>>
 		<<set $activeSlave.eyeColor = either($PC.origEye, "brown", "blue", "brown", "green", "hazel", "green")>>
@@ -73,12 +73,12 @@
 		<<else>>
 			<<set $activeSlave.nationality = "Stateless">>
 		<</if>>
-		<<if $PC.race == $mergeDad.race>>
-			<<set $activeSlave.race = $mergeDad.race>>
+		<<if $PC.origRace == $mergeDad.origRace>>
+			<<set $activeSlave.origRace = $mergeDad.origRace>>
 		<<elseif random(1,4) == 4>>
-			<<set $activeSlave.race = either($PC.race, $mergeDad.race)>>
+			<<set $activeSlave.origRace = either($PC.origRace, $mergeDad.origRace)>>
 		<<else>>
-			<<set $activeSlave.race = "mixed race">>
+			<<set $activeSlave.origRace = "mixed race">>
 		<</if>>
 		<<if $PC.origSkin == $mergeDad.origSkin>>
 			<<set $activeSlave.skin = $PC.origSkin>>
@@ -166,14 +166,14 @@
 			<<set $activeSlave.nationality = $PC.nationality>>
 		<</if>>
 		<<if $PC.pregSource == -2 && $arcologies[0].FSSupremacist != "unset">>
-			<<set $activeSlave.race = either($PC.race, $arcologies[0].FSSubjugationistRace, $arcologies[0].FSSubjugationistRace)>>
-			<<if $PC.race != $arcologies[0].FSSubjugationistRace>>
+			<<set $activeSlave.origRace = either($PC.origRace, $arcologies[0].FSSubjugationistRace, $arcologies[0].FSSubjugationistRace)>>
+			<<if $PC.origRace != $arcologies[0].FSSubjugationistRace>>
 				<<if random(1,100) > 50>>
-					<<set $activeSlave.race = "mixed race">>
+					<<set $activeSlave.origRace = "mixed race">>
 				<</if>>
 			<</if>>
 		<<else>>
-			<<set $activeSlave.race = $PC.race>>
+			<<set $activeSlave.origRace = $PC.origRace>>
 		<</if>>
 		<<set $activeSlave.skin = $PC.origSkin>>
 		<<set $activeSlave.eyeColor = either($PC.origEye, "brown", "blue", "brown", "green", "hazel", "green")>>
@@ -203,12 +203,12 @@
 		<<else>>
 			<<set $activeSlave.nationality = "Stateless">>
 		<</if>>
-		<<if $PC.race == $mergeDad.race>>
-			<<set $activeSlave.race = $mergeDad.race>>
+		<<if $PC.origRace == $mergeDad.origRace>>
+			<<set $activeSlave.origRace = $mergeDad.origRace>>
 		<<elseif random(1,4) == 4>>
-			<<set $activeSlave.race = either($PC.race, $mergeDad.race)>>
+			<<set $activeSlave.origRace = either($PC.origRace, $mergeDad.origRace)>>
 		<<else>>
-			<<set $activeSlave.race = "mixed race">>
+			<<set $activeSlave.origRace = "mixed race">>
 		<</if>>
 		<<if $PC.origSkin == $mergeDad.origSkin>>
 			<<set $activeSlave.skin = $PC.origSkin>>
@@ -309,18 +309,18 @@
 	<<else>>
 		<<set $activeSlave.nationality = "Stateless">>
 	<</if>>
-	<<if $mergeMom.race == $mergeDad.race>>
-		<<set $activeSlave.race = $mergeDad.race>>
+	<<if $mergeMom.origRace == $mergeDad.origRace>>
+		<<set $activeSlave.origRace = $mergeDad.origRace>>
 	<<elseif random(1,4) == 4>>
-		<<set $activeSlave.race = either($mergeMom.race, $mergeDad.race)>>
+		<<set $activeSlave.origRace = either($mergeMom.origRace, $mergeDad.origRace)>>
 	<<else>>
-		<<set $activeSlave.race = "mixed race">>
+		<<set $activeSlave.origRace = "mixed race">>
 	<</if>>
 	<<if $mom.pregSource == -2 && $arcologies[0].FSSupremacist != "unset">>
-		<<set $activeSlave.race = either($mergeMom.race, $arcologies[0].FSSubjugationistRace, $arcologies[0].FSSubjugationistRace)>>
-		<<if $mergeMom.race != $arcologies[0].FSSubjugationistRace>>
+		<<set $activeSlave.origRace = either($mergeMom.origRace, $arcologies[0].FSSubjugationistRace, $arcologies[0].FSSubjugationistRace)>>
+		<<if $mergeMom.origRace != $arcologies[0].FSSubjugationistRace>>
 			<<if random(1,100) > 50>>
-				<<set $activeSlave.race = "mixed race">>
+				<<set $activeSlave.origRace = "mixed race">>
 			<</if>>
 		<</if>>
 	<</if>>
diff --git a/src/pregmod/huskSlave.tw b/src/pregmod/huskSlave.tw
index db43dca215a..fb87d6aad09 100644
--- a/src/pregmod/huskSlave.tw
+++ b/src/pregmod/huskSlave.tw
@@ -34,7 +34,7 @@ Nationality:
 | [[Black|Husk Slave][$huskSlave.race = "black"]]
 | [[Semitic|Husk Slave][$huskSlave.race = "semitic"]]
 | [[Southern European|Husk Slave][$huskSlave.race = "southern european"]]
-| [[Indo-aryan|Husk Slave][$huskSlave.race = "indo-aryan"]]
+| [[Indo-Aryan|Husk Slave][$huskSlave.race = "indo-aryan"]]
 | [[Amerindian|Husk Slave][$huskSlave.race = "amerindian"]]
 | [[Pacific Islander|Husk Slave][$huskSlave.race = "pacific islander"]]
 | [[Malay|Husk Slave][$huskSlave.race = "malay"]]
@@ -48,7 +48,6 @@ Virginity:
 <br>[[Important|Husk Slave][$huskSlave.virgin = 0]]
 | [[Not Important|Husk Slave][$huskSlave.virgin = 1]]
 
-
 <br><br><br>
 Reserving a body will cost <<print cashFormat(10000)>> up front. Cancelling an order will refund your money, however if a delivered body is rejected; your money will not be refunded.
 <<if $huskSlaveOrdered == 1>>
@@ -58,4 +57,3 @@ Reserving a body will cost <<print cashFormat(10000)>> up front. Cancelling an o
 <<else>>
 [[Post body order|Main][$huskSlaveOrdered = 1, $cash -= 10000]]
 <</if>>
-
diff --git a/src/pregmod/huskSlaveSwap.tw b/src/pregmod/huskSlaveSwap.tw
index b625e0f96b3..7ad1c82fd07 100644
--- a/src/pregmod/huskSlaveSwap.tw
+++ b/src/pregmod/huskSlaveSwap.tw
@@ -8,7 +8,7 @@
 You strap $slaves[_m].slaveName, and the body to which $he will be transferred, into the remote surgery and stand back as it goes to work.
 <<BodySwap $slaves[_m] $activeSlave>>
 <<set _gps = $genePool.findIndex(function(s) { return s.ID == $slaves[_m].ID; })>>
-<<set $genePool[_gps].race = $slaves[_m].race, $genePool[_gps].skin = $slaves[_m].skin, $genePool[_gps].markings = $slaves[_m].markings, $genePool[_gps].origEye = $slaves[_m].origEye, $genePool[_gps].origHColor = $slaves[_m].origHColor, $genePool[_gps].origSkin = $slaves[_m].skin, $genePool[_gps].face = $slaves[_m].face, $genePool[_gps].pubicHStyle = $slaves[_m].pubicHStyle, $genePool[_gps].underArmHStyle = $slaves[_m].underArmHStyle>> /* special exception to swap genePool since the temporary body lacks an entry. Otherwise we could just call the widget using the genePool entries */
+<<set $genePool[_gps].race = $slaves[_m].race, $genePool[_gps].origRace = $slaves[_m].origRace, $genePool[_gps].skin = $slaves[_m].skin, $genePool[_gps].markings = $slaves[_m].markings, $genePool[_gps].origEye = $slaves[_m].origEye, $genePool[_gps].origHColor = $slaves[_m].origHColor, $genePool[_gps].origSkin = $slaves[_m].origSkin, $genePool[_gps].face = $slaves[_m].face, $genePool[_gps].pubicHStyle = $slaves[_m].pubicHStyle, $genePool[_gps].underArmHStyle = $slaves[_m].underArmHStyle>> /* special exception to swap genePool since the temporary body lacks an entry. Otherwise we could just call the widget using the genePool entries */
 
 <br><br>
 After an honestly impressive procedure, $slaves[_m].slaveName is recovering nicely.
diff --git a/src/pregmod/testGenetics.tw b/src/pregmod/testGenetics.tw
index 4a7b1ca3967..4499bbb868b 100644
--- a/src/pregmod/testGenetics.tw
+++ b/src/pregmod/testGenetics.tw
@@ -16,7 +16,7 @@ All slave array slaves MUST be present in genePool or else there is a malfunctio
 <</for>>
 </table>
 
-<<set _neededProperties = ['genes', 'origSkin', 'origEye', 'origHColor', 'nationality', 'race', 'face', 'intelligence', 'underArmHStyle', 'pubicHStyle']>>
+<<set _neededProperties = ['genes', 'origSkin', 'origEye', 'origHColor', 'nationality', 'origRace', 'face', 'intelligence', 'underArmHStyle', 'pubicHStyle']>>
 <table><caption style="background-color: rgba(127, 127, 127, 0.2)">slaves</caption>
 <tr><th>index</th><th>name</th><th>ID</th><th>origin</th><th>assignment</th></tr>
 <<for _i = 0; _i < $slaves.length; _i++>>
diff --git a/src/pregmod/widgets/bodyswapWidgets.tw b/src/pregmod/widgets/bodyswapWidgets.tw
index 79c4533a0ca..d14a63f0d13 100644
--- a/src/pregmod/widgets/bodyswapWidgets.tw
+++ b/src/pregmod/widgets/bodyswapWidgets.tw
@@ -59,6 +59,7 @@
 <<set $args[0].height = $args[1].height>>
 <<set $args[0].heightImplant = $args[1].heightImplant>>
 <<set $args[0].race = $args[1].race>>
+<<set $args[0].origRace = $args[1].origRace>>
 <<set $args[0].pubicHColor = $args[1].pubicHColor>>
 <<set $args[0].skin = $args[1].skin>>
 <<set $args[0].origSkin = $args[1].skin>>
diff --git a/src/pregmod/widgets/pregmodWidgets.tw b/src/pregmod/widgets/pregmodWidgets.tw
index 657240a6e4b..22bcb9add1f 100644
--- a/src/pregmod/widgets/pregmodWidgets.tw
+++ b/src/pregmod/widgets/pregmodWidgets.tw
@@ -1166,7 +1166,6 @@ $activeSlave.slaveName is up for review:
 /*
 <<widget "GenSkinTone">>
 
-
 black 5
 brown 4
 dark 3
@@ -1179,7 +1178,6 @@ fair -3
 pale -4
 extremely pale -5
 
-
 <<set _skin = 0>>
 <<set _skin0 = 0>>
 <<set _skin1 = 0>>
@@ -1273,11 +1271,12 @@ extremely pale -5
 <<widget "GenSkinTone">>
 <<script>>
 (function() {
-  var skinToMelanin = {'pure black': 10, ebony: 9.5, black: 9, 'dark brown': 8.5, brown: 8, 'light brown': 7.5, dark: 7, 'dark olive': 6.5, bronzed: 6, tanned: 5.5, natural: 5, olive: 4.5, 'light olive': 4, lightened: 3.5, light: 3, white: 2.5, fair: 2, 'very fair': 1.5, 'extremely fair': 1.25, pale: 1, 'extremely pale': 0.5, 'pure white': 0.001};
+  var skinToMelanin = {'pure black': 10, ebony: 9.5, black: 9, 'dark brown': 8.5, brown: 8, 'light brown': 7.5, dark: 7, 'dark olive': 6.5, bronzed: 6, tanned: 5.5, natural: 5, olive: 4.5, 'light olive': 4, lightened: 3.5, light: 3, white: 2.5, fair: 2, 'very fair': 1.5, 'extremely fair': 1.25, pale: 1, 'extremely pale': 0.5, 'pure white': 0};
   var parents = State.variables.args;
   var skin0 = parents[0] ? (skinToMelanin[parents[0].skin] || 5) : 3;
   var skin1 = parents[1] ? (skinToMelanin[parents[1].skin] || 5) : 3;
-  var skin = Math.round(Math.random() * (skin1 - skin0) + skin0);
+  var tempnum = Math.round(Math.random() * (skin1 - skin0) + skin0);
+  var skin = Math.round(tempnum * 2) / 2;
   State.variables.activeSlave.skin = ['pure white', 'extremely pale', 'pale', 'extremely fair', 'very fair', 'fair', 'white', 'light', 'lightened', 'light olive', 'olive', 'natural', 'tanned', 'bronzed', 'dark olive', 'dark', 'light brown', 'brown', 'dark brown', 'ebony', 'black', 'pure black'][skin];
 })();
 <</script>>
@@ -1373,9 +1372,7 @@ extremely pale -5
 
 <<widget "HeroSlavesCleanup">>
 <<run $heroSlaves.forEach(function(s) {
-	const validRaces = [
-		"amerindian", "asian", "black", "indo-aryan", "latina", "malay", "middle eastern", "mixed race",
-		"pacific islander", "semitic", "southern european", "white"];
+	const validRaces = ["amerindian", "asian", "black", "indo-aryan", "latina", "malay", "middle eastern", "mixed race", "pacific islander", "semitic", "southern european", "white"];
 	/* Nationalities, races, surnames random fill */
 	if(!s.nationality) {
 		s.nationality = setup.nationalityPoolSelector[Object.keys(setup.nationalityPoolSelector).random()].random();
diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw
index cc0f89c246e..161a540b303 100644
--- a/src/uncategorized/BackwardsCompatibility.tw
+++ b/src/uncategorized/BackwardsCompatibility.tw
@@ -2330,6 +2330,9 @@ Setting missing slave variables:
 <<if _Slave.race == "southern European">>
 	<<set _Slave.race = "southern european">>
 <</if>>
+<<if ndef _Slave.origRace>>
+	<<set _Slave.origRace = _Slave.race>>
+<</if>>
 
 <<if _Slave.skin == "red dyed">>
 	<<set _Slave.skin = "dyed red">>
diff --git a/src/uncategorized/generateXXSlave.tw b/src/uncategorized/generateXXSlave.tw
index 0b900ed64be..7d46ddaeecc 100644
--- a/src/uncategorized/generateXXSlave.tw
+++ b/src/uncategorized/generateXXSlave.tw
@@ -284,6 +284,7 @@
 	<<set $activeSlave.markings = either("beauty mark", "birthmark")>>
 <</if>>
 
+<<set $activeSlave.origRace = $activeSlave.race>>
 <<set $activeSlave.origEye = $activeSlave.eyeColor>>
 <<set $activeSlave.origHColor = $activeSlave.hColor>>
 <<set $activeSlave.origSkin = $activeSlave.skin>>
diff --git a/src/uncategorized/generateXYSlave.tw b/src/uncategorized/generateXYSlave.tw
index 9529bbe6918..2d1cb77846f 100644
--- a/src/uncategorized/generateXYSlave.tw
+++ b/src/uncategorized/generateXYSlave.tw
@@ -297,6 +297,7 @@
 	<<set $activeSlave.markings = either("beauty mark", "birthmark")>>
 <</if>>
 
+<<set $activeSlave.origRace = $activeSlave.race>>
 <<set $activeSlave.origEye = $activeSlave.eyeColor>>
 <<set $activeSlave.origHColor = $activeSlave.hColor>>
 <<set $activeSlave.origSkin = $activeSlave.skin>>
diff --git a/src/utility/slaveCreationWidgets.tw b/src/utility/slaveCreationWidgets.tw
index cd3a89daeeb..c746f413121 100644
--- a/src/utility/slaveCreationWidgets.tw
+++ b/src/utility/slaveCreationWidgets.tw
@@ -6,7 +6,7 @@
 	Called from Gen XX, Gen XY, CheatMode DB, InitNationalities.
 %/
 <<widget "BaseSlave">>
-	<<set $activeSlave = {slaveName: "blank", slaveSurname: 0, birthName: "blank", birthSurname: 0, genes: "XX", pronoun: "she", possessive: "her", possessivePronoun: "hers", objectReflexive: "herself", object: "her", noun: "girl", weekAcquired: 0, origin: 0, career: 0, ID: 0, prestige: 0, pornFeed: 0, pornFame: 0, pornFameSpending: 0, pornPrestige: 0, pornPrestigeDesc: 0, pornFameType: "none", pornFocus: "none", pornTypeGeneral: 0, pornTypeFuckdoll: 0, pornTypeRape: 0, pornTypePreggo: 0, pornTypeBBW: 0, pornTypeGainer: 0, pornTypeStud: 0, pornTypeLoli: 0, pornTypeDeepThroat: 0, pornTypeStruggleFuck: 0, pornTypePainal: 0, pornTypeTease: 0, pornTypeRomantic: 0, pornTypePervert: 0, pornTypeCaring: 0, pornTypeUnflinching: 0, pornTypeSizeQueen: 0, pornTypeNeglectful: 0, pornTypeCumAddict: 0, pornTypeAnalAddict: 0, pornTypeAttentionWhore: 0, pornTypeBreastGrowth: 0, pornTypeAbusive: 0, pornTypeMalicious: 0, pornTypeSelfHating: 0, pornTypeBreeder: 0, pornTypeSub: 0, pornTypeCumSlut: 0, pornTypeAnal: 0, pornTypeHumiliation: 0, pornTypeBoobs: 0, pornTypeDom: 0, pornTypeSadist: 0, pornTypeMasochist: 0, pornTypePregnancy: 0, prestigeDesc: 0, recruiter: 0, relation: 0, relationTarget: 0, relationship: 0, relationshipTarget: 0, rivalry: 0, rivalryTarget: 0, subTarget: 0, father: 0, mother: 0, daughters: 0, sisters: 0, canRecruit: 0, choosesOwnAssignment: 0, assignment: "rest", assignmentVisible: 1, sentence: 0, training: 0, toyHole: "all her holes", indenture: -1, indentureRestrictions: 0, birthWeek: random(0,51), actualAge: 18, visualAge: 18, physicalAge: 18, ovaryAge: 18, ageImplant: 0, health: 0, minorInjury: 0, trust: 0, oldTrust: 0, devotion: 0, oldDevotion: 0, weight: 0, muscles: 0, height: 170, heightImplant: 0, nationality: "slave", race: "white", markings: "none", eyes: 1, eyeColor: "brown", origEye: "brown", pupil: "circular", sclerae: "white", eyewear: "none", hears: 0, earwear: "none", earImplant: 0, origHColor: "brown", hColor: "brown", pubicHColor: "brown", skin: "light", hLength: 60, hStyle: "short", pubicHStyle: "neat", waist: 0, corsetPiercing: 0, PLimb: 0, amp: 0, heels:0, voice: 2, voiceImplant: 0, accent: 0, shoulders: 0, shouldersImplant: 0, boobs: 0, boobsImplant: 0, boobsImplantType: 0, boobShape: "normal", nipples: "cute", nipplesPiercing: 0, nipplesAccessory: 0, areolae: 0, areolaePiercing: 0, areolaeShape: "circle", boobsTat: 0, lactation: 0, lactationAdaptation: 0, milk: 0, cum: 0, hips: 0, hipsImplant: 0, butt: 0, buttImplant: 0, buttImplantType: 0, buttTat: 0, face: 0, faceImplant: 0, faceShape: "normal", lips: 15, lipsImplant: 0, lipsPiercing: 0, lipsTat: 0, teeth: "normal", tonguePiercing: 0, vagina: 0, vaginaLube: 0, vaginaPiercing: 0, vaginaTat: 0, preg: -1, pregSource: 0, pregType: 0, pregAdaptation: 50, broodmother: 0, broodmotherFetuses: 0, broodmotherOnHold: 0, broodmotherCountDown: 0, labor: 0, births: 0, cSec: 0, bellyAccessory: "none", labia: 0, clit: 0, clitPiercing: 0, clitSetting: "vanilla", foreskin: 0, anus: 0, dick: 0, analArea: 1, dickPiercing: 0, dickTat: 0, prostate: 0, balls: 0, scrotum: 0, ovaries: 0, anusPiercing: 0, anusTat: 0, makeup: 0, nails: 0, brand: 0, brandLocation: 0, earPiercing: 0, nosePiercing: 0, eyebrowPiercing: 0, navelPiercing: 0, shouldersTat: 0, armsTat: 0, legsTat: 0, backTat: 0, stampTat: 0, vaginalSkill: 0, oralSkill: 0, analSkill: 0, whoreSkill: 0, entertainSkill: 0, combatSkill: 0, livingRules: "spare", speechRules: "restrictive", releaseRules: "restrictive", relationshipRules: "restrictive", standardPunishment: "situational", standardReward: "situational", useRulesAssistant: 1, diet: "healthy", dietCum: 0, dietMilk: 0, tired: 0, hormones: 0, drugs: "no drugs", curatives: 0, chem: 0, aphrodisiacs: 0, addict: 0, fuckdoll: 0, choosesOwnClothes: 0, clothes: "no clothing", collar: "none", shoes: "none", vaginalAccessory: "none", dickAccessory: "none", legAccessory: "none", buttplug: "none", buttplugAttachment: "none", intelligence: 0, intelligenceImplant: 0, energy: 50, need: 0, attrXX: 0, attrXY: 0, attrKnown: 0, fetish: "none", fetishStrength: 70, fetishKnown: 0, behavioralFlaw: "none", behavioralQuirk: "none", sexualFlaw: "none", sexualQuirk: "none", oralCount: 0, vaginalCount: 0, analCount: 0, mammaryCount: 0, penetrativeCount: 0, publicCount: 0, pitKills: 0, customTat: "", customLabel: "", customDesc: "", customTitle: "", customTitleLisp: "", rudeTitle: 0, customImage: 0, currentRules: [], bellyTat: 0, induce: 0, mpreg: 0, inflation: 0, inflationType: "none", inflationMethod: 0, milkSource: 0, cumSource: 0, burst: 0, pregKnown: 0, pregWeek: 0, belly: 0, bellyPreg: 0, bellyFluid: 0, bellyImplant: -1, bellySag: 0, bellySagPreg: 0, bellyPain: 0, cervixImplant: 0, birthsTotal: 0, pubertyAgeXX: 13, pubertyAgeXY: 13, scars: 0, breedingMark: 0, underArmHStyle: "waxed", bodySwap: 0, HGExclude: 0, ballType: "human", eggType: "human", reservedChildren: 0, choosesOwnChastity: 0, pregControl: "none", readyLimbs: [], ageAdjust: 0, bald: 0, origBodyOwner: "", origBodyOwnerID: 0, death: "", hormoneBalance: 0, onDiet: 0, breastMesh: 0, slavesFathered: 0, PCChildrenFathered: 0, slavesKnockedUp: 0, PCKnockedUp: 0, origSkin: "white", vasectomy: 0, haircuts: 0, newGamePlus: 0, skillHG: 0, skillRC: 0, skillBG: 0, skillMD: 0, skillDJ: 0, skillNU: 0, skillTE: 0, skillAT: 0, skillST: 0, skillMM: 0, skillWA: 0, skillS: 0, skillE: 0, skillW: 0, tankBaby: 0, inducedNCS: 0, NCSyouthening: 0}>>
+	<<set $activeSlave = {slaveName: "blank", slaveSurname: 0, birthName: "blank", birthSurname: 0, genes: "XX", pronoun: "she", possessive: "her", possessivePronoun: "hers", objectReflexive: "herself", object: "her", noun: "girl", weekAcquired: 0, origin: 0, career: 0, ID: 0, prestige: 0, pornFeed: 0, pornFame: 0, pornFameSpending: 0, pornPrestige: 0, pornPrestigeDesc: 0, pornFameType: "none", pornFocus: "none", pornTypeGeneral: 0, pornTypeFuckdoll: 0, pornTypeRape: 0, pornTypePreggo: 0, pornTypeBBW: 0, pornTypeGainer: 0, pornTypeStud: 0, pornTypeLoli: 0, pornTypeDeepThroat: 0, pornTypeStruggleFuck: 0, pornTypePainal: 0, pornTypeTease: 0, pornTypeRomantic: 0, pornTypePervert: 0, pornTypeCaring: 0, pornTypeUnflinching: 0, pornTypeSizeQueen: 0, pornTypeNeglectful: 0, pornTypeCumAddict: 0, pornTypeAnalAddict: 0, pornTypeAttentionWhore: 0, pornTypeBreastGrowth: 0, pornTypeAbusive: 0, pornTypeMalicious: 0, pornTypeSelfHating: 0, pornTypeBreeder: 0, pornTypeSub: 0, pornTypeCumSlut: 0, pornTypeAnal: 0, pornTypeHumiliation: 0, pornTypeBoobs: 0, pornTypeDom: 0, pornTypeSadist: 0, pornTypeMasochist: 0, pornTypePregnancy: 0, prestigeDesc: 0, recruiter: 0, relation: 0, relationTarget: 0, relationship: 0, relationshipTarget: 0, rivalry: 0, rivalryTarget: 0, subTarget: 0, father: 0, mother: 0, daughters: 0, sisters: 0, canRecruit: 0, choosesOwnAssignment: 0, assignment: "rest", assignmentVisible: 1, sentence: 0, training: 0, toyHole: "all her holes", indenture: -1, indentureRestrictions: 0, birthWeek: random(0,51), actualAge: 18, visualAge: 18, physicalAge: 18, ovaryAge: 18, ageImplant: 0, health: 0, minorInjury: 0, trust: 0, oldTrust: 0, devotion: 0, oldDevotion: 0, weight: 0, muscles: 0, height: 170, heightImplant: 0, nationality: "slave", race: "white", origRace: "white", markings: "none", eyes: 1, eyeColor: "brown", origEye: "brown", pupil: "circular", sclerae: "white", eyewear: "none", hears: 0, earwear: "none", earImplant: 0, origHColor: "brown", hColor: "brown", pubicHColor: "brown", skin: "light", hLength: 60, hStyle: "short", pubicHStyle: "neat", waist: 0, corsetPiercing: 0, PLimb: 0, amp: 0, heels:0, voice: 2, voiceImplant: 0, accent: 0, shoulders: 0, shouldersImplant: 0, boobs: 0, boobsImplant: 0, boobsImplantType: 0, boobShape: "normal", nipples: "cute", nipplesPiercing: 0, nipplesAccessory: 0, areolae: 0, areolaePiercing: 0, areolaeShape: "circle", boobsTat: 0, lactation: 0, lactationAdaptation: 0, milk: 0, cum: 0, hips: 0, hipsImplant: 0, butt: 0, buttImplant: 0, buttImplantType: 0, buttTat: 0, face: 0, faceImplant: 0, faceShape: "normal", lips: 15, lipsImplant: 0, lipsPiercing: 0, lipsTat: 0, teeth: "normal", tonguePiercing: 0, vagina: 0, vaginaLube: 0, vaginaPiercing: 0, vaginaTat: 0, preg: -1, pregSource: 0, pregType: 0, pregAdaptation: 50, broodmother: 0, broodmotherFetuses: 0, broodmotherOnHold: 0, broodmotherCountDown: 0, labor: 0, births: 0, cSec: 0, bellyAccessory: "none", labia: 0, clit: 0, clitPiercing: 0, clitSetting: "vanilla", foreskin: 0, anus: 0, dick: 0, analArea: 1, dickPiercing: 0, dickTat: 0, prostate: 0, balls: 0, scrotum: 0, ovaries: 0, anusPiercing: 0, anusTat: 0, makeup: 0, nails: 0, brand: 0, brandLocation: 0, earPiercing: 0, nosePiercing: 0, eyebrowPiercing: 0, navelPiercing: 0, shouldersTat: 0, armsTat: 0, legsTat: 0, backTat: 0, stampTat: 0, vaginalSkill: 0, oralSkill: 0, analSkill: 0, whoreSkill: 0, entertainSkill: 0, combatSkill: 0, livingRules: "spare", speechRules: "restrictive", releaseRules: "restrictive", relationshipRules: "restrictive", standardPunishment: "situational", standardReward: "situational", useRulesAssistant: 1, diet: "healthy", dietCum: 0, dietMilk: 0, tired: 0, hormones: 0, drugs: "no drugs", curatives: 0, chem: 0, aphrodisiacs: 0, addict: 0, fuckdoll: 0, choosesOwnClothes: 0, clothes: "no clothing", collar: "none", shoes: "none", vaginalAccessory: "none", dickAccessory: "none", legAccessory: "none", buttplug: "none", buttplugAttachment: "none", intelligence: 0, intelligenceImplant: 0, energy: 50, need: 0, attrXX: 0, attrXY: 0, attrKnown: 0, fetish: "none", fetishStrength: 70, fetishKnown: 0, behavioralFlaw: "none", behavioralQuirk: "none", sexualFlaw: "none", sexualQuirk: "none", oralCount: 0, vaginalCount: 0, analCount: 0, mammaryCount: 0, penetrativeCount: 0, publicCount: 0, pitKills: 0, customTat: "", customLabel: "", customDesc: "", customTitle: "", customTitleLisp: "", rudeTitle: 0, customImage: 0, currentRules: [], bellyTat: 0, induce: 0, mpreg: 0, inflation: 0, inflationType: "none", inflationMethod: 0, milkSource: 0, cumSource: 0, burst: 0, pregKnown: 0, pregWeek: 0, belly: 0, bellyPreg: 0, bellyFluid: 0, bellyImplant: -1, bellySag: 0, bellySagPreg: 0, bellyPain: 0, cervixImplant: 0, birthsTotal: 0, pubertyAgeXX: 13, pubertyAgeXY: 13, scars: 0, breedingMark: 0, underArmHStyle: "waxed", bodySwap: 0, HGExclude: 0, ballType: "human", eggType: "human", reservedChildren: 0, choosesOwnChastity: 0, pregControl: "none", readyLimbs: [], ageAdjust: 0, bald: 0, origBodyOwner: "", origBodyOwnerID: 0, death: "", hormoneBalance: 0, onDiet: 0, breastMesh: 0, slavesFathered: 0, PCChildrenFathered: 0, slavesKnockedUp: 0, PCKnockedUp: 0, origSkin: "white", vasectomy: 0, haircuts: 0, newGamePlus: 0, skillHG: 0, skillRC: 0, skillBG: 0, skillMD: 0, skillDJ: 0, skillNU: 0, skillTE: 0, skillAT: 0, skillST: 0, skillMM: 0, skillWA: 0, skillS: 0, skillE: 0, skillW: 0, tankBaby: 0, inducedNCS: 0, NCSyouthening: 0}>>
 <</widget>>
 
 /%
-- 
GitLab