From ab3e74ff0a5b7b408cf4a47ba3edd10e380d19b2 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Thu, 5 Mar 2020 01:22:44 -0500
Subject: [PATCH] strip old heroslave vars and add custom

---
 slave variables documentation - Pregmod.txt |  9 ++-------
 src/events/intro/initNationalities.tw       | 13 -------------
 src/js/heroCreator.js                       |  4 +++-
 src/npc/acquisition.tw                      |  8 ++++----
 src/npc/databases/customSlavesDatabase.js   |  2 ++
 5 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/slave variables documentation - Pregmod.txt b/slave variables documentation - Pregmod.txt
index 081f212b6c9..c24836b7a25 100644
--- a/slave variables documentation - Pregmod.txt	
+++ b/slave variables documentation - Pregmod.txt	
@@ -3880,16 +3880,11 @@ How to set up your own hero slave.
 -The default slave template used is defined in src/js/SlaveState.js
 
 Making your slave; add their name to the following, then go down the documentation adding in your changes.
--each variable must be separated from the last by a comma followed by a space
--each variable must be assigned to _HS
+-each variable must be separated from the last by a comma
 -if your slave's variable matches the default, you do not have to list it
 -strings MUST be in " or your slave will not compile properly
 
-<<set _HS =  App.Entity.SlaveState.makeSkeleton()>>
-<<set _HS.slaveName = "STANDARD", _HS.birthName = "STANDARD", _HS.ID = _i++>>
-<<set $heroSlaves.push(_HS)>>
-
-Once finished, add it into "customSlavesDatabase".
+Once finished, add it into "src/npc/databases/customSlavesDatabase.js".
 To test if your slave is functioning, start up a normal game, swap to cheat mode, max your rep, and view other slaveowner's stock in the slave market. If you cannot find your slave in the list, and you didn't start the game with your slave, you should double check your slave for errors. If a slave named "Blank" is present, then you likely messed up. Once you find your slave, check their description to make sure it is correct. If it is not, you messed up somewhere in setting them up.
 
 
diff --git a/src/events/intro/initNationalities.tw b/src/events/intro/initNationalities.tw
index c74149433bd..56d737c0783 100644
--- a/src/events/intro/initNationalities.tw
+++ b/src/events/intro/initNationalities.tw
@@ -898,21 +898,8 @@
 
 /* SET HEROES */
 
-<<set $heroSlaves = []>>
 <<set $activeSlave = BaseSlave()>>
 <<set $baseHeroSlave = clone($activeSlave)>>
-
-<<if ($seeDicks > 0) && ($seeDicks < 100)>>
-	<<include "D Slaves Database">>
-	<<include "DD Slaves Database">>
-	<<include "DF Slaves Database">>
-<<elseif $seeDicks == 100>>
-	<<include "DD Slaves Database">>
-<<else>>
-	<<include "D Slaves Database">>
-	<<include "DF Slaves Database">>
-<</if>>
-<<include "custom Slaves Database">>
 <<= App.Update.HeroSlavesCleanup()>>
 
 <<set $activeSlave = 0>>
diff --git a/src/js/heroCreator.js b/src/js/heroCreator.js
index 6e93af22cae..bf85df17705 100644
--- a/src/js/heroCreator.js
+++ b/src/js/heroCreator.js
@@ -6,12 +6,14 @@ App.Utils.buildHeroArray = function() {
 			App.Data.HeroSlaves.DF,
 			App.Data.HeroSlaves.Dextreme,
 			App.Data.HeroSlaves.DDextreme,
-			App.Data.HeroSlaves.DFextreme
+			App.Data.HeroSlaves.DFextreme,
+			App.Data.HeroSlaves.custom
 		);
 	} else {
 		array = App.Data.HeroSlaves.D.concat(
 			App.Data.HeroSlaves.DD,
 			App.Data.HeroSlaves.DF,
+			App.Data.HeroSlaves.custom
 		);
 	}
 	if (V.seePreg !== 1 || V.familyTesting !== 1) {
diff --git a/src/npc/acquisition.tw b/src/npc/acquisition.tw
index 28c146729dc..f07ee66ee3d 100644
--- a/src/npc/acquisition.tw
+++ b/src/npc/acquisition.tw
@@ -214,7 +214,7 @@ the new owner of $arcologies[0].name. I will offer useful information whenever p
 <br><br>
 The previous owner seems to have left in something of a hurry.
 <<set _valueGiven = 0>>
-<<set $heroSlaves = $heroSlaves.shuffle()>>
+<<set _heroSlaves = App.Utils.buildHeroArray().shuffle()>>
 <<if $cheatMode == 1>>
 	Since you've elected to take over an arcology with special advantages, you've acquired a very special group of slaves.
 	<<include [[Cheatmode Database]]>>
@@ -757,12 +757,12 @@ The previous owner seems to have left in something of a hurry.
 	<</switch>>
 <<else>>
 	They could not get all of their personal effects away. Since they <<if $targetArcology.type == "Multiculturalist">>tried to sample different kinds of sexual slavery<<else>>did not have the time in control of the arcology to develop a specific stable of sex slaves<</if>>, their slaves were quite varied.
-	<<for $j = 0; $j < $heroSlaves.length; $j++>>
+	<<for $j = 0; $j < _heroSlaves.length; $j++>>
 		<<if _valueOwed - _valueGiven <= 5000>>
 			<<break>>
 		<</if>>
-		<<set $activeSlave = App.Utils.getHeroSlave($heroSlaves[$j], $baseHeroSlave)>>
-		<<run $heroSlaves.splice($j,1)>>
+		<<set $activeSlave = App.Utils.getHeroSlave(_heroSlaves[$j], $baseHeroSlave)>>
+		<<run _heroSlaves.splice($j,1)>>
 		<<set _slaveCost = slaveCost($activeSlave)>>
 		<<if _valueGiven + _slaveCost < _valueOwed*2>>
 			<<run nationalityToAccent($activeSlave)>>
diff --git a/src/npc/databases/customSlavesDatabase.js b/src/npc/databases/customSlavesDatabase.js
index e69de29bb2d..77ad0246dd6 100644
--- a/src/npc/databases/customSlavesDatabase.js
+++ b/src/npc/databases/customSlavesDatabase.js
@@ -0,0 +1,2 @@
+App.Data.HeroSlaves.custom = [
+];
-- 
GitLab