From c1d45f363f01cd5be7d24af6fe5f5ef8658cdc95 Mon Sep 17 00:00:00 2001
From: Void <okp57855@psoxs.com>
Date: Wed, 4 Oct 2017 23:30:57 +1300
Subject: [PATCH] fixed reported bugs, slightly reworked SlaveSupport and added
 ananoted code examples to the Anatomy o f a FreeCities event issue

---
 devNotes/AnatomyOfAFreeCitiesEvent          | 127 ++++++++++++++++
 src/pregmod/SlaveSupport.tw                 | 158 ++++++++++++++++++++
 src/pregmod/SlaveSupportReport.tw           |  45 ++++++
 src/uncategorized/BackwardsCompatibility.tw |   5 +-
 4 files changed, 332 insertions(+), 3 deletions(-)
 create mode 100644 devNotes/AnatomyOfAFreeCitiesEvent
 create mode 100644 src/pregmod/SlaveSupport.tw
 create mode 100644 src/pregmod/SlaveSupportReport.tw

diff --git a/devNotes/AnatomyOfAFreeCitiesEvent b/devNotes/AnatomyOfAFreeCitiesEvent
new file mode 100644
index 00000000000..684a09ec29b
--- /dev/null
+++ b/devNotes/AnatomyOfAFreeCitiesEvent
@@ -0,0 +1,127 @@
+Anatomy of a FreeCities event
+
+Type
+There are several types of events. They all happen during the end-of-week calculation, AFTER the normal changes to the slaves and all the economic effects (including you messing with your corporation) happened.
+
+Scheduled events
+Nonrandom events
+Random nonindividual events
+Random individual events
+
+The differences between them are almost non-existent. If they happen, they happen in this order, so you could say it's a kind of event priority ordering. The last two events pre-select a slave (in $eventSlave), with the "nonindividual" events using all your slaves while the "individual" events use only non-fuckdolls, typically from your penthouse. When writing your event, you're free to ignore this and choose your own slave or create a new one. By convention, scheduled events tend to go back to the "Scheduled Event" passage so that other such events can run; all the others tend to just skip to the next event category. Nothing in code forces you to do it this way for your events.
+
+Preconditions
+Most events have some kind of precondition for when they happen. Scheduled events always happen when their preconditions are true. Nonrandom events happen when their preconditions are true and no other nonrandom events get picked first (so writing a too-often-true precondition is a good way to break the game by blocking any further such events). The two other types of events get put in a pool ($events) if they match the precondition, then at most one event gets pulled from the pool per type.
+
+	NonRandomEvent (26-33)
+	<<elseif (_effectiveWeek == 14) && $badC != 1>>
+	<<set _valid = $slaves.find(function(s) { return s.curatives > 1 || s.inflationType == "curative"; })>>
+	<<if def _valid>>
+		<<set $badC = 1, $Event = "bad curatives">>
+		<<goto "Generic Plot Events">>
+	<<else>>
+		<<set $badC = 1>>
+		<<goto "Nonrandom Event">>
+	<</if>>
+		
+If it is week fourteen and the player player hasn't ready seen the event, a check is then made for slaves that either are on curatives or have their implants filled by curatives. If it was sucessful then load the "bad curatives" generic event, if unsucessful set the flag anyway and read from the Nonrandom Event passage.  
+
+Immediate effects
+
+Every event can have immediate effects, which happen when the event gets chosen. For most events, those are what should happen if the player ignores the event (by hitting "Continue" or the space bar on the keyboard). Choice effects (see below) can override or roll back those.
+
+
+Main event text
+The bulk of the writing will be in the main event text. There are quite a few rules to deal with here.
+The PC is referred to in the second person singular ("you"), everyone else in third person.
+The PC has no direct speech. All the things "you" say are described, not quoted.
+A slave can be linked with the macro <<EventNameLink _Slave>>. This allows the player to click on the slave name and view their description, then go back to the event. WARNING: Going back triggers the event passage again, so if your event has immediate effects (see above), make sure to NOT repeat them by setting corresponding flags (this is harder than it sounds in general).
+
+<<SlaveTitle _Slave>> sets $desc (which ends up being a string like "slavegirl", "MILF", "futanari" and so on, depending on slave).
+
+<<SlavePronouns _Slave>> allows you to use the variables $pronoun ("she"/"he"/"it"), $pronounCap ("She"/"He"/"It"), $possessive ("her"/"his"/"its"), $possessiveCap ("Her"/"His"/"Its") and $object ("her"/"him"/"it"). There is NO variable for self-possession ("hers"/"his"/"its") and for "herself", you need to use <<= $object>>self.
+One more macro initialises several others and is required when you have a slave speak and want to use direct quotes: <<Enunciate _Slave>> allows you to use <<Master>>, <<WrittenMaster>>, <<says>> (which turns into "lisps" when that's the case) and the lisping replacers <<s>>, <<ss>>, <<S>>, <<c>> and <<z>>.
+
+The text should be about large enough to fit on the screen assuming typical monitor sizes. In terms of visible text, about 1000 words are a fine limit to aim for. There's a lot to keep in mind in terms of different appearances and circumstances, so keep your document with slave variables as a reference nearby.
+
+It's fine - and a part of the normal workflow - to first write an event without any variation, then go through it and vary the text here and there.
+
+
+Choices
+You should keep the amount of choices small, but not too small. About three to five is generally a good number. Choices which can't be taken due to the current situation should be displayed as such ("You lack the funds ...") if they are an obvious choice, hidden when they aren't (for example, in event chains you might want to hide choices if the player didn't do something specific or didn't acquire some specific bit of knowledge). Every choice should be a simple sentence of the form "Do something." followed by a short explanation of the obvious effects.
+
+Choices should also be hidden when they run against the game rules, like for example the setting if the player wants to see "extreme" content.
+
+	diary (313-325)
+	<<if $dairyFeedersUpgrade == 1>>
+	The milking machines can hold feeders in slaves' mouths and inject drugs into their bodies, ensuring ideal nutrition and production.
+	<br>&nbsp;&nbsp;&nbsp;&nbsp;The feeders are
+	<<if $dairyFeedersSetting == 2>>
+		''industrial.'' [[Moderate|Dairy][$dairyFeedersSetting = 1, $dairyFeedersSettingChanged = -1]]
+	<<elseif $dairyFeedersSetting == 1>>
+		''active.'' [[Inactive|Dairy][$dairyFeedersSetting = 0]]<<if ($seeExtreme != 0) && ($dairyRestraintsSetting == 2)>> | [[Industrial|Dairy][$dairyFeedersSetting = 2, $dairyFeedersSettingChanged = 1]]<</if>>
+	<<else>>
+		''inactive.'' [[Active|Dairy][$dairyFeedersSetting = 1]]
+	<</if>>
+	<<else>>
+	$dairyNameCaps is equipped to feed and clean slaves normally. [[Upgrade the milking machines with intubators|Dairy][$cash -= _Tmult1, $dairyFeedersUpgrade = 1]] //Costs ¤_Tmult1 and will increase upkeep costs//
+	<</if>>
+
+	In order to enable the industrial feeder option both any of the see extreme content options has be enabled and the restraint's have to be already set to industrial. 
+
+Remember that "do nothing" is almost always a choice (it's called "Continue" and can be found on the left side of the screen) so your events don't need this as an extra choice.
+
+Choice text
+This should be a short text describing the effects of your choice. Generally shorter than the main text, but all the other things mentioned there apply.
+Try to keep surprise buttsex to a minimum.
+
+For example this cut up version of "paternalist encounter" from REFS (l:106-139).
+
+	<span id="result">
+	<<link "Alert your drones and keep walking">>
+
+	<</link>>
+	<<if $cash >= 2000>>
+	<br><<link "Take the poor slave girl into your custody">>
+	
+	<br><<link "Publicly confront the citizen">>
+
+	So here you can either, A) "Alert your drones and keep walking", B) if $cash is above 2000 you can take acquire the slave or C) "Publicly confront the citizen".   
+
+Choice effect
+A choice doesn't need to have a specific effect. If your event has an immediate effect, remember to take that into account when you decide on the choice's effects.
+
+	<span id="result">
+	<<link "Alert your drones and keep walking">>
+	<<replace "#result">>
+	You inform $assistantName that you have a slave beater in need of detainment by your security drones, then continue on your way confident in your knowledge that the citizen will soon be in custody.
+	<</replace>>
+	<</link>>
+	<<if $cash >= 2000>>
+	<br><<link "Take the poor slave girl into your custody">>
+	<<replace "#result">>
+	Confronting the citizen is simplicity in itself, he would not dare defy you under threat of arrest by your security drones and is unlikely to garner any sympathy from the public for his degradationist behaviors. As such, you are able to take civil ownership over the poor slave girl and take her into your care with only minimal compensation to the citizen. As you stride away from her former owner with the girl in your arms, she leans over to plant a chaste kiss of thanks on your cheek.
+	<<set $cash -= 2000>>
+		<<set $activeSlaveOneTimeMaxAge = 22>>
+		<<include "Generate New Slave">>
+		<<set $activeSlave.origin = "She was taken into your custody from an abusive owner.">>
+		<<set $activeSlave.devotion = random(-25,0)>>			
+		<<set $activeSlave.trust = random(-25,0)>>
+		<<set $activeSlave.boobs = random(300,450)>>
+		<<set $activeSlave.hips = random(-2,-1)>>
+		<<set $activeSlave.butt = random(0,2)>>
+		<<set $activeSlave.health = random(10,20)>>
+		<<include "New Slave Intro">>
+		<<set $nextLink = "AS Dump", $returnTo = "RIE Eligibility Check">>
+	<</replace>>
+	<</link>> // Taking custody of the girl will cost ¤2000. //
+	<</if>>
+	<br><<link "Publicly confront the citizen">>
+	<<replace "#result">>
+	Your walk up to the citizen is not accompanied by shaking ground or tumultuous fanfare, yet the citizen looks as if death itself has come before him. You don't hurt him physically, instead chastising him publicly in front of his fellow peers who begin to cheer their agreement. You end your tirade of verbal abuse with a reminder that although the man is a citizen of your arcology, that does not give him the impunity to shirk the law. To make it clear his next offense will be his last, a brace of your security drones hover behind you threateningly. The crowd that gathered @@.green;approve of your rebuke of the citizen@@.
+	<<set $rep += 500>>
+	<</replace>>
+	<</link>>
+	</span>
+
+	So here the results of the choices are, A) nothing, B) reduce cash by 2000 but acquire the slave C) chastise the citizen for plus 500 rep.
\ No newline at end of file
diff --git a/src/pregmod/SlaveSupport.tw b/src/pregmod/SlaveSupport.tw
new file mode 100644
index 00000000000..1252605dab7
--- /dev/null
+++ b/src/pregmod/SlaveSupport.tw
@@ -0,0 +1,158 @@
+:: SlaveSupport [nobr]
+
+<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "SlaveSupport", $showEncyclopedia = 1, $encyclopedia = "SlaveSupport", $SlaveSupportSlaves = $SSiIDs.length>>
+
+<<if $SlaveSupportName != "the SlaveSupport">>
+	<<set $SlaveSupportNameCaps = $SlaveSupportName.replace("the ", "The ")>>
+<</if>>
+$SlaveSupportNameCaps
+
+/* Facilities */
+
+Where should the slave be assigned?
+
+<span id="result0">
+		<<link "Barracks">>
+			<<replace "#result0">>
+			<<set $SSLevelBarracks += 1, $slaves[$i].XP + 1>>
+			<</replace>>
+		<</link>><<link ",armoury">>
+			<<replace "#result0">>
+			<<set $SSLevelArmoury += 1, $slaves[$i].XP + 1>>
+			<</replace>>
+		<</link>><<link ",stimulant Lab,,">>
+			<<replace "#result0">>
+			<<set $SSLevelStimulantLab += 1, $slaves[$i].XP + 1>>
+			<</replace>>
+		<</link>><<link "garage,">>
+			<<replace "#result0">>
+			<<set $SSLevelGarage += 1, $slaves[$i].XP + 1>>
+			<</replace>>
+		<</link>><<link "Hangar,">>
+			<<replace "#result0">>
+			<<set $SSLevelHangar += 1, $slaves[$i].XP + 1>>
+			<</replace>>
+		<</link>><<link "Drone Bay,">>
+			<<replace "#result0">>
+			<<set $SSLevelDroneBay += 1, $slaves[$i].XP + 1>>
+			<</replace>>
+		<</link>><<link "Launch Bay,">>
+			<<replace "#result0">>
+			<<set $SSLevelLaunchBay = 1, $slaves[$i].XP + 1>>
+			<</replace>><</link>>
+		<<if $terrain == "oceanic">>	
+		<</link>><<link "Naval Yard.">>
+			<<replace "#result0">>
+			<<set $SSLevelNavalYard = 1, $slaves[$i].XP + 1>>
+			<</replace>><</link>><</if>>
+<span>
+
+/* <<switch $SlaveSupportDecoration>>
+<<case "Roman Revivalist">>
+	is designed to resemble the holding pens beneath the old Coliseum. Whenever there's a fight in the arcology, screens in each cell helpfully keep inmates informed of what awaits (otherwise) useless slaves.
+<<case "Aztec Revivalist">>
+	is designed to frighten the prisoners to submission. All the cells look to the center of the facility, where a sacrificial altar stands, adorned with ceremonial <<if $arcologies[0].FSPaternalist != "unset">>ropes and penetrators<<else>>knives, ropes and blunt instruments<</if>>.
+<<case "Egyptian Revivalist">>
+	uses the climate of Egypt as an additional source of discomfort. The air here is hot and dry, and inmates can easily imagine themselves confined in mud brick cells in a baking desert.
+<<case "Edo Revivalist">>
+	is furnished in a severely medieval Japanese style. There is one refinement, but it's of exquisite cruelty. At the end of the hall, there's a fountain with a traditional bamboo boar scarer. As it fills with water, it tips against a stone with a thunk... thunk... thunk... thunk...
+<<case "Arabian Revivalist">>
+	is furnished as imagined Arabian slave pens, all set around a central pillar. This pillar is capped by shackles, so that slaves can be bound by their hands and whipped on the backs, buttocks, and thighs in clear view of all their fellow chattel.
+<<case "Chinese Revivalist">>
+	is furnished in a severely medieval Chinese style. There is one refinement, but it's of exquisite cruelty. Somewhere out of sight, water is dripping into an urn, drop by drop... drop... drop... drop...
+<<case "Chattel Religionist">>
+	is built of cold stone. Most of the cells are unfurnished little cubes inside which the only bed is the bare floor. A few are smaller still, so that the inmates can neither stand nor lie flat.
+<<case "Degradationist">>
+	is a nightmare. Everything is made of metal, and almost everything menaces with spikes of steel. Inmates must carefully avoid the walls of their own cells if they wish to avoid being stabbed.
+<<case "Asset Expansionist">>
+	is a straightforward prison, with one exception. Each cell features a screen displaying plans for its inmate's expansion. Day and night, inmates are confronted with the sight of themselves transformed.
+<<case "Transformation Fetishist">>
+	is a straightforward prison, with one exception. Each cell features a screen displaying plans for its inmate's expansion. Day and night, inmates are confronted with the sight of themselves transformed.
+<<case "Gender Radicalist">>
+	is a straightforward prison, with one exception. Each cell features a screen displaying plans for its inmate's bimbofication. Day and night, inmates are confronted with the sight of themselves dyed, pierced, tattooed, gaped, filled with implants, or all of these.
+<<case "Gender Fundamentalist">>
+	is a block of barred cells whose sides, offering a clear view of the whole prison, provide much menace. Anyone who abuses an inmate does so in full view of every other slave here, keeping the jailbirds in a state of constant fear that they're next.
+<<case "Physical Idealist">>
+	is a block of barred cells whose sides, offering a clear view of the whole prison, provide much menace. Anyone who assrapes an inmate does so in full view of every other slave here, keeping the bitches in a state of constant fear that their asses are next.
+<<case "Supremacist">>
+	is a straightforward prison whose menace is provided by context that, although subtle, adds up to a nightmare. Everyone outside the cells is $arcologies[0].FSSupremacistRace, and everyone inside them is not. The darkness of history is palpable here.
+<<case "Subjugationist">>
+	is a straightforward prison whose menace is provided by context that, although subtle, adds up to a nightmare. The inmates inside the cells are $arcologies[0].FSSubjugationistRace, and everyone outside them is not. The darkness of history is palpable here.
+<<case "Repopulation Focus">>
+	is a straightforward prison, with two exceptions. One cell style features a screen displaying plans for its inmate's impregnation, the other is covered with mirrors for its inmate to watch her pregnancy grow. Day and night, inmates are confronted with the sight of themselves transformed.
+<<case "Eugenics">>
+	is designed to make very clear to its inmates that they are subhuman. Many screens showcasing their inadequacy intermingled with propaganda play on nonstop loops.
+<<case "Paternalist">>
+	is a prison, but a modern and scientific one. The cells, the common areas, and even the color of the walls are all carefully designed to communicate the feeling that inmates can better themselves.
+<<case "Pastoralist">>
+	requires its inmates to drink as much breast milk as they can hold. This sounds like a small thing, but for an unbroken slave, conquering the revulsion of drinking another girl's milk is an important step.
+<<case "Maturity Preferentialist">>
+	is subtly designed to make very clear to its inmates that they are sex objects. Many screens showing pornography make it clear to the maturest girl here that she's still an object of lust, and will be used to slake others' pleasure.
+<<case "Youth Preferentialist">>
+	is subtly designed to make the breadth of sex acts performed in the arcology clear to its inmates. A cacophony of pornography makes clear to the most innocent inmate that her pussy is a fuck hole, her mouth is a fuck hole, her anus is a fuck hole, and, in fact, all three can be fuck holes at once.
+<<case "Body Purist">>
+	requires its inmates to drink as much filtered water as they can, all the time. This sounds like a petty thing, but most inmates are very aware that they're being flushed out. Cleaned. It is an oddly menacing thought.
+<<case "Slimness Enthusiast">>
+	is torture for chubby slaves. Fat bitches that pass through here soon learn that they're going to be slim and pretty one day, but that it isn't going to be much fun getting there.
+<<case "Hedonistic">>
+	is torture for thin slaves. The first thing they notice is the heavily reinforced cot they will reside upon. The second is the feeding tube that will be anchored in their stomach for the duration of their stay. Slaves imprisoned here will have their body stuffed to capacity with concentrated slave food, unsuring a plump, docile slave by the end of their sentence.
+<<default>>
+	could be mistaken for a modern generic office. Upon close inspection, however, reveals restraints in each cell that will hold inmates in sexually compromising positions, and compliance systems to force them to place their wrists and ankles in them.
+<</switch>> */
+
+<<if $SlaveSupportSlaves > 2>>
+	$SlaveSupportNameCaps is full of slaves, though it's difficult to tell at first.
+<<elseif $SlaveSupportSlaves > 0>>
+	$SlaveSupportNameCaps holds a few slaves, though it's difficult to tell at first. 
+
+<<else>>
+	None of your slaves are assigned in SlaveSupport. [[Decommission SlaveSupport|Main][$SlaveSupport = 0, $SlaveSupportDecoration = "standard", $SlaveSupportUpgrade = 0]]
+<</if>>
+
+<<set _Tmult0 = Math.trunc($SlaveSupport*1000*$upgradeMultiplierArcology)>>
+<br>$SlaveSupportNameCaps has room for $SlaveSupport slaves to assigned.
+[[Expand the SlaveSupport|SlaveSupport][$cash -= _Tmult0, $SlaveSupport += 5]] //Costs ¤_Tmult0//
+
+/* <br>
+<<if $SlaveSupportUpgrade == 1>>
+	Its compliance systems have been upgraded to allow slaves no mental respite, painstakingly correcting the tiniest misbehaviors to soften flaws into quirks at the cost of considerable anguish to inmates denied any rest from correction.
+<<else>>
+	<<set _Tmult1 = Math.trunc(20000*$upgradeMultiplierArcology)>>
+	Its compliance systems are standard. [[Upgrade them to soften slave flaws|SlaveSupport][$cash -= _Tmult1, $SlaveSupportUpgrade = 1]] //Costs ¤_Tmult1//
+<</if>> */
+
+<br><br>
+<<if ($SlaveSupport <= $SlaveSupportSlaves)>>
+	''$SlaveSupportNameCaps is full and cannot hold any more slaves''
+<<elseif ($slaves.length > $SlaveSupportSlaves)>>
+	<<link "''Send a slave to be assigned in the SlaveSupport''">>
+		<<replace #ComingGoing>>
+			<<resetAssignmentFilter>>
+			<<set $Flag to 0>>
+			<<include "Slave Summary">>
+		<</replace>>
+	<</link>>
+<</if>>
+
+<<if $SlaveSupportSlaves > 0>>
+	| <<link "''Let a slave out of SlaveSupport''">>
+		<<replace #ComingGoing>>
+			<<SlaveSupportAssignmentFilter>>
+			<<set $Flag = 1>>
+			<<include "Slave Summary">>
+			<<resetAssignmentFilter>>
+		<</replace>>
+	<</link>>
+<<else>>
+	<br><br>//SlaveSupport is empty for the moment.<br>//
+<</if>>
+<br><br>
+<<assignmentFilter>>
+<span id="ComingGoing">
+	<<SlaveSupportAssignmentFilter>>
+	<<set $Flag = 1>>
+	<<include "Slave Summary">>
+	<<resetAssignmentFilter>>
+</span>
+
+<br><br>Rename $SlaveSupportName: <<textbox "$SlaveSupportName" $SlaveSupportName "SlaveSupport">> //Use a noun or similar short phrase//
\ No newline at end of file
diff --git a/src/pregmod/SlaveSupportReport.tw b/src/pregmod/SlaveSupportReport.tw
new file mode 100644
index 00000000000..b44f6541844
--- /dev/null
+++ b/src/pregmod/SlaveSupportReport.tw
@@ -0,0 +1,45 @@
+:: SlaveSupport Report [nobr]
+
+<<SlaveSort $SSiIDs>>
+<<set _DL = $SSiIDs.length, $SlaveSupportSlaves = _DL, _SL = $slaves.length, _brokenSlaves = 0, _idleBonus = 0, _softenedQuirks = 0, _trustMalus = 0, _FLsFetish = 0>>
+
+<<if $SlaveSupportDecoration != "standard">>
+	<<set _devBonus = 1>>
+<<else>>
+	<<set _devBonus = 0>>
+<</if>>
+
+/* Progression at facilities */
+
+	<<set _FLs = $slaves.findIndex(function(s)>>
+
+<<if $SSLevelBarracks && $slaves[$i].XP >= 15>>
+	<<set $SSLBSCA += 1, $slaves[_FLs].devotion += 5, $slaves[_FLs].trust += 5,$slaves[_FLs].intelligence = 3,$slaves[_FLs].intelligenceImplant = 1, $slaves[_FLs].combatSkill = 1>>
+	<<elseif $SSLevelBarracks && $slaves[$i].XP >= 10>>
+	<<set $SSLBCA += 1, $slaves[_FLs].devotion += 4, $slaves[_FLs].trust += 4,$slaves[_FLs].intelligence = 2,$slaves[_FLs].intelligenceImplant = 1, $slaves[_FLs].combatSkill = 1>>
+	<<elseif if $SSLevelBarracks && $slaves[$i].XP >= 5>>
+	<<set $SSLBHC += 1, $slaves[_FLs].devotion += 3, $slaves[_FLs].trust += 3,$slaves[_FLs].intelligence = 1,$slaves[_FLs].intelligenceImplant = 0, $slaves[_FLs].combatSkill = 0>>
+	<<elseif if $SSLevelBarracks && $slaves[$i].XP >= 1>>
+	<<set $SSLBC += 1, $slaves[_FLs].devotion += 2, $slaves[_FLs].trust += 2,$slaves[_FLs].intelligence = 0,$slaves[_FLs].intelligenceImplant = 0, $slaves[_FLs].combatSkill = 0>>
+	
+<<if $SSLevelArmoury && $slaves[$i].XP >= 15>>
+	<<set $SSLASAST += 1, $slaves[_FLs].devotion += 5, $slaves[_FLs].trust += 5,$slaves[_FLs].intelligence = 3,$slaves[_FLs].intelligenceImplant = 1, $slaves[_FLs].combatSkill = 1>>
+	<<elseif $SSLevelArmoury && $slaves[$i].XP >= 10>>
+	<<set $SSLAAST += 1, $slaves[_FLs].devotion += 4, $slaves[_FLs].trust += 4,$slaves[_FLs].intelligence = 2,$slaves[_FLs].intelligenceImplant = 1, $slaves[_FLs].combatSkill = 1>>
+	<<elseif if $SSLevelArmoury && $slaves[$i].XP >= 5>>
+	<<set $SSLASM += 1, $slaves[_FLs].devotion += 3, $slaves[_FLs].trust += 3,$slaves[_FLs].intelligence = 1,$slaves[_FLs].intelligenceImplant = 0, $slaves[_FLs].combatSkill = 0>>
+	<<elseif if $SSLevelArmoury && $slaves[$i].XP >= 1>>
+	<<set $SSLAM += 1, $slaves[_FLs].devotion += 2, $slaves[_FLs].trust += 2,$slaves[_FLs].intelligence = 0,$slaves[_FLs].intelligenceImplant = 0, $slaves[_FLs].combatSkill = 0>>
+	
+<<if $SSLevelStimulantLab && $slaves[$i].XP >= 15>>
+	<<set $SSLSLPH += 1, $slaves[_FLs].devotion += 5, $slaves[_FLs].trust += 5,$slaves[_FLs].intelligence = 3,$slaves[_FLs].intelligenceImplant = 1, $slaves[_FLs].combatSkill = 1>>
+	<<elseif $SSLevelStimulantLab && $slaves[$i].XP >= 10>>
+	<<set $SSLSLSC += 1, $slaves[_FLs].devotion += 4, $slaves[_FLs].trust += 4,$slaves[_FLs].intelligence = 2,$slaves[_FLs].intelligenceImplant = 1, $slaves[_FLs].combatSkill = 1>>
+	<<elseif if $SSLevelStimulantLab && $slaves[$i].XP >= 5>>
+	<<set $SSLSLAC += 1, $slaves[_FLs].devotion += 3, $slaves[_FLs].trust += 3,$slaves[_FLs].intelligence = 1,$slaves[_FLs].intelligenceImplant = 0, $slaves[_FLs].combatSkill = 0>>
+	<<elseif if $SSLevelStimulantLab && $slaves[$i].XP >= 1>>
+	<<set $SSLC += 1, $slaves[_FLs].devotion += 2, $slaves[_FLs].trust += 2,$slaves[_FLs].intelligence = 0,$slaves[_FLs].intelligenceImplant = 0, $slaves[_FLs].combatSkill = 0>>
+	
+<<if (_DL > 0)>>
+	&nbsp;&nbsp;&nbsp;&nbsp;<<if (_DL == 1)>>''One slave has been assigned to $SlaveSupportName.''<<else>>''_DL slaves have been assigned to $SlaveSupportName.''<</if>>
+<</if>>
\ No newline at end of file
diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw
index fd045d94085..20360c197bd 100644
--- a/src/uncategorized/BackwardsCompatibility.tw
+++ b/src/uncategorized/BackwardsCompatibility.tw
@@ -579,8 +579,8 @@
 <<if ndef $securityForceFortressZeppelin>>
 	<<set $securityForceFortressZeppelin = 0>>
 <</if>>
-<<if ndef securityForceAC130>>
-	<<set securityForceAC130 = 0>>
+<<if ndef $securityForceAC130>>
+	<<set $securityForceAC130 = 0>>
 <</if>>
 <<if ndef $SSLevelDroneBay>>
 	<<set $SSLevelDroneBay = 0>>
@@ -606,7 +606,6 @@
 <<if ndef $securityForceSexedColonelToken>>
 	<<set $securityForceSexedColonelToken = 0>>
 <</if>>
-<</if>>
 <<if ndef $securityForceColonelSexed>>
 	<<set $securityForceColonelSexed = 0>>
 <</if>>
-- 
GitLab