code:
:: SpecialForceBarracksCheatEdit

<<set $nextButton = "Back to SF Barracks", $nextLink = "SFM Barracks", $returnTo = "SFM Barracks">>
<<include "SpecialForceUpgradeTree">>
__Values__
Upgrades: $SFAO/_max

''Barracks:'' <<textbox "$securityForceArcologyUpgrades" $securityForceArcologyUpgrades "SpecialForceBarracksCheatEdit">>

Max: _BarracksMax

/* ''SupportFacility:'' <<textbox "$SupportFacility" $SupportFacility "SpecialForceBarracksCheatEdit">> */

''Armory:'' <<textbox "$securityForceInfantryPower" $securityForceInfantryPower "SpecialForceBarracksCheatEdit">>

Max: _ArmouryMax

''Stimulant Lab:'' <<textbox "$securityForceStimulantPower" $securityForceStimulantPower "SpecialForceBarracksCheatEdit">>

Max: _StimulantLabMax

<<if _Garage > 0 && $securityForceArcologyUpgrades >= 1>>
	      ''Garage:''
	''LightAndMedium:'' <<textbox "$securityForceVehiclePower" $securityForceVehiclePower "SpecialForceBarracksCheatEdit">>

Max: _LightAndMediumVehiclesMax

	''HeavyBattleTank:'' <<textbox "$securityForceHeavyBattleTank" $securityForceHeavyBattleTank "SpecialForceBarracksCheatEdit">>

Max: _HeavyBattleTankMax
<</if>>

<<if $securityForceArcologyUpgrades >= 4>>
	      ''Hangar:''
	''Aircraft:'' <<textbox "$securityForceAircraftPower" $securityForceAircraftPower "SpecialForceBarracksCheatEdit">>

Max: _AircraftMax

	''Space Plane'': <<textbox "$securityForceSpacePlanePower" $securityForceSpacePlanePower "SpecialForceBarracksCheatEdit">>

Max: _SpacePlaneMax

	''Fortress Zeppelin:'' <<textbox "$securityForceFortressZeppelin" $securityForceFortressZeppelin "SpecialForceBarracksCheatEdit">>

Max: _FortressZeppelinMax

	''AC130:'' <<textbox "$securityForceAC130" $securityForceAC130 "SpecialForceBarracksCheatEdit">>

Max: _AC130Max

	''Heavy Transport:'' <<textbox "$securityForceHeavyTransport" $securityForceHeavyTransport "SpecialForceBarracksCheatEdit">>

Max: _heavyTransportMax
<</if>>

 ''DroneBay:'' <<textbox "$securityForceDronePower" $securityForceDronePower "SpecialForceBarracksCheatEdit">>

Max: _DroneBayMax

<<if (_LaunchBayNO > 0 || _LaunchBayO > 0) && $securityForceArcologyUpgrades >= 4>>
	      ''LauchBay:''
	<<if $terrain != "oceanic" && $terrain != "marine">>
		''Satellite:'' <<textbox "$securityForceSatellitePower" $securityForceSatellitePower "SpecialForceBarracksCheatEdit">>

Max: _SatelliteMax

		''GiantRobot:'' <<textbox "$securityForceGiantRobot" $securityForceGiantRobot "SpecialForceBarracksCheatEdit">>

Max: _GiantRobotMax

		''MissileSilo:'' <<textbox "$securityForceMissileSilo" $securityForceMissileSilo "SpecialForceBarracksCheatEdit">>

Max: _MissileSiloMax
	<<elseif $terrain == "oceanic" || $terrain == "marine">>
		''Satellite:'' <<textbox "$securityForceSatellitePower" $securityForceSatellitePower "SpecialForceBarracksCheatEdit">>

Max: _SatelliteMax
	<</if>>
<</if>>

<<if $terrain == "oceanic" || $terrain == "marine">>
	       ''Naval Yard:''

	''AircraftCarrier:'' <<textbox "$securityForceAircraftCarrier" $securityForceAircraftCarrier "SpecialForceBarracksCheatEdit">>

Max: _AircraftCarrierMax

	''Submarine:'' <<textbox "$securityForceSubmarine" $securityForceSubmarine "SpecialForceBarracksCheatEdit">>

Max: _SubmarineMax

	''Amphibious Transport:'' <<textbox "$securityForceHeavyAmphibiousTransport" $securityForceHeavyAmphibiousTransport "SpecialForceBarracksCheatEdit">>

Max: _HeavyAmphibiousTransportMax
<</if>>


code:
:: SpecialForceColonelSexDec
<<switch $ColonelCore>>
<<case "shell shocked">>

	The entire time it is obvious that The Colonel is reliving a horrible event.

<<link "Try to bring her back">>
	<<replace "#result7">>
	"You made an attempt to try to bring her back to the present."
	<</replace>>
	<</link>>

<<link "Leave her be">>
	<<replace "#result7">>
	"It is probably better that she tries to deal with her demons alone"
	<</replace>>
	<</link>>

<<default>>
	Inset sex noises here.
<</switch>>

repo_name: drakeashordcataclysm/fc


code:
:: SpecialForceUpgradeDec [nobr]

       ''Barracks:''
<<switch $securityForceArcologyUpgrades>>
<<case 0>>
	 Is currently quite basic, consisting of little more than a dormitory, armory, a processing facility for human spoils, and a common area, sectioned off by stacks of empty supply crates. The cavernous space, however, is ripe for expansion.
<<case 1>>
	 Has become more permanent, expanding into free space, erecting permanent dividers, and sectioning off an area for use as a garage and vehicle maintenance bay.
<<case 2>>
	 Has added a facility for the storage, maintenance, and deployment of armed combat drones, and added storage facilities for the soldiers to store their personal spoils in.
<<case 3>>
	 Has added additional support personnel and equipment, allowing the potential procurement of heavier infantry armor, fighting vehicles, and combat drones.
<<case 4>>
	 Has expanded tremendously, adding an aerial control facility and express elevator connecting to a ring of launch pads and hangars built around the arcology's upper levels. Additional facilities have been added for soldier recreation, and Spartan quarters for live-in slaves, both menial and service, have been installed.
<<case 5>>
	 Has (mostly) taken on the appearance of a professional military installation, with clearly delineated soldier and logistical areas, dedicated support and recreation facilities, in addition to advanced command and control apparatus. As a final measure, heavy, long range, electromagnetic railgun artillery pieces have been installed in casemates along the aerial launch pads, giving $securityForceName an immense superiority in local firepower.
<<case 6>>
	 Has (mostly) taken on the appearance of a professional military installation, with clearly defined soldier and logistical areas, dedicated support and recreation facilities, and advanced command and control apparatus. As a final measure, quad heavy, long range, electromagnetic railgun artillery pieces have been installed in casemates along the aerial launch pads, giving $securityForceName an immense superiority in local firepower.
<<case 7>>
	 Has (mostly) taken on the appearance of a professional military installation, with clearly defined soldier and logistical areas, dedicated support and recreation facilities, and advanced command and control apparatus. As a final measure, quad heavy, long range, electromagnetic railgun artillery pieces have been installed in fortified EMP/jammer resistant casemates along the aerial launch pads, giving $securityForceName an immense superiority in local firepower.
<<case 8>>
	 Has (mostly) taken on the appearance of a professional military installation, with clearly defined soldier and logistical areas, dedicated support and recreation facilities, and advanced command and control apparatus. As final measures, quad heavy, long range, electromagnetic railgun artillery pieces have been installed in fortified EMP/jammer resistant casemates along the aerial launch pads and a powerful arcology wide electromagnetic force field has been installed, giving $securityForceName an immense superiority in local firepower.
<<case 9>>
	 Has (mostly) taken on the appearance of a professional military installation, with clearly defined soldier and logistical areas, dedicated support and recreation facilities, and advanced command and control apparatus. As final measures, quad heavy, long range, electromagnetic railgun artillery 356 cm pieces have been installed in fortified EMP/jammer resistant casemates along the aerial launch pads and a powerful arcology wide electromagnetic force field has been installed, giving $securityForceName an immense superiority in local firepower.
<<case 10>>
	 Has (mostly) taken on the appearance of a professional military installation, with clearly defined soldier and logistical areas, dedicated support and recreation facilities, and advanced command and control apparatus. As final measures, quad heavy, long range, electromagnetic railgun artillery 406 cm pieces have been installed in fortified EMP/jammer resistant casemates along the aerial launch pads and a powerful arcology wide electromagnetic force field has been installed, giving $securityForceName an immense superiority in local firepower.
<<case 11>>
	 Has (mostly) taken on the appearance of a professional military installation, with clearly defined soldier and logistical areas, dedicated support and recreation facilities, and advanced command and control apparatus. As final measures, quad heavy, long range, double-barreled electromagnetic railgun artillery 406 cm pieces have been installed in fortified EMP/jammer resistant casemates along the aerial launch pads and a powerful arcology wide electromagnetic force field has been installed, giving $securityForceName an immense superiority in local firepower.
<<case 12>>
	 Has (mostly) taken on the appearance of a professional military installation, with clearly defined soldier and logistical areas, dedicated support and recreation facilities, and advanced command and control apparatus. As final measures, quad heavy, long range, tri-barreled electromagnetic railgun artillery 406 cm pieces have been installed in fortified EMP/jammer resistant casemates along the aerial launch pads and a powerful arcology wide electromagnetic force field has been installed, giving $securityForceName an immense superiority in local firepower.
<<case 13>>
	 Has (mostly) taken on the appearance of a professional military installation, with clearly defined soldier and logistical areas, dedicated support and recreation facilities, and advanced command and control apparatus. As final measures, quad heavy, long range, tri-barreled electromagnetic railgun artillery 406 cm pieces have been installed in fortified EMP/jammer resistant casemates along the aerial launch pads and a powerful arcology wide electromagnetic force field has been installed, giving $securityForceName an immense superiority in local firepower.

After pooling resources between several departmental R&D teams, $securityForceName now has a faster and much more efficient custom network.
<<case 14>>
	 Has (mostly) taken on the appearance of a professional military installation, with clearly defined soldier and logistical areas, dedicated support and recreation facilities, and advanced command and control apparatus. As final measures, quad heavy, long range, tri-barreled electromagnetic railgun artillery 406 cm pieces have been installed in fortified EMP/jammer resistant casemates along the aerial launch pads and a powerful arcology wide electromagnetic force field has been installed, giving $securityForceName an immense superiority in local firepower.

After pooling resources between several departmental R&D teams, $securityForceName now has a faster and much more efficient custom network.
'Borrowed' old world designs for a kill house.
<<case 15>>
	 Has (mostly) taken on the appearance of a professional military installation, with clearly defined soldier and logistical areas, dedicated support and recreation facilities, and advanced command and control apparatus. As final measures, quad heavy, long range, tri-barreled electromagnetic railgun artillery 406 cm pieces have been installed in fortified EMP/jammer resistant casemates along the aerial launch pads and a powerful arcology wide electromagnetic force field has been installed, giving $securityForceName an immense superiority in local firepower.

After pooling resources between several departmental R&D teams, $securityForceName now has a faster and much more efficient custom network.
Added electronics to the kill house.
<<case 16>>
	 Has (mostly) taken on the appearance of a professional military installation, with clearly defined soldier and logistical areas, dedicated support and recreation facilities, and advanced command and control apparatus. As final measures, quad heavy, long range, tri-barreled electromagnetic railgun artillery 406 cm pieces have been installed in fortified EMP/jammer resistant casemates along the aerial launch pads and a powerful arcology wide electromagnetic force field has been installed, giving $securityForceName an immense superiority in local firepower.

After pooling resources between several departmental R&D teams, $securityForceName now has a faster and much more efficient custom network.
Added VR support to the kill house.
<</switch>>

<<if $securityForcePersonnel < 100>>
	The barrack's large dormitories are sparsely occupied, the few members of $securityForceName residing within them concentrating together in a corner. The hundreds of empty beds and lockers visible herald the future.
<<elseif $securityForcePersonnel < 300>>
	The barrack's large dormitories are lightly occupied, with the <<print commaNum($securityForcePersonnel)>> members of $securityForceName starting to spread out across them.
<<elseif $securityForcePersonnel < 500>>
	The barrack's large dormitories are moderately occupied, though the <<print commaNum($securityForcePersonnel)>> members of $securityForceName residing within have a considerable amount of extra room.
<<elseif $securityForcePersonnel < 700>>
	The barrack's large dormitories are well-occupied, and the <<print commaNum($securityForcePersonnel)>> members of $securityForceName within have started to form small cliques based on section and row.
<<elseif $securityForcePersonnel < 1500>>
	The barrack's large dormitories are near capacity, and the <<print commaNum($securityForcePersonnel)>> members of $securityForceName often barter their personal loot, whether it be monetary or human, for the choicest bunks.
<</if>>

/*
<<if $SupportFacility == 1>>

	       ''$SupportFacilityName:''
	<<if $LieutenantColonel == 1>>
		<<SlaveFullName $LieutenantColonel>> is the Lieutenant Colonel of $securityForceName, primarily in charge of this facility.
	<</if>>
	There are
	<<if $SupportFacilitySlaves > 0>>
		 ''$SupportFacilitySlaves''
	<<else>>
			''zero''
	<</if>>
	slaves serving in $SupportFacilityName.
	The use of
	<<if $SupportFacilityUpgrade == 3>>
		a quantum teleportation system provides a massive
	<<elseif $SupportFacilityUpgrade == 2>>
		a rapid tube system provides a noticeable
	<<elseif $SupportFacilityUpgrade == 1>>
		specialized pathways provides a minor
	<<else>>
		general pathways does not provide a
	<</if>>
	boost to efficiency.

<<link "Enter the building then send a slave to serve in the HQ and facilities of $securityForceName">>
		<<goto "SupportFacility">>
	<</link>>
<</if>>
*/

       ''Armoury:''
<<switch $securityForceInfantryPower>>
<<case 0>>
	 Is well-stocked with high-quality personal weapons and light armour, but contains little in the way of exceptional armament.
<<case 1>>
	 Has large stocks of the absolute latest personal weapons and light armour, and Has added first-generation exo-suits to improve soldier lethality.
<<case 2>>
	 Acquired advanced tactical helmets and second-generation exo-suits to further improve soldier lethality.
<<case 3>>
	 Replaced deployed exo-suits with basic enclosed combat armour suits, and has further begun to deploy early electromagnetic (coilgun) weaponry.
<<case 4>>
	 Has begun to equip the soldiers with more advanced combat armour suits, and has expanded its inventory of electromagnetic weaponry.
<<case 5>>
	 Acquired heavy weapon attachments for its combat armour suits, and has further sourced small advanced electromagnetic weaponry (miniaturized railguns) for the soldiers, ensuring that the infantry of $securityForceName is perhaps the most well-equipped in the world.
<<case 6>>
	 Acquired heavy weapon attachments for its combat armour suits, and has further sourced both small and medium advanced electromagnetic weaponry (miniaturized railguns) for the soldiers, ensuring that the infantry of $securityForceName is perhaps the most well-equipped in the world.
<<case 7>>
	 Acquired heavy weapon attachments for its combat armour suits, and has further sourced small/medium and large advanced electromagnetic weaponry (miniaturized railguns) for the soldiers, ensuring that the infantry of $securityForceName is perhaps the most well-equipped in the world.
<<case 8>>
	 Acquired heavy weapon attachments for its combat armour suits with basic thrusters, and has further sourced both small/medium and large advanced electromagnetic weaponry (miniaturized railguns) for the soldiers, ensuring that the infantry of $securityForceName is perhaps the most well-equipped in the world.
<<case 9>>
	 Acquired heavy weapon attachments for its combat armour suits with advanced thrusters, and has further sourced both small/medium and large advanced electromagnetic weaponry (miniaturized railguns) for the soldiers, ensuring that the infantry of $securityForceName is perhaps the most well-equipped in the world.
<<case 10>>
	 Acquired heavy weapon attachments for its combat armour suits with advanced thrusters,basic optical illusion kits, and has further sourced small/medium and large advanced electromagnetic weaponry (miniaturized railguns) for the soldiers, ensuring that the infantry of $securityForceName is perhaps the most well-equipped in the world.
<<case 11>>
	 Acquired heavy weapon attachments for its combat armour suits with advanced thrusters,advanced optical illusion kits, and has further sourced small/medium and large advanced electromagnetic weaponry (miniaturized railguns) for the soldiers, ensuring that the infantry of $securityForceName is perhaps the most well-equipped in the world.
<<case 12>>
	 Acquired heavy weapon attachments for its combat armour suits with advanced thrusters,advanced optical illusion kits, and has further sourced small/medium and large advanced nanite rather than electromagnetic weaponry (miniaturized nanite rifes) for the soldiers, ensuring that the infantry of $securityForceName is perhaps the most well-equipped in the world.
<</switch>>

       ''Stimulant Lab:''
<<switch $securityForceStimulantPower>>
<<case 0>>
	 Is providing the soldiers with standard ephedrine-based stimulants.
<<case 1>>
	 Improved the formula of the ephedrine-based stimulants, concentrating them and increasing both their potency, and the effectiveness of the soldiers under their influence.
<<case 2>>
	 Replaced the soldiers' stimulants with methamphetamine-based variants, greatly increasing their alertness and aggressiveness when under their influence.
<<case 3>>
	 Improved and concentrated the methamphetamine-based stimulants, and has also begun providing soldiers with phencyclidine-based dissociatives, allowing the soldiers to excuse their actions in the field and reducing any reluctance to follow severe orders.
<<case 4>>
	 Has further refined the formulas of the methamphetamine-based stimulants and phencyclidine-based dissociatives, and has also begun providing tryptamine-based psychedelics to the soldiers, allowing them to avoid traumatic stress in the field.
<<case 5>>
	 Has maximally refined the formulas of the methamphetamine-based stimulants, phencyclidine-based dissociatives, and tryptamine-based psychedelics, increasing their effectiveness in all aspects and ensuring that the soldiers of $securityForceName go into combat wired, aggressive, and euphoric (if needed).
<<case 6>>
	 Has slightly refined the formulas of higher purity methamphetamine-based stimulants, phencyclidine-based dissociatives, and tryptamine-based psychedelics, increasing their effectiveness in all aspects and ensuring that the soldiers of $securityForceName go into combat wired, aggressive, and euphoric (if needed).
<<case 7>>
	 Has maximally refined the formulas of higher purity methamphetamine-based stimulants, phencyclidine-based dissociatives, and tryptamine-based psychedelics, increasing their effectiveness in all aspects and ensuring that the soldiers of $securityForceName go into combat wired, aggressive, and euphoric (if needed).
<<case 8>>
	 Has mixed the higher purity methamphetamine-based stimulants, phencyclidine-based dissociatives, and tryptamine-based psychedelics into a single dose further increasing their effectiveness in all aspects and ensuring that the soldiers of $securityForceName go into combat wired, aggressive, and euphoric (if needed). However side effects may include (no particular order): Dissociative Identity Disorder , severe clinical depression, unstoppable vomiting, extreme paranoia, PTSD, finally total organ failure. Recommended by 9/10 doctors*.
* Only the doctors of $securityForceName were consulted to ensure a completely unbiased result.
<<case 9>>
	 Has mixed the higher purity methamphetamine-based stimulants, phencyclidine-based dissociatives, and tryptamine-based psychedelics into a single dose further increasing their effectiveness in all aspects and ensuring that the soldiers of $securityForceName go into combat wired, aggressive, and euphoric (if needed). Potential side effects have been reduced slightly to “only mildly” severe ones: Dissociative Identity Disorder , severe clinical depression, unstoppable vomiting, extreme paranoia and PTSD. Now recommended by 15/10 doctors*.
* Only the doctors of $securityForceName were consulted to ensure a completely unbiased result.
<<case 10>>
	 Has increased the single dose strength of the mixture of higher purity methamphetamine-based stimulants, phencyclidine-based dissociatives, and tryptamine-based psychedelics which further increases their effectiveness in all aspects and ensuring that the soldiers of $securityForceName go into combat wired, aggressive, and euphoric (if needed) at the cost of lengthening the effects.

Potentinal side effects have been reduced slightly to "only mildly" severe ones: Dissociative Identity Disorder , severe clinical depression, unstoppable vomiting, extreme paranoia and PTSD. Now recommended by 15/10 doctors*.
* Only the doctors of $securityForceName were consulted to ensure a completely unbiased result.
<</switch>>

<<if _Garage > 0 && $securityForceArcologyUpgrades >= 1>>

       ''Garage:''
<<switch $securityForceVehiclePower>>
<<case 0>>
	 Contains basic, unarmoured vehicles for use by the soldiers, primarily high-end civilian vehicles with jury-rigged crew-served weapons.
<<case 1>>
	 Replaced its technical fleet with armed military utility vehicles. It has also sourced customized, high-volume slave transports for better securing human spoils.
<<case 2>>
	 Has added a number of light infantry fighting vehicles to its fleet, and acquired more slave transports to keep up with demand.
<<case 3>>
	 Acquired improved infantry fighting vehicles, and has also added some mobile artillery and other support vehicles.
<<case 4>>
	 Acquired some heavier armoured vehicles to augment the infantry fighting vehicles and expanded their inventory of artillery and support vehicles.
<<case 5>>
	 Replaced both its armoured and support vehicles with the most advanced variants possible, making the mobile unit of $securityForceName far superior to anything in the arcology's immediate area.
<<case 6>>
	 Replaced both its armoured and support vehicles with the most advanced light variants possible, making the mobile unit of $securityForceName far superior to anything in the arcology's immediate area.
<<case 7>>
	 Replaced both its armoured and support vehicles with the most advanced light and medium variants possible, making the mobile unit of $securityForceName far superior to anything in the arcology's immediate area.
<<case 8>>
	 Replaced both its armoured and support vehicles with the most advanced light, medium and heavy variants possible, making the mobile unit of $securityForceName far superior to anything in the arcology's immediate area.
<</switch>>

<<if $securityForceHeavyBattleTank > 0>>

''Heavy Battle Tank:''
<<switch $securityForceHeavyBattleTank>>
<<case 1>>
	A basic heavy battle tank has been 'borrowed' from the old world.
<<case 2>>
	Modernised the armour.
<<case 3>>
	Modernised the armour and upgraded the main gun to a 356 cm barrel.
<</switch>>
<</if>>
<</if>>

<<if $securityForceArcologyUpgrades >= 4>>

       ''Hangar:''

''Airforce:''
<<switch $securityForceAircraftPower>>
<<case 0>>
	Primarily consists of light transport VTOL's equipped with non-lethal weaponry.
<<case 1>>
	Upgraded light transport VTOL's  with additional fire-power and lethal weaponry.
<<case 2>>
	The VTOL's have been upgraded to higher-capacity variants with heavier weaponry.
<<case 3>>
	The medium transport VTOL's have been upgraded with enhanced armour and customized cargo compartments to better transport captured stock.
<<case 4>>
	Acquired specialized attack VTOL's to complement and escort its advanced transport fleet, as well as to provide close air support.
<<case 5>>
	Upgraded its attack VTOL's for enhanced lethality, and further improved the armour and armament of its transport VTOL's, ensuring that the airfleet of $securityForceName is amongst the most capable still in operation in the area.
<<case 6>>
	Upgraded its attack VTOL's for enhanced lethality/speed, and further improved the armour and armament of its transport VTOL's, ensuring that the airfleet of $securityForceName is amongst the most capable still in operation in the area.
<<case 7>>
	Upgraded its attack VTOL's for enhanced lethality/speed/armour, and further improved the armour and armament of its transport VTOL's, ensuring that the airfleet of $securityForceName is amongst the most capable still in operation in the area.
<<case 8>>
	Upgraded its attack VTOL's for enhanced lethality/speed/armour, and further improved the armour and armament of its transport VTOL's, ensuring that the airfleet of $securityForceName is amongst the most capable still in operation in the area.
Also It now possesses a basic old world bomber.
<<case 9>>
	Upgraded its attack VTOL's for enhanced lethality/speed/armour, and further improved the armour and armament of its transport VTOL's, ensuring that the airfleet of $securityForceName is amongst the most capable still in operation in the area.
Improved the bomber's engines.
<<case 10>>
	Upgraded its attack VTOL's for enhanced lethality/speed/armour, and further improved the armour and armament of its transport VTOL's, ensuring that the airfleet of $securityForceName is amongst the most capable still in operation in the area.
Improved the bomber's engines and armour.
<</switch>>
<<if $securityForceSpacePlanePower > 0>>

''Space Plane:''
<<switch $securityForceSpacePlanePower>>
	<<case 1>>
		A basic twin engine space plane has been 'borrowed' from the old world.
	<<case 2>>
		Upgraded the shielding, reducing both potential heat damage and radar signature.
	<<case 3>>
		Upgraded the shielding, reducing both potential heat damage and radar signature, also mounted another engine on top of the tail.
	<<case 4>>
		Upgraded the shielding, reducing both potential heat damage and radar signature, mounted another engine on top of the tail and modernized the electronics.
	<<case 5>>
		Upgraded the shielding, reducing both potential heat damage and radar signature, mounted another engine on top of the tail, modernized the electronics in addition to the fuel lines to increase efficiency.
		<<case 6>>
		Upgraded the shielding, reducing both potential heat damage and radar signature, mounted another engine on top of the tail. Modernized the electronics in addition to the fuel lines to increase efficiency and the engines to allow for more efficient fuel.
	<<case 7>>
		Upgraded the shielding, reducing both potential heat damage and radar signature, mounted another engine on top of the tail. Modernized the electronics in addition to the fuel lines to increase efficiency and the engines to allow for more efficient fuel. Reduced the weight and reworked the body to reduce drag.
	<<case 8>>
		Upgraded the shielding, reducing both potential heat damage and radar signature, mounted another engine on top of the tail. Modernized the electronics in addition to the fuel lines to increase efficiency and the engines to allow for more efficient fuel. Reduced the weight and reworked the body to reduce drag. Increased the crew comfort and life support systems to increase operational time.
	<<case 9>>
		Upgraded the shielding, reducing both potential heat damage and radar signature, mounted another engine on top of the tail. Modernized the electronics in addition to the fuel lines to increase efficiency and the engines to allow for more efficient fuel. Reduced the weight and reworked the body to reduce drag. Increased the crew comfort and life support systems to increase operational time. Added an engine per wing which greatly increases acceleration and raises the top speed to mach 15, making the Space Plane of $securityForceName untouchable.
	<<case 10>>
		Upgraded the shielding, reducing both potential heat damage and radar signature, mounted another engine on top of the tail. Modernized the electronics in addition to the fuel lines to increase efficiency and the engines to allow for more efficient fuel. Reduced the weight and reworked the body to reduce drag. Increased the crew comfort and life support systems to increase operational time. Added an engine per wing which greatly increases acceleration and raises the top speed to mach 15, making the Space Plane of $securityForceName untouchable. Replaced the skin with a basic optical illusion kit.
	<<case 11>>
		Upgraded the shielding, reducing both potential heat damage and radar signature, mounted another engine on top of the tail. Modernized the electronics in addition to the fuel lines to increase efficiency and the engines to allow for more efficient fuel. Reduced the weight and reworked the body to reduce drag. Increased the crew comfort and life support systems to increase operational time. Added an engine per wing which greatly increases acceleration and raises the top speed to mach 15, making the Space Plane of $securityForceName untouchable. Replaced the skin with an advanced optical illusion kit.
	<<case 12>>
		Upgraded the shielding, reducing both potential heat damage and radar signature, mounted another engine on top of the tail. Modernized the electronics in addition to the fuel lines to increase efficiency and the engines to allow for more efficient fuel. Reduced the weight and reworked the body to reduce drag. Increased the crew comfort and life support systems to increase operational time. Added VTOL capabilities into an additional engine per wing which greatly increases acceleration and raises the top speed to Mach 15, making the Space Plane of $securityForceName untouchable. Replaced the skin with an advanced optical illusion kit.
<</switch>>
<</if>>
<<if $securityForceFortressZeppelin > 0>>

''Fortress Zeppelin:''
<<switch $securityForceFortressZeppelin>>
	<<case 1>>
		A basic fortress Zeppelin has been 'borrowed' from the old world.
	<<case 2>>
		Modernized the armour.
	<<case 3>>
		Modernized the armour and weaponry.
	<<case 4>>
		Modernized the armour and weaponry. Improved the speaker system.
<</switch>>
<</if>>
<<if $securityForceAC130 > 0>>

''AC130:''
<<switch $securityForceAC130>>
	<<case 1>>
		A basic AC-130 has been 'borrowed' from the old world.
	<<case 2>>
		Modernized the armour.
	<<case 3>>
		Modernized the armour and weaponry.
	<<case 4>>
		Modernized the armour, weaponry and electronics.
	<<case 5>>
		Modernized the armour, weaponry, electronics and crew seating.
	<<case 6>>
		Modernized the armour, weaponry, electronics and crew seating. Increased the speed and maneuverability.
<</switch>>
<</if>>
<<if $securityForceHeavyTransport > 0>>

''Heavy Transport:''
<<switch $securityForceHeavyTransport>>
	<<case 1>>
		A basic heavy transport has been 'borrowed' from the old world.
	<<case 2>>
		Modernized the armour.
	<<case 3>>
		Modernized the armour and engines.
	<<case 4>>
		Modernized the armour and engines. Replaced the ballistic gun mounts with electromagnetic ones.
<</switch>>
<</if>>
<</if>>

<<if $securityForceArcologyUpgrades >= 2>>

       ''Drone Bay:''
<<switch  $securityForceDronePower>>
<<case 0>>
	 Contains a small number of 're-purposed' non-military drones from the arcology's original contingent.
<<case 1>>
	 Replaced the security drones with basic, lightly-armored military combat models possessing integrated small arms.
<<case 2>>
	 Replaced its basic military drones with more advanced models and added a number of support drones carrying heavy weaponry to its fleet.
<<case 3>>
	 Acquired even more advanced models of both the standard combat drones and the heavy support drones, and expanded its numbers of both.
<<case 4>>
	 Has acted to upgrade both the standard and support models of drones to carry basic electromagnetic weaponry, improving their overall combat effectiveness.
<<case 5>>
	 Improved the electromagnetic armament of its drones by mounting both miniaturized and heavy railguns on them. In addition further sourcing numerous models of drones for roles as diverse as reconnaissance, independent slave capture and swarming tactics.
<<case 6>>
	 Acquired even lighter advanced armored combat Drones with electromagnetic weaponry, advanced heavy Drones with electromagnetic support weaponry along with specialized Drones for reconnaissance, capture, and swarm tactics.
<<case 7>>
	 Acquired even lighter advanced thicker armored combat Drones with electromagnetic weaponry, advanced heavy Drones with electromagnetic support weaponry along with specialized Drones for reconnaissance, capture, and swarm tactics.
<<case 8>>
	 Acquired even lighter advanced thicker armored combat Drones with nanite rather than electromagnetic weaponry, advanced heavy Drones with electromagnetic support weaponry along with specialized Drones for reconnaissance, capture, and swarm tactics.
<</switch>>
<</if>>

<<if (_LaunchBayNO > 0 || _LaunchBayO > 0) && $securityForceArcologyUpgrades >= 4>>

       ''Launch Bay:''
<<if $securityForceSatellitePower > 0>>

''Satellite:''
<<switch $securityForceSatellitePower>>
	<<case 1>>
		A basic Satellite has been 'borrowed' from the old world.
	<<case 2>>
		Modernized the electronics.
	<<case 3>>
		Modernized the electronics, wiring, and circuitry.
	<<case 4>>
		Modernized the electronics, wiring, and circuitry. Installed a basic localized communications jammer to the Satellite (excludes your own frequencies with little to no leeway) that will "slightly" anger locals until it is deactivated.
	<<case 5>>
		Modernized the electronics, wiring, and circuitry. An advanced communications jammer is installed in the Satellite, increasing the AO localization, reducing the number of affected equipment.
	<<case 6>>
		Modernized the electronics, wiring, and circuitry. Boosted the advanced comms jammer power by 25% (now can damage affected equipment).
	<<case 7>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment).
	<<case 8>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment). The Satellite is now equipped with a basic EMP generator (advanced EMP hardening was applied before the insulation and activation) that will "slightly" anger locals until it is deactivated.
	<<case 9>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment). The Satellite is now equipped with an advanced EMP generator by, increasing the AO localization which reduces the quantity of affected equipment.
	<<case 10>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment) and the output of the advanced EMP generator by 25% (now can damage affected equipment).
	<<case 11>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment) and the output of the advanced EMP generator by 50% (now can destroy affected equipment).
	<<case 12>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment) and the output of the advanced EMP generator by 50% (now can destroy affected equipment). Provided R&D funds to be able to shoot a concentrated beam of pure energy that is able to level an entire city block. It required overhauling the battery system and shielding.
	<<case 13>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment) and the output of the advanced EMP generator by 50% (now can destroy affected equipment). Provided R&D funds to focus the beam enough to level a suburb.
	<<case 14>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment) and the output of the advanced EMP generator by 50% (now can destroy affected equipment). Provided R&D funds to focus the beam enough to level a block of houses.
	<<case 15>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment) and the output of the advanced EMP generator by 50% (now can destroy affected equipment). Provided R&D funds to focus the beam enough to level a single house.
	<<case 16>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment) and the output of the advanced EMP generator by 50% (now can destroy affected equipment). Provided R&D funds to focus the beam enough to level 366 cm.
	<<case 17>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment) and the output of the advanced EMP generator by 50% (now can destroy affected equipment). Provided R&D funds to focus the beam enough to level 30 cm.
	<<case 18>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment) and the output of the advanced EMP generator by 50% (now can destroy affected equipment). Provided R&D funds to focus the beam enough to level 15 cm.
	<<case 19>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment) and the output of the advanced EMP generator by 50% (now can destroy affected equipment). Provided R&D funds to switch the 15 cm wide beam from laser to nanites.
	<<case 20>>
		Modernized the electronics, wiring, and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment) and the output of the advanced EMP generator by 50% (now can destroy affected equipment). Provided R&D funds to switch the 15 cm wide beam from laser to nanites and allow the beam to be split (if needed).
	<<case 21>>
		Modernized the electronics (in addition to overclocking), wiring and circuitry. Boosted the power of the advanced comms jammer by 50% (now can destroy affected equipment) and the output of the advanced EMP generator by 50% (now can destroy affected equipment). Provided R&D funds to switch the 15 cm wide beam from laser to nanites and allow the beam to be split (if needed).
<</switch>>
<</if>>
<<if $securityForceGiantRobot > 0>>

''Giant Robot'':
<<switch $securityForceGiantRobot>>
	<<case 1>>
		An old world giant robot has been 'Borrowed'.
	<<case 2>>
		Upgraded the wiring and circuitry.
	<<case 3>>
		Upgraded the wiring, circuitry, and power efficiency.
	<<case 4>>
		Upgraded the wiring, circuitry, and power efficiency. Reduced the weight.
	<<case 5>>
		Upgraded the wiring, circuitry, power efficiency, and battery capacity. Reduced the weight.
	<<case 6>>
		Upgraded the wiring, circuitry, power efficiency, battery capacity, and armor. Reduced the weight.
	<<case 7>>
		Upgraded the wiring, circuitry, power efficiency, battery capacity, armor and weapons to include heat seeking missiles plus a massive long sword in addition to quad 356 cm back mounted electromagnetic cannons.
	<<case 8>>
		Upgraded the wiring, circuitry, power efficiency, battery capacity, armor and weapons to include heat seeking missiles plus a massive long sword in addition to quad 356 cm back mounted electromagnetic cannons and the amount of pilots to two via a synced neural link.
	<<case 9>>
		Upgraded the wiring, circuitry, power efficiency, battery capacity, armor and weapons to include heat seeking missiles plus a massive long sword in addition to quad 356 cm back mounted electromagnetic cannons. Increased the number of pilots to two via a synced neural link. Improved the life support systems, allowing for longer operational time.
	<<case 10>>
		Upgraded the wiring, circuitry, power efficiency, battery capacity, armor and weapons to include heat seeking missiles plus a massive long sword in addition to quad 356 cm back mounted electromagnetic cannons. Increased the number of pilots to two via a synced neural link. Improved the life support systems, allowing for longer operational time. Replaced the skin of $securityForceName's giant robot with a basic optical illusion kit.
	<<case 11>>
		Upgraded the wiring, circuitry, power efficiency, battery capacity, armor and weapons to include heat seeking missiles plus a massive long sword in addition to quad 356 cm back mounted electromagnetic cannons. Increased the number of pilots to two via a synced neural link. Improved the life support systems, allowing for longer operational time. Replaced the skin of $securityForceName's giant robot with an advanced optical illusion kit.
	<<case 12>>
		Upgraded the wiring, circuitry, power efficiency, battery capacity, armor and weapons to include heat seeking missiles, a massive long sword, quad 356 cm back mounted nanite rather than electromagnetic cannons. Increased the number of pilots to two via a synced neural link. Improved the life support systems, allowing for longer operational time. Replaced the skin of $securityForceName's giant robot with an advanced optical illusion kit.
	<<case 13>>
		Upgraded the wiring, circuitry, power efficiency, battery capacity, armor and weapons to include heat seeking missiles, a massive long sword, quad 356 cm back mounted nanite rather than electromagnetic cannons. Increased the number of pilots to two via a synced neural link. Improved the life support systems, allowing for longer operational time. Replaced the skin of $securityForceName's giant robot with an advanced optical illusion kit. Added hover capabilities.
	<<case 14>>
		Upgraded the wiring, circuitry, power efficiency, battery capacity, armor and weapons to include heat seeking missiles, a massive long sword, quad 356 cm back mounted nanite rather than electromagnetic cannons and a massive wrist mounted shield. Increased the number of pilots to two via a synced neural link. Improved the life support systems, allowing for longer operational time. Replaced the skin of $securityForceName's giant robot with an advanced optical illusion kit. Added hover capabilities.
	<<case 15>>
		Upgraded the wiring, circuitry, power efficiency, battery capacity, armor and weapons to include heat seeking missiles, a massive long sword, quad 356 cm back mounted nanite rather than electromagnetic cannons, a massive wrist mounted shield and electric fists. Increased the number of pilots to two via a synced neural link. Improved the life support systems, allowing for longer operational time. Replaced the skin of $securityForceName's giant robot with an advanced optical illusion kit. Added hover capabilities.
	<<case 16>>
		Upgraded the wiring, circuitry, power efficiency, battery capacity, armor and weapons to include heat seeking missiles, a massive long sword, quad 356 cm back mounted nanite rather than electromagnetic cannons, a massive wrist mounted shield and electric fists. Increased the number of pilots to two via a synced neural link. Improved the life support systems, allowing for longer operational time. Replaced the skin of $securityForceName's giant robot with an advanced optical illusion kit. Added hover capabilities. Overclocked the movement systems allowing for greater mobility.
<</switch>>
<</if>>
<<if $securityForceMissileSilo > 0>>

''Missile Silo:''
<<switch $securityForceMissileSilo>>
	<<case 1>>
		A basic missile silo has been 'borrowed' from the old world.
	<<case 2>>
		Modernized the launching electronics.
	<<case 3>>
		Modernized the launching electronics, wiring and circuitry.
<</switch>>
<</if>>
<</if>>

<<if _NavalYard > 0 && ($terrain == "oceanic" || $terrain == "marine")>>

       ''Naval Yard:''
<<if $securityForceAircraftCarrier > 0>>

''Aircraft Carrier:''
<<switch $securityForceAircraftCarrier>>
	<<case 1>>
		A basic aircraft carrier has been 'borrowed' from the old world.
	<<case 2>>
		Modernized the electronics.
	<<case 3>>
		Modernized the electronics and weaponry.
	<<case 4>>
		Modernized the electronics, weaponry and armor.
	<<case 5>>
		Modernized the electronics, weaponry and armor. Added an EMP generator.
	<<case 6>>
		Modernized the electronics, weaponry and armor. Added an EMP generator and laser designator.
<</switch>>
<</if>>
<<if $securityForceSubmarine > 0>>

''Submarine:''
<<switch $securityForceSubmarine>>
	<<case 1>>
		A basic submarine has been 'borrowed' from the old world.
	<<case 2>>
		Modernized the engines for speed.
	<<case 3>>
		Modernized the engines for speed and silence.
	<<case 4>>
		Modernized the engines for speed and silence. Upgraded the hull for silence.
	<<case 5>>
		Modernized the engines for speed and silence. Upgraded the hull for silence and weaponry.
	<<case 6>>
		Modernized the engines for speed and silence. Upgraded the hull for silence, weaponry and air scrubbers, allowing it to stay submerged for longer.
	<<case 7>>
		Modernized the engines for speed and silence. Upgraded the hull for silence, weaponry and air scrubbers, allowing it to stay submerged for longer. Overclocked the sonar, increasing its ping speed.
<</switch>>
<</if>>
<<if $securityForceHeavyAmphibiousTransport > 0>>

''Heavy Amphibious Transport:''
<<switch $securityForceHeavyAmphibiousTransport>>
	<<case 1>>
		A basic heavy amphibious transport has been 'borrowed' from the old world.
	<<case 2>>
		Modernized the armor.
	<<case 3>>
		Modernized the armor and speed.
	<<case 4>>
		Modernized the armor and speed. Added miniaturized railguns in all four corners.
	<<case 5>>
		Modernized the armor and speed. Added miniaturized railguns in all four corners and a laser designator in the middle.
	<<case 6>>
		Modernized the armor and speed. Replaced the corner miniaturized railguns with nanite ones while keeping the laser designator in the middle.
<</switch>>
<</if>>
<</if>>


code:
:: SpecialForceUpgradeOptions [nobr]
<<set _costDebuff = 1>>
<<set $HackingSkillMultiplier = HSM()>>
<<if ($SFAO < _max) && $securityForceUpgradeToken == 0>>

Which facility or equipment do you wish _Name to upgrade this week?
	<<if _Barracks < 1 || _Barracks < 2 || _Barracks < 4>>
      More barracks upgrades are required to unlock further options.<</if>>

		<<if $securityForceUpgradeToken == 0 && _Barracks < 5>>

<<link "Barracks">>
			<<replace "#resultX">>

				"Sure, boss." she says, nodding. "Expanding the facilities here should help us support more cool shit." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
				<<set $securityForceUpgradeToken = 1, $securityForceArcologyUpgrades++, $cash -= 100000*$Env*_costDebuff>>
			<</replace>>
			<</link>> // Costs <<print cashFormat(100000*$Env*_costDebuff)>> //
		<<elseif $securityForceUpgradeToken == 0 && $securityForceArcologyUpgrades < _BarracksMax && $TierTwoUnlock == 1>>
			<<switch _Barracks>>
			<<case 5>>
				<<set _arcCost = 1500000>>
			<<case 6>>
				<<set _arcCost = 2000000>>
			<<case 7>>
				<<set _arcCost = 3500000>>
			<<case 8>>
				<<set _arcCost = 5500000>>
			<<case 9>>
				<<set _arcCost = 1250000>>
			<<case 10>>
				<<set _arcCost = 3500000>>
			<<case 11>>
				<<set _arcCost = 6000000>>
			<<case 12>>
				<<set _arcCost = 25000000>>
			<<case 13>>
				<<set _arcCost = 50000000>>
			<<case 14>>
				<<set _arcCost = 60000000>>
			<<case 15>>
				<<set _arcCost = 95000000>>
			<</switch>>

<<link "Barracks">>
			<<replace "#resultX">>

				"Sure, boss." she says, nodding. "Expanding the facilities here should help us support more cool shit." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
				<<set $securityForceUpgradeToken = 1, $securityForceArcologyUpgrades++, $cash -= _arcCost*$Env*_costDebuff>>
			<</replace>>
			<</link>> // Costs <<print cashFormat(_arcCost*$Env*_costDebuff)>> //
		<<elseif $securityForceUpgradeToken == 0 && $securityForceArcologyUpgrades == 12 && _Armoury >= 11 && _StimulantLab >= 7 && $securityForceVehiclePower >= 7 && $securityForceAircraftPower >= 8 && $securityForceSpacePlanePower >= 11 && $securityForceFortressZeppelin >= 3 && $securityForceAC130 >= 5 && _DroneBay >= 6 && $securityForceSatellitePower >= 16>>

<<link "Barracks">>
			<<replace "#resultX">>

				"Sure, boss." she says, nodding. "Expanding the facilities here should help us support more cool shit." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
				<<set $securityForceUpgradeToken = 1, $securityForceArcologyUpgrades++, $cash -= _arcCost*$Env*_costDebuff>>
			<</replace>>
			<</link>> // Costs <<print cashFormat(_arcCost*$Env*_costDebuff)>> //
		<<elseif $securityForceUpgradeToken == 0 && $securityForceArcologyUpgrades == 13>>

<<link "Barracks">>
			<<replace "#resultX">>

				"Sure, boss." she says, nodding. "Expanding the facilities here should help us support more cool shit." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
				<<set $securityForceUpgradeToken = 1, $securityForceArcologyUpgrades++, $cash -= _arcCost*$Env*_costDebuff>>
			<</replace>>
			<</link>> // Costs <<print cashFormat(_arcCost*$Env*_costDebuff)>> //
		<</if>>
		<<if _Barracks == _BarracksMax>>

//$securityForceName has fully upgraded the barracks to support its activities//
		<</if>>

		/*
		<<if $securityForceUpgradeToken == 0 && $TierTwoUnlock == 1 && $SupportFacility == 0>>

<<link "Support Facility">>
				<<replace "#resultX">>

				"Sure, boss." she says, nodding. "Creating a specialised area for any slaves you send to assist us will benefical to everyone."
				<<set $securityForceUpgradeToken = 1, $SupportFacility++, $cash -= Math.trunc(15000000*(Math.max(0.99,$SFAO)/10)*$Env*_costDebuff)>>
				<<set $SFIDs = [], $SupportFacilityDecoration = "standard", $SupportFacilityName = "The Support Facility", $SupportFacilityEfficiency = 0>>
				<<set $SupportFacility = 5, $SupportFacilitySlaves = 0, $LieutenantColonel = 0>>
				<</replace>>
			<</link>> // Costs <<print cashFormat(Math.trunc(15000000*(Math.max(0.99,$SFAO)/10)*$Env)*_costDebuff)>> //
		<</if>>
		*/

		<<if $securityForceUpgradeToken == 0 && _Armoury < 5>>

<<link "Armoury">>
				<<replace "#resultX">>

				"Sure, boss." she says, nodding. "The boys'll like having some new guns and armour to help them out there." She laughs. "Don't think the poor bastards they'll be shooting will thank you though." She picks up a tablet and taps a few commands on it. "I'll get right on it."
				<<set $securityForceUpgradeToken = 1, $securityForceInfantryPower++, $cash -= 40000*$Env*_costDebuff>>
				<</replace>>
			<</link>> // Costs <<print cashFormat(40000*$Env*_costDebuff)>> //
		<<elseif $securityForceUpgradeToken == 0 && _Armoury < _ArmouryMax && $TierTwoUnlock == 1>>

<<link "Armoury">>
				<<replace "#resultX">>

					"Sure, boss." she says, nodding. "The boys'll like having some new guns and armour to help them out there." She laughs. "Don't think the poor bastards they'll be shooting will thank you though." She picks up a tablet and taps a few commands on it. "I'll get right on it."
				<<set $securityForceUpgradeToken = 1, $securityForceInfantryPower++, $cash -= 450000*$Env*_costDebuff>>
				<</replace>>
			<</link>> // Costs <<print cashFormat(450000*$Env*_costDebuff)>> //
		<</if>>
		<<if _Armoury == _ArmouryMax>>

//$securityForceName has fully upgraded the armoury to support its activities.//
		<</if>>

			<<if $securityForceUpgradeToken == 0 && _StimulantLab < 5>>

<<link "Stimulant Lab">>
				<<replace "#resultX">>

				"Sure, boss." she says, nodding. "The boys are going to like hearing that they'll be getting new stims. Some of them can't get enough." She laughs, sweeping her arm at a corner of the throne, where dozens of empty stimulant injectors are piled. "I might be one of them. Either way, the fucks out there aren't going to like us once we're on the new juice." She picks up a tablet and taps a few commands on it. "I'll get right on it."
				<<set $securityForceUpgradeToken = 1, $securityForceStimulantPower++, $cash -= 40000*$Env*_costDebuff>>
				<</replace>>
			<</link>> // Costs <<print cashFormat(40000*$Env*_costDebuff)>> //
		<<elseif $securityForceUpgradeToken == 0 && _StimulantLab < _StimulantLabMax && $TierTwoUnlock == 1>>
			<<switch _StimulantLab>>
			<<case 5>>
				<<set _drugCost = 126500>>
			<<case 6>>
				<<set _drugCost = 226500>>
			<<case 7>>
				<<set _drugCost = 20000000>>
			<<case 8>>
				<<set _drugCost = 25000000>>
			<<case 9>>
				<<set _drugCost = 35000000>>
			<</switch>>

<<link "Stimulant Lab">>
				<<replace "#resultX">>

				"Sure, boss." she says, nodding. "The boys are going to like hearing that they'll be getting new stims. Some of them can't get enough." She laughs, sweeping her arm at a corner of the throne, where dozens of empty stimulant injectors are piled. "I might be one of them. Either way, the fucks out there aren't going to like us once we're on the new juice." She picks up a tablet and taps a few commands on it. "I'll get right on it."
				<<set $securityForceUpgradeToken = 1, $securityForceStimulantPower++, $cash -= _drugCost*$Env*_costDebuff>>
				<</replace>>
			<</link>> // Costs <<print cashFormat(_drugCost*$Env*_costDebuff)>> //
		<<elseif $securityForceUpgradeToken == 0 && _StimulantLab == 7 && _Armoury >= 11 && $securityForceVehiclePower >= 7 && $securityForceAircraftPower >= 8 && $securityForceSpacePlanePower >= 11 && $securityForceFortressZeppelin >= 3 && $securityForceAC130 >= 5 && _DroneBay >= 6 && $securityForceSatellitePower >= 16 && _Barracks >= 13>>

<<link "Stimulant Lab">>
				<<replace "#resultX">>

				"Sure, boss." she says, nodding. "The boys are going to like hearing that they'll be getting new stims. Some of them can't get enough." She laughs, sweeping her arm at a corner of the throne, where dozens of empty stimulant injectors are piled. "I might be one of them. Either way, the fucks out there aren't going to like us once we're on the new juice." She picks up a tablet and taps a few commands on it. "I'll get right on it."
				<<set $securityForceUpgradeToken = 1, $securityForceStimulantPower++, $cash -= _drugCost*$Env*_costDebuff>>
				<</replace>>
			<</link>> // Costs <<print cashFormat(_drugCost*$Env*_costDebuff)>> //
		<</if>>
		<<if _StimulantLab == _StimulantLabMax>>

//$securityForceName has fully upgraded the stimulant lab to support its activities.//
		<</if>>

		<<if $securityForceUpgradeToken == 0 && _Barracks >= 1 && _Garage < _GarageMax && (_T1FullUpgradesGarage != "True" || $TierTwoUnlock == 1)>>

<<link "Garage">>
		<<replace "#resultX">>

"Which unit do you wish to upgrade or 'borrow'?"
		<<link "Go back">>
			<<goto "SFM Barracks">>
		<</link>>

			<<if $securityForceUpgradeToken == 0 && $securityForceVehiclePower < 5>>

<<link "Light and medium vehicles">>
					<<replace "#resultB">>

					"Sure, boss." she says, nodding. "Some new wheels should help a lot." She laughs. "The scum out there don't seem to like it when we roll up on them in something better than their piece of shit junkers." She picks up a tablet and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceVehiclePower++, $cash -= 60000*$Env*_costDebuff>>
					<</replace>>
				<</link>>// Costs <<print cashFormat(60000*$Env*_costDebuff)>> //
			<<elseif $securityForceUpgradeToken == 0 && $securityForceVehiclePower < _LightAndMediumVehiclesMax && $TierTwoUnlock == 1>>
				<<if $securityForceVehiclePower < 6>>
					<<set _vehCost = 250000>>
				<<elseif $securityForceVehiclePower == 6>>
					<<set _vehCost = 300000>>
				<<elseif $securityForceVehiclePower == 7>>
					<<set _vehCost = 490000>>
				<</if>>

<<link "Light and medium vehicles">>
					<<replace "#resultB">>

					"Sure, boss." she says, nodding. "Some new wheels should help a lot." She laughs. "The scum out there don't seem to like it when we roll up on them in something better than their piece of shit junkers." She picks up a tablet and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceVehiclePower++, $cash -= _vehCost*$Env*_costDebuff>>
					<</replace>>
				<</link>> // Costs <<print cashFormat(_vehCost*$Env*_costDebuff)>> //
			<</if>>
			<<if $securityForceVehiclePower == _LightAndMediumVehiclesMax>>

//$securityForceName has fully upgraded the vehicle fleet to support its activities.//
			<</if>>

			<<if $securityForceUpgradeToken == 0 && $securityForceHeavyBattleTank < 1 && $TierTwoUnlock == 1>>

<<link "A heavy battle tank">>
					<<replace "#resultB">>

					"Sure, boss." she says, nodding. "A heavy battle tank should help a lot." She laughs. "The scum out there don't seem to like it when we roll up on them in something better than their piece of shit junkers." She picks up a tablet and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceHeavyBattleTank++, $cash -= 6000000*$Env*_costDebuff>>
					<</replace>>
				<</link>>// Costs <<print cashFormat(6000000*$Env*_costDebuff)>> //
			<<elseif $securityForceUpgradeToken == 0 && $securityForceHeavyBattleTank >= 1 && $securityForceHeavyBattleTank < _HeavyBattleTankMax>>
				<<if $securityForceHeavyBattleTank < 2>>
					<<set _hbtCost = 7500000>>
				<<elseif $securityForceHeavyBattleTank == 2>>
					<<set _hbtCost = 850000>>
				<</if>>

<<link "heavy battle tank">>
				<<replace "#resultB">>

					"Sure, boss." she says, nodding. "Upgrading the heavy battle tank should help a lot." She laughs. "The scum out there don't seem to like it when we roll up on them in something better than their piece of shit junkers." She picks up a tablet and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceHeavyBattleTank++, $cash -= _hbtCost*$Env*_costDebuff>>
					<</replace>>
				<</link>> // Costs <<print cashFormat(_hbtCost*$Env*_costDebuff)>> //
			<</if>>
			<<if $securityForceHeavyBattleTank == _HeavyBattleTankMax>>

//$securityForceName has fully upgraded the heavy battle tank to support its activities.//
			<</if>>

		<</replace>>
		<</link>>
		<</if>>
		<<if _Garage >= _GarageMax>>//
$securityForceName has fully upgraded the garage to support its activities.//<</if>>

		<<if $securityForceUpgradeToken == 0 && _Barracks >= 4 && _Hangar < _HangarMax && (_T1FullUpgradesAirforce != "True" || $TierTwoUnlock == 1)>>

<<link "Hangar">>
		<<replace "#resultX">>

"Which unit do you wish to upgrade or 'borrow'?"
		<<link "Go back">>
			<<goto "SFM Barracks">>
		<</link>>

			<<if $securityForceUpgradeToken == 0 && $securityForceAircraftPower < 5>>

<<link "Light and medium aircraft">>
					<<replace "#resultY">>

					"Sure, boss." she says, nodding. "Some new VTOLs would be great." She laughs. "They're the real multiplier over the scum out there. Not much a looter gang can do against air support." She picks up a tablet and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceAircraftPower++, $cash -= 70000*$Env*_costDebuff>>
					<</replace>>
				<</link>> // Costs <<print cashFormat(70000*$Env*_costDebuff)>> //
			<<elseif $securityForceUpgradeToken == 0 && $securityForceAircraftPower < _AircraftMax && $TierTwoUnlock == 1>>
				<<switch $securityForceAircraftPower>>
				<<case 5>>
					<<set _airCost = 275000>>
				<<case 6>>
					<<set _airCost = 325000>>
				<<case 7>>
					<<set _airCost = 575000>>
				<<case 8>>
					<<set _airCost = 675000>>
				<<case 9>>
					<<set _airCost = 775000>>
				<</switch>>

<<link "Light and medium aircraft">>
					<<replace "#resultY">>

					"Sure, boss." she says, nodding. "Some new VTOLs would be great." She laughs. "They're the real multiplier over the scum out there. Not much a looter gang can do against air support." She picks up a tablet and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceAircraftPower++, $cash -= _airCost*$Env*_costDebuff>>
					<</replace>>
				<</link>> // Costs <<print cashFormat(_airCost*$Env*_costDebuff)>> //
			<</if>>
			<<if $securityForceAircraftPower == _AircraftMax>>

//$securityForceName has fully upgraded the air fleet to support its activities.//
			<</if>>

			<<if $securityForceUpgradeToken == 0 && $TierTwoUnlock == 1 && $securityForceSpacePlanePower < 1>>

<<link "A space plane">>
					<<replace "#resultY">>

					"Sure, boss." she says, nodding. "A orbital plane should help a lot." She laughs. "The scum out there don't seem to like it when we have eyes they can't hit." She picks up a tablet and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceSpacePlanePower++, $cash -= 475000*$Env*$HackingSkillMultiplier*_costDebuff>>
					<</replace>>
				<</link>> // Costs <<print cashFormat(475000*$Env*$HackingSkillMultiplier*_costDebuff)>> //
			<<elseif $securityForceUpgradeToken == 0 && $securityForceSpacePlanePower >= 1 && $securityForceSpacePlanePower < _SpacePlaneMax>>
				<<if $securityForceSpacePlanePower < 4>>
					<<set _spCost = 5000000>>
				<<elseif $securityForceSpacePlanePower == 4>>
					<<set _spCost = 7500000>>
				<<elseif $securityForceSpacePlanePower == 5>>
					<<set _spCost = 8500000>>
				<<elseif $securityForceSpacePlanePower == 6>>
					<<set _spCost = 9500000>>
				<<elseif $securityForceSpacePlanePower == 7>>
					<<set _spCost = 1250000>>
				<<elseif $securityForceSpacePlanePower == 8>>
					<<set _spCost = 1750000>>
				<<elseif $securityForceSpacePlanePower == 9 && $securityForceInfantryPower >= 10>>
					<<set _spCost = 2500000>>
				<<elseif $securityForceSpacePlanePower == 10>>
					<<set _spCost = 3500000>>
				<<elseif $securityForceSpacePlanePower == 10>>
					<<set _spCost = 6500000>>
				<<elseif $securityForceSpacePlanePower == 11>>
					<<set _spCost = 9500000>>
				<</if>>

<<link "Space plane">>
					<<replace "#resultY">>

					"Sure, boss." she says, nodding. "Upgrading the orbital plane should help a lot." She laughs. "The scum out there don't seem to like it when we have eyes they can't hit." She picks up a tablet and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceSpacePlanePower++, $cash -= _spCost*$Env*$HackingSkillMultiplier*_costDebuff>>
					<</replace>>
				<</link>> // Costs <<print cashFormat(_spCost*$Env*$HackingSkillMultiplier*_costDebuff)>> //
			<</if>>
			<<if $securityForceSpacePlanePower == _SpacePlaneMax>>

//$securityForceName has fully upgraded the space plane to support its activities.//
			<</if>>

			<<if $securityForceUpgradeToken == 0 && $TierTwoUnlock == 1 && $securityForceFortressZeppelin < 1>>

<<link "A fortress zeppelin">>
					<<replace "#resultY">>

					"Sure, boss." she says, nodding. "A fortress zeppelin would help a lot." She laughs. "The scum out there don't seem to like it when we have things that their shit equipment can't damage." She picks up a tablet and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceFortressZeppelin++, $cash -= 3000000*$Env*_costDebuff>>
					<</replace>><</link>> // Costs <<print cashFormat(3000000*$Env*_costDebuff)>> //
			<<elseif $securityForceUpgradeToken == 0 && $securityForceFortressZeppelin >= 1 && $securityForceFortressZeppelin < _FortressZeppelinMax>>

<<link "Fortress zeppelin">>
					<<replace "#resultY">>

					"Sure, boss." she says, nodding. "Upgrading the Fortress Zeppelin, should help us gain a massive advantage." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceFortressZeppelin++, $cash -= 2000000*$Env*_costDebuff>>
					<</replace>>
				<</link>> // Costs <<print cashFormat( 2000000*$Env*_costDebuff)>> //
			<</if>>
			<<if $securityForceFortressZeppelin == _FortressZeppelinMax>>

//$securityForceName has fully upgraded the fortress zeppelin to support its activities.//
			<</if>>

			<<if $securityForceUpgradeToken == 0 && $TierTwoUnlock == 1 && $securityForceAC130 < 1>>

<<link "An AC-130">>
					<<replace "#resultY">>

					"Sure, boss." she says, nodding. "An AC-130 would help a lot." She laughs. "The scum out there don't seem to like it when we have things that their shit equipment can't damage." She picks up a tablet and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceAC130++, $cash -= 3500000*$Env*$HackingSkillMultiplier*_costDebuff>>
					<</replace>>
				<</link>> // Costs <<print cashFormat(3500000*$Env*$HackingSkillMultiplier*_costDebuff)>> //
			<<elseif $securityForceAC130 >= 1 && $securityForceAC130 < _AC130Max>>

<<link "AC-130">>
					<<replace "#resultY">>

					"Sure, boss." she says, nodding. "Upgrading the AC-130, should help us gain a massive advantage." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceAC130++, $cash -= 2500000*$Env*$HackingSkillMultiplier*_costDebuff>>
					<</replace>>
				<</link>> // Costs <<print cashFormat(2500000*$Env*$HackingSkillMultiplier*_costDebuff)>> //
			<</if>>
			<<if $securityForceAC130 == _AC130Max>>

//$securityForceName has fully upgraded the AC-130 to support its activities.//
			<</if>>

			<<if $securityForceUpgradeToken == 0 && $TierTwoUnlock == 1 && $securityForceHeavyTransport < 1>>

<<link "A heavy transport">>
					<<replace "#resultY">>

					"Sure, boss." she says, nodding. "A heavy transport would help a lot." She laughs. "The scum out there don't seem to like it when we have things that their shit equipment can't damage." She picks up a tablet and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceHeavyTransport++, $cash -= 4000000*$Env*_costDebuff>>
					<</replace>><</link>> // Costs <<print cashFormat(4000000*$Env*_costDebuff)>> //
			<<elseif $securityForceUpgradeToken == 0 && $securityForceHeavyTransport >= 1 && $securityForceHeavyTransport < _heavyTransportMax>>

<<link "Heavy transport">>
					<<replace "#resultY">>

					"Sure, boss." she says, nodding. "Upgrading the heavy transport, should help us gain a massive advantage." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
					<<set $securityForceUpgradeToken = 1, $securityForceHeavyTransport++, $cash -= 3000000*$Env*_costDebuff>>
					<</replace>>
				<</link>> // Costs <<print cashFormat( 3000000*$Env*_costDebuff)>> //
			<</if>>
			<<if $securityForceHeavyTransport == _heavyTransportMax>>

//$securityForceName has fully upgraded the heavy transport to support its activities.//
			<</if>>

		<</replace>>
		<</link>>
		<</if>>
		<<if _Hangar >= _HangarMax>>//
$securityForceName has fully upgraded the hangar to support its activities.//<</if>>

		<<if $securityForceUpgradeToken == 0 && _DroneBay < 5 && _Barracks >= 2>>

<<link "Drone bay">>
				<<replace "#resultX">>
				"Sure, boss." she says, nodding. "Some new drones would be nice." She laughs. "The poor bastards out there shit themselves when they see combat drones fly over the horizon." She picks up a tablet and taps a few commands on it. "I'll get right on it."
				<<set $securityForceUpgradeToken = 1, $securityForceDronePower++, $cash -= 45000*$Env*$HackingSkillMultiplier*_costDebuff>>
				<</replace>>
			<</link>> // Costs <<print cashFormat(45000*$Env*$HackingSkillMultiplier*_costDebuff)>> //
		<<elseif $securityForceUpgradeToken == 0 && _DroneBay < _DroneBayMax && $TierTwoUnlock == 1>>

<<link "Drone bay">>
				<<replace "#resultX">>
				"Sure, boss." she says, nodding. "Some new drones would be nice." She laughs. "The poor bastards out there shit themselves when they see combat drones fly over the horizon." She picks up a tablet and taps a few commands on it. "I'll get right on it."
				<<set $securityForceUpgradeToken = 1, $securityForceDronePower++, $cash -= 2000000*$Env*$HackingSkillMultiplier*_costDebuff>>
				<</replace>>
			<</link>> // Costs <<print cashFormat(2000000*$Env*$HackingSkillMultiplier*_costDebuff)>> //
		<</if>>
		<<if _DroneBay == _DroneBayMax>>

//$securityForceName has fully upgraded the drone bay to support its activities.//
		<</if>>

		<<if $securityForceUpgradeToken == 0 && (_LaunchBayNO < _LaunchBayNOMax || _LaunchBayO < _LaunchBayOMax) && $TierTwoUnlock == 1>>

<<link "Launch Bay">>
			<<replace "#resultX">>

"Which unit do you wish to upgrade or 'borrow'?"
			<<link "Go back">>
				<<goto "SFM Barracks">>
			<</link>>

				<<if $securityForceUpgradeToken == 0 && $securityForceSatellitePower < 1>>

<<link "A Satellite">>
						<<replace "#resultZ">>

						"Sure, boss." she says, nodding. "A Satellite should help a lot." She laughs. "The scum out there don't seem to like it when we have eyes they can't hit." She picks up a tablet and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceSatellitePower++, $cash -= 3750000*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(3750000*$Env*$HackingSkillMultiplier*_costDebuff)>> //
				<<elseif $securityForceUpgradeToken == 0 && $securityForceSatellitePower >= 1 && $securityForceSatellitePower < _SatelliteMax>>
					<<switch $securityForceSatellitePower>>
					<<case 11>>
						<<set _satCost = 1500000>>
					<<case 12>>
						<<set _satCost = 1600000>>
					<<case 13>>
						<<set _satCost = 1700000>>
					<<case 14>>
						<<set _satCost = 1800000>>
					<<case 15>>
						<<set _satCost = 1900000>>
					<<case 16>>
						<<set _satCost = 25000000>>
					<<case 17>>
						<<set _satCost = 25000000>>
					<<case 18>>
						<<set _satCost = 30000000>>
					<<case 19>>
						<<set _satCost = 45000000>>
					<<case 20 && $PC.hacking >= 75>>
						<<set _satCost = 55000000>>
					<<default>>
						<<set _satCost = 2350000>>
					<</switch>>

<<link "Satellite">>
						<<replace "#resultZ">>

						"Sure, boss." she says, nodding. "Upgrading the Satellite should help a lot." She laughs. "The scum out there don't seem to like it when we have eyes they can't hit." She picks up a tablet and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceSatellitePower++, $cash -= _satCost*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(_satCost*$Env*$HackingSkillMultiplier*_costDebuff)>> //
				<<elseif $securityForceUpgradeToken == 0 && $securityForceSatellitePower == 20 && $PC.hacking >= 75>>

<<link "Satellite">>
						<<replace "#resultZ">>

						"Sure, boss." she says, nodding. "Upgrading the Satellite should help a lot." She laughs. "The scum out there don't seem to like it when we have eyes they can't hit." She picks up a tablet and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceSatellitePower++, $cash -= _satCost*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(_satCost*$Env*$HackingSkillMultiplier*_costDebuff)>> //
			<</if>>
				<<if $securityForceSatellitePower == _SatelliteMax>>

//$securityForceName has fully upgraded the Satellite to support its activities.//
				<</if>>

			<<if $securityForceUpgradeToken == 0 && $securityForceGiantRobot < 1 && ($terrain != "oceanic" && $terrain != "marine")>>

<<link "A giant robot">>
						<<replace "#resultZ">>

						"Sure, boss." she says, nodding. "A giant robot would help a lot." She laughs. "The scum out there don't seem to like it when we have things that their shit equipment can't damage." She picks up a tablet and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceGiantRobot++, $cash -= 50000000*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(50000000*$Env*$HackingSkillMultiplier*_costDebuff)>> //
			<<elseif $securityForceUpgradeToken == 0 && $securityForceGiantRobot >= 1 && $securityForceGiantRobot < _GiantRobotMax>>
					<<if $securityForceGiantRobot < 3>>
						<<set _robCost = 25000000>>
					<</if>>
					<<switch $securityForceGiantRobot>>
					<<case 3>>
						<<set _robCost = 4500000>>
					<<case 4>>
						<<set _robCost = 4500000>>
					<<case 5>>
						<<set _robCost = 6500000>>
					<<case 6>>
						<<set _robCost = 8500000>>
					<<case 7>>
						<<set _robCost = 9500000>>
					<<case 8>>
						<<set _robCost = 1050000>>
					<<case 9 && $securityForceInfantryPower >= 10>>
						<<set _robCost = 27500000>>
					<<case 10>>
						<<set _robCost = 3150000>>
					<<case 11>>
						<<set _robCost = 3200000>>
					<<case 12>>
						<<set _robCost = 4550000>>
					<<case 13>>
						<<set _robCost = 6550000>>
					<<case 14>>
						<<set _robCost = 8550000>>
					<<case 15 $PC.hacking >= 75>>
						<<set _robCost = 9550000>>
					<</switch>>

<<link "Giant robot">>
						<<replace "#resultZ">>

						"Sure, boss." she says, nodding. "Upgrading the giant robot, should help us gain a massive advantage." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceGiantRobot++, $cash -= _robCost*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(_robCost*$Env*$HackingSkillMultiplier*_costDebuff)>> //
			<<elseif $securityForceUpgradeToken == 0 && $securityForceGiantRobot == 15 && $PC.hacking >= 75>>

<<link "Giant robot">>
						<<replace "#resultZ">>

						"Sure, boss." she says, nodding. "Upgrading the giant robot, should help us gain a massive advantage." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceGiantRobot++, $cash -= _robCost*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(_robCost*$Env*$HackingSkillMultiplier*_costDebuff)>> //
			<</if>>
				<<if $securityForceGiantRobot == _GiantRobotMax && ($terrain != "oceanic" && $terrain != "marine")>>

//$securityForceName has fully upgraded the giant robot to support its activities.//
				<</if>>

			<<if $securityForceUpgradeToken == 0 && $securityForceMissileSilo < 1 && ($terrain != "oceanic" && $terrain != "marine")>>

<<link "A missile silo">>
						<<replace "#resultZ">>

						"Sure, boss." she says, nodding. "A missile silo would help a lot." She laughs. "The scum out there don't seem to like it when we have things that their shit equipment can't damage." She picks up a tablet and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceMissileSilo++, $cash -= 20000000*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(20000000*$Env*$HackingSkillMultiplier*_costDebuff)>> //
			<<elseif $securityForceUpgradeToken == 0 && $securityForceMissileSilo >= 1 && $securityForceMissileSilo < _MissileSiloMax>>
					<<if $securityForceMissileSilo == 1>>
						<<set _msCost = 2500000>>
					<<elseif $securityForceMissileSilo == 2>>
						<<set _msCost = 2950000>>
					<</if>>

<<link "Missile silo">>
						<<replace "#resultZ">>

						"Sure, boss." she says, nodding. "Upgrading the missile silo, should help us gain a massive advantage." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceMissileSilo++, $cash -= _msCost*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(_msCost*$Env*$HackingSkillMultiplier*_costDebuff)>> //
			<</if>>
				<<if $securityForceMissileSilo == _MissileSiloMax && ($terrain != "oceanic" && $terrain != "marine")>>
//$securityForceName has fully upgraded the missile silo to support its activities.//<</if>>

			<</replace>>
			<</link>>
		<</if>>
		<<if _LaunchBayNO >= _LaunchBayNOMax || _LaunchBayO >= _LaunchBayNOMax>>//
$securityForceName has fully upgraded the launch bay to support its activities.//<</if>>

		<<if $securityForceUpgradeToken == 0 && ($terrain == "oceanic" || $terrain == "marine") && (_NavalYard < _NavalYardMax) && $TierTwoUnlock == 1>>

<<link "Naval Yard">>
			<<replace "#resultX">>

"Which unit do you wish to upgrade or 'borrow'?"
				<<link "Go back">>
					<<goto "SFM Barracks">>
				<</link>>

				<<if $securityForceUpgradeToken == 0 && $securityForceAircraftCarrier < 1>>

<<link "An aircraft carrier">>
						<<replace "#resultA">>

						"Sure, boss." she says, nodding. "An aircraft carrier would help a lot." She laughs. "The scum out there don't seem to like it when we have things that their shit equipment can't damage." She picks up a tablet and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceAircraftCarrier++, $cash -= 1500000*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(1500000*$Env*$HackingSkillMultiplier*_costDebuff)>> //
				<<elseif $securityForceUpgradeToken == 0 && $securityForceAircraftCarrier >= 1 && $securityForceAircraftCarrier < _AircraftCarrierMax>>

<<link "Aircraft carrier">>
						<<replace "#resultA">>

						"Sure, boss." she says, nodding. "Upgrading the aircraft carrier should help us gain a massive advantage." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceAircraftCarrier++, $cash -= 25000000*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(25000000*$Env*$HackingSkillMultiplier*_costDebuff)>> //
				<</if>>
				<<if $securityForceAircraftCarrier == _AircraftCarrierMax && ($terrain == "oceanic" || $terrain == "marine")>>

//$securityForceName has fully upgraded the aircraft carrier to support its activities.//
				<</if>>

				<<if $securityForceUpgradeToken == 0 && $securityForceSubmarine < 1>>

<<link "A submarine">>
						<<replace "#resultA">>

						"Sure, boss." she says, nodding. "A submarine would help a lot." She laughs. "The scum out there don't seem to like it when we have things that their shit equipment can't damage." She picks up a tablet and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceSubmarine++, $cash -= 1500000*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(1500000*$Env*$HackingSkillMultiplier*_costDebuff)>> //
				<<elseif $securityForceUpgradeToken == 0 && $securityForceSubmarine >= 1 && $securityForceSubmarine < _SubmarineMax>>
					<<if $securityForceSubmarine < 4>>
						<<set _subCost = 2500000>>
					<<elseif $securityForceSubmarine == 4>>
						<<set _subCost = 8500000>>
					<<elseif $securityForceSubmarine == 5>>
						<<set _subCost = 8650000>>
					<<elseif $securityForceSubmarine == 6 && $PC.hacking >= 75>>
						<<set _subCost = 8780000>>
					<</if>>

<<link "Submarine">>
						<<replace "#resultA">>

						"Sure, boss." she says, nodding. "Upgrading the submarine, should help us gain a massive advantage." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceSubmarine++, $cash -= _subCost*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(_subCost*$Env*$HackingSkillMultiplier*_costDebuff)>> //
				<<elseif $securityForceUpgradeToken == 0 && $securityForceSubmarine == 6 && $PC.hacking >= 75>>

<<link "Submarine">>
						<<replace "#resultA">>

						"Sure, boss." she says, nodding. "Upgrading the submarine, should help us gain a massive advantage." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceSubmarine++, $cash -= _subCost*$Env*$HackingSkillMultiplier*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(_subCost*$Env*$HackingSkillMultiplier*_costDebuff)>> //
				<</if>>
				<<if $securityForceSubmarine == _SubmarineMax && ($terrain == "oceanic" || $terrain == "marine")>>
//$securityForceName has fully upgraded the submarine to support its activities.//<</if>>

				<<if $securityForceUpgradeToken == 0 && $securityForceHeavyAmphibiousTransport < 1>>

<<link "A heavy amphibious transport">>
						<<replace "#resultA">>

						"Sure, boss." she says, nodding. "A heavy amphibious transport would help a lot." She laughs. "The scum out there don't seem to like it when we have things that their shit equipment can't damage." She picks up a tablet and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceHeavyAmphibiousTransport++, $cash -= 1500000*$Env*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(1500000*$Env*_costDebuff)>> //
				<<elseif $securityForceUpgradeToken == 0&& $securityForceHeavyAmphibiousTransport >= 1 && $securityForceHeavyAmphibiousTransport < _HeavyAmphibiousTransportMax>>
					<<switch $securityForceHeavyAmphibiousTransport>>
					<<case 1>>
						<<set _hatCost = 1500000>>
					<<case 2>>
						<<set _hatCost = 2500000>>
					<<case 3>>
						<<set _hatCost = 3000000>>
					<<case 4>>
						<<set _hatCost = 3500000>>
					<<case 5>>
						<<set _hatCost = 4000000>>
					<</switch>>

<<link "Heavy amphibious transport">>
						<<replace "#resultA">>

						"Sure, boss." she says, nodding. "Upgrading the heavy amphibious transport, should help us gain a massive 	advantage." She laughs, picks up a tablet, and taps a few commands on it. "I'll get right on it."
						<<set $securityForceUpgradeToken = 1, $securityForceHeavyAmphibiousTransport++, $cash -= _hatCost*$Env*_costDebuff>>
						<</replace>>
					<</link>> // Costs <<print cashFormat(_hatCost*$Env*_costDebuff)>> //
				<</if>>
				<<if $securityForceHeavyAmphibiousTransport == _HeavyAmphibiousTransportMax && ($terrain == "oceanic" || $terrain == "marine")>>
//$securityForceName has fully upgraded the heavy amphibious transport to support its activities.//<</if>>

			<</replace>>
			<</link>>
		<</if>>
		<<if ($terrain == "oceanic" || $terrain == "marine") && (_NavalYard >= _NavalYardMax)>>
$securityForceName has fully upgraded the naval yard to support its activities.//<</if>>

<</if>>


code:
:: SpecialForceUpgradeTree

<<silently>>
<<set _Barracks = $securityForceArcologyUpgrades>>
	<<set _BarracksMax = 16>>

<<set _SupportFacility = $SupportFacility>>
	<<set _SupportFacilityMax = 1>>

<<set _Armoury = $securityForceInfantryPower>>
	<<set _ArmouryMax = 12>>

<<set _StimulantLab = $securityForceStimulantPower>>
	<<set _StimulantLabMax = 10>>

<<set _Garage = $securityForceVehiclePower+$securityForceHeavyBattleTank>>
	<<set _LightAndMediumVehiclesMax = 8>>
	<<set _HeavyBattleTankMax = 3>>
<<set _GarageMax = _LightAndMediumVehiclesMax+_HeavyBattleTankMax>>

<<set _Hangar = $securityForceAircraftPower+$securityForceSpacePlanePower+$securityForceFortressZeppelin+$securityForceAC130+$securityForceHeavyTransport>>
	<<set _AircraftMax = 10>>
	<<set _SpacePlaneMax = 12>>
	<<set _FortressZeppelinMax = 4>>
	<<set _AC130Max = 6>>
	<<set _heavyTransportMax = 4>>
<<set _HangarMax = _AircraftMax+_SpacePlaneMax+_FortressZeppelinMax+_AC130Max+_heavyTransportMax>>

<<set _DroneBay = $securityForceDronePower>>
	<<set _DroneBayMax = 8>>

/* Launch Bay */
	<<if $PC.hacking >= 75>>
		<<set _SatelliteMax = 21>>
		<<set _GiantRobotMax = 16>>
	<<else>>
		<<set _SatelliteMax = 20>>
		<<set _GiantRobotMax = 15>>
	<</if>>
	<<set _MissileSiloMax = 3>>
	<<set _LaunchBayNO = $securityForceSatellitePower+$securityForceGiantRobot+$securityForceMissileSilo, _LaunchBayNOMax = _SatelliteMax+_GiantRobotMax+_MissileSiloMax>>

	<<set _LaunchBayO = $securityForceSatellitePower>>
	<<if $PC.hacking >= 75>>
		<<set _LaunchBayOMax = 21>>
	<<else>>
		<<set _LaunchBayOMax = 20>>
	<</if>>

	<<set _AircraftCarrierMax = 6>>
	<<if $PC.hacking >= 75>>
		<<set _SubmarineMax = 7>>
	<<else>>
		<<set _SubmarineMax = 6>>
	<</if>>
	<<set _HeavyAmphibiousTransportMax = 6>>
<<set _NavalYardMax = _AircraftCarrierMax+_SubmarineMax+_HeavyAmphibiousTransportMax>>

<<set _maxNO = _BarracksMax+_ArmouryMax+_StimulantLabMax+_GarageMax+_HangarMax+_DroneBayMax+_LaunchBayNOMax+_SupportFacilityMax>>
<<set _maxO = _BarracksMax+_ArmouryMax+_StimulantLabMax+_GarageMax+_HangarMax+_DroneBayMax+_LaunchBayOMax+_NavalYardMax+_SupportFacilityMax>>

<<if $terrain != "oceanic" && $terrain != "marine">>
	<<set $SFNO = _Barracks+_Armoury+_StimulantLab+_Garage+_Hangar+_DroneBay+_LaunchBayNO+_SupportFacility>>
	<<set _max = _BarracksMax+_ArmouryMax+_StimulantLabMax+_GarageMax+_HangarMax+_DroneBayMax+_LaunchBayNOMax+_SupportFacilityMax>>
	<<set $SFO = 0>>
<<elseif $terrain == "oceanic" || $terrain == "marine">>
	<<set _NavalYard = $securityForceAircraftCarrier+$securityForceSubmarine+$securityForceHeavyAmphibiousTransport>>
	<<set $SFO = _Barracks+_Armoury+_StimulantLab+_Garage+_Hangar+_DroneBay+_LaunchBayO+_NavalYard+_SupportFacility>>
	<<set _max = _BarracksMax+_ArmouryMax+_StimulantLabMax+_GarageMax+_HangarMax+_DroneBayMax+_LaunchBayOMax+_NavalYardMax+_SupportFacilityMax>>
	<<set $SFNO = 0>>
<</if>>
<</silently>>


code:
:: securityForceTradeShow [nobr]

<<set $nextButton = "Continue", $nextLink = "RIE Eligibility Check", $returnTo = "RIE Eligibility Check">>
<<set $Env = simpleWorldEconomyCheck()>>
<<if ndef $TradeShowAttendanceGranted>> <<set $TradeShowAttendanceGranted = 0>> <</if>>

<<if $OverallTradeShowAttendance == 0>>

	<<if def $PC.customTitle>>$PC.customTitle<<elseif $PC.title != 0>>Sir<<else>>Ma'am<</if>>, back when I was a major before I joined $securityForceName. Me and a couple of colleagues went to a bi-yearly international security trade show, I would very much like to continue doing so. Can I?

	<<link "Yes,">>
	<<replace "#choice1">>

"Thank you <<if def $PC.customTitle>>$PC.customTitle<<elseif $PC.title != 0>>sir<<else>>ma'am<</if>>."
	<<set $OverallTradeShowAttendance += 1, $CurrentTradeShowAttendanceGranted = 1, $TradeShowAttendanceGranted = 1>>
	<</replace>>
	<</link>>

	<<link "No">>
	<<replace "#choice1">>

"I understand <<if def $PC.customTitle>>$PC.customTitle<<elseif $PC.title != 0>>sir<<else>>ma'am<</if>>."
	<</replace>>
	<</link>>

<<elseif $OverallTradeShowAttendance >= 1>>
The (bi-yearly) security trade show has finally come around and even though you've already granted The Colonel permission to attend, she's decided to come and ask for the leave personally.

	<<link "Grant leave">>
	<<replace "#choice2">>

"Thanks <<if def $PC.customTitle>>$PC.customTitle<<elseif $PC.title != 0>>sir<<else>>ma'am<</if>>"

	<<set $CurrentTradeShowAttendanceGranted = 1, _TradeShowAttendes = 150, _BonusProviderPercentage = .15, _MenialSlavesPerAttendee = 15>>

	<<include "SpecialForceUpgradeTree">>

	<<if $arcologies[0].prosperity < 25>>
		<<set _TradingPower = 15>>
	<<elseif $arcologies[0].prosperity > 70>>
		<<set _TradingPower = 25>>
	<<elseif $arcologies[0].prosperity > 65>>
		<<set _TradingPower = 24>>
	<<elseif $arcologies[0].prosperity > 60>>
		<<set _TradingPower = 23>>
	<<elseif $arcologies[0].prosperity > 55>>
		<<set _TradingPower = 22>>
	<<elseif $arcologies[0].prosperity > 50>>
		<<set _TradingPower = 21>>
	<<elseif $arcologies[0].prosperity > 45>>
		<<set _TradingPower = 20>>
	<<elseif $arcologies[0].prosperity > 40>>
		<<set _TradingPower = 19>>
	<<elseif $arcologies[0].prosperity > 35>>
		<<set _TradingPower = 18>>
	<<elseif $arcologies[0].prosperity > 30>>
		<<set _TradingPower = 17>>
	<<elseif $arcologies[0].prosperity > 25>>
		<<set _TradingPower = 16>>
	<</if>>

	<<set _SuccesfulPersuationAttempt = 0>>
	<<if ($SFNO || $SFO) < 10 && random(0,100)+_TradingPower > 90>>
		<<set _SuccesfulPersuationAttempt = 1>>
		<<set _PersuationBonus = 1.05>>
	<<elseif ($SFNO || $SFO) >= 110 && random(0,100)+_TradingPower > 40>>
		<<set _SuccesfulPersuationAttempt = 1>>
		<<set _PersuationBonus = 1.95>>
	<<elseif ($SFNO || $SFO) >= 100 && random(0,100)+_TradingPower > 45>>
		<<set _SuccesfulPersuationAttempt = 1>>
		<<set _PersuationBonus = 1.90>>
	<<elseif ($SFNO || $SFO) >= 90 && random(0,100)+_TradingPower > 50>>
		<<set _SuccesfulPersuationAttempt = 1>>
		<<set _PersuationBonus = 1.80>>
	<<elseif ($SFNO || $SFO) >= 80 && random(0,100)+_TradingPower > 55>>
		<<set _SuccesfulPersuationAttempt = 1>>
		<<set _PersuationBonus = 1.70>>
	<<elseif ($SFNO || $SFO) >= 70 && random(0,100)+_TradingPower > 60>>
		<<set _SuccesfulPersuationAttempt = 1>>
		<<set _PersuationBonus = 1.60>>
	<<elseif ($SFNO || $SFO) >= 60 && random(0,100)+_TradingPower > 65>>
		<<set _SuccesfulPersuationAttempt = 1>>
		<<set _PersuationBonus = 1.50>>
	<<elseif ($SFNO || $SFO) >= 50 && random(0,100)+_TradingPower > 70>>
		<<set _SuccesfulPersuationAttempt = 1>>
		<<set _PersuationBonus = 1.40>>
	<<elseif ($SFNO || $SFO) >= 40 && random(0,100)+_TradingPower > 75>>
		<<set _SuccesfulPersuationAttempt = 1>>
		<<set _PersuationBonus = 1.30>>
	<<elseif ($SFNO || $SFO) >= 30 && random(0,100)+_TradingPower > 80>>
		<<set _SuccesfulPersuationAttempt = 1>>
		<<set _PersuationBonus = 1.20>>
	<<elseif ($SFNO || $SFO) >= 10 && random(0,100)+_TradingPower > 85>>
		<<set _SuccesfulPersuationAttempt = 1>>
		<<set _PersuationBonus = 1.10>>
	<</if>>

	<<if _SuccesfulPersuationAttempt == 0>>
		<<set _PersuationBonus = 1>>
	<</if>>

	<<set _MenialSlaves = Math.ceil(random(0,_TradeShowAttendes)*_BonusProviderPercentage*_MenialSlavesPerAttendee*_PersuationBonus)>>
	<<set _Profit = Math.ceil($cash*.010*$SFNO || $SFO*$arcologies[0].prosperity*$Env)*_PersuationBonus>>

During a break, The Colonel manages to sell some generic schematics to the _TradeShowAttendes people present, some decided to also give her some menial slaves as a bonus.

			<<set $helots = $helots+_MenialSlaves>>
			<<set $TradeShowHelots += _MenialSlaves>>
			<<set $TotalTradeShowHelots += _MenialSlaves>>

			<<set $cash = $cash+_Profit>>
			<<set $TradeShowIncome += _Profit>>
			<<set $TotalTradeShowIncome += _Profit>>

		<<if $ColonelRelationship >= 65 && $LieutenantColonel == 1 && $ColonelCore == "brazen">>

			<<link "Have sex with The Colonel in a bathroom stall">>
				The crowd are shocked by the loud noises coming from a bathroom stall.
				<<set $rep -= 150, $securityForceSexedColonel += 1>>
			<</link>>
		<</if>>

	<</replace>>
	<</link>>

	<<link "Request she remain on base">>
	<<replace "#choice2">>

The look of disappointment is barely noticeable on The Colonel's face.
	<</replace>>
	<</link>>

<</if>>


code:
:: Artificial Insemination [nobr]

<<set $nextButton = "Back", $nextLink = "Remote Surgery", $impregnatrix = 0, _eligibility = 0, _eligibilityI = 0>>

//$activeSlave.slaveName is prepped for fertilization; now you must select a target to harvest sperm from.//

__Select an eligible slave to serve as the semen donatrix:__

<<for _ai = 0; _ai < $slaves.length; _ai++>>
	<<if $slaves[_ai].balls > 0 && $slaves[_ai].pubertyXY == 1 && canBreed($activeSlave, $slaves[_ai])>>

<<print "[[$slaves[_ai].slaveName|Surgery Degradation][$impregnatrix = $slaves[" + _ai + "], $cash -= $surgeryCost, $surgeryType = 'insemination']]">>
		<<set _eligibility = 1>>
	<</if>>
<</for>>
<<if (_eligibility == 0)>>

//You have no slaves with potent sperm.//
<</if>>

/* Disabled until .pregSource can manage to comprehend this
<<if $incubatorSlaves > 0 && $incubatorReproductionSetting == 2>>

	__Incubator settings are resulting in large-scale fluid secretion. Select an eligible incubatee to milk for semen:__

	<<for _ai = 0; _ai < $tanks.length; _ai++>>
		<<if $tanks[_ai].balls > 0 && $tanks[_ai].dick > 0 && canBreed($activeSlave, $tanks[_ai])>>

<<print "[[$tanks[_ai].slaveName|Surgery Degradation][$impregnatrix = $tanks[" + _ai + "], $cash -= $surgeryCost, $surgeryType = 'insemination']]">>
			<<set _eligibilityI = 1>>
		<</if>>
	<</for>>
	<<if (_eligibilityI == 0)>>

//You have no growing slaves producing sperm.//
	<</if>>
<</if>>
*/

<<if $PC.dick == 1>>

	[[Use your own|Surgery Degradation][$impregnatrix = $PC, $cash -= $surgeryCost, $surgeryType = "insemination"]]
<<elseif $PC.storedCum > 0>>

	[[Use a vial of your own|Surgery Degradation][$impregnatrix = $PC, $cash -= $surgeryCost, $surgeryType = "insemination", $PC.storedCum--]]
	//You have enough sperm stored away to inseminate $PC.storedCum more slave<<if $PC.storedCum > 1>>s<</if>>.//
<</if>>


code:
:: Basenationalities Controls [nobr]

<<if hashSum($nationalities) < 1>>
	//You cannot be a slave owner without a slave trade. Please add nationalities to continue.//
<<else>>
	<<link "Confirm customization">>
		<<unset $baseControlsFilter>>
		<<if $customWA == 0>>
			<<goto "Intro Summary">>
		<<else>>
			<<goto "Extreme Intro">>
		<</if>>
	<</link>>
<</if>>

/* Generates cloned array of $nationalities, removing duplicates and then sorting */
<<set $nationalitiescheck = Object.assign({}, $nationalities)>>

/* Prints distribution of $nationalities, using $nationalitiescheck to render array */
<<set _percentPerPoint = 100.0 / hashSum($nationalities)>>
<<set _len = Object.keys($nationalitiescheck).length>>
<<for _nation, _i range $nationalitiescheck>>
	_nation @@.orange;<<= ($nationalities[_nation] * _percentPerPoint).toFixed(2)>>%@@
	<<if _i < _len-1>> | <</if>>
<</for>>
<<unset _percentPerPoint>>

/* Fine control tweaking of populations */
Adjust slave populations:

/* Filter controls */
Filter by Race:
<<for _i = 0; _i < setup.filterRaces.length; _i++>>
	<<set _race = setup.filterRaces[_i]>>
	<<if $baseControlsFilter == _race.toLowerCase().replace(/[ -]/g, '')>>
		<<print _race>>
	<<else>>
		<<print "
			<<link _race>>
				<<set $baseControlsFilter to setup.filterRaces[" + _i + "].toLowerCase().replace(/[ -]/g, '')>>
				<<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>>
			<</link>>
		">>
	<</if>>
	<<if _i < setup.filterRaces.length-1>>
	|
	<</if>>
<</for>>

Filter by Region:
<<for _i = 0; _i < setup.filterRegions.length; _i++>>
	<<set _region = setup.filterRegions[_i]>>
	<<if $baseControlsFilter == _region.toLowerCase().replace(/[ -]/g, '')>>
		<<print _region>>
	<<else>>
		<<print "
			<<link _region>>
				<<set $baseControlsFilter to setup.filterRegions[" + _i + "].toLowerCase().replace(/[ -]/g, '')>>
				<<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>>
			<</link>>
		">>
	<</if>>
	<<if _i < setup.filterRegions.length-1>>
	|
	<</if>>
<</for>>

/* Unfiltered pop controls */
<<if $baseControlsFilter == "all">>
	<<for _i = 0; _i < setup.baseNationalities.length; _i++>>

		<<set _nation = setup.baseNationalities[_i]>>
		<<print "
		_nation
			@@.plusButton;<<link '+'>>
				<<set hashPush($nationalities, setup.baseNationalities["+_i+"])>>
				<<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>>
			<</link>>@@
		">>
	<<if def $nationalitiescheck[_nation]>>
		<<print "
			@@.minusButton;<<link '–'>>
				<<set $nationalities[setup.baseNationalities["+_i+"]] -= 1>>
				<<if $nationalities[setup.baseNationalities["+_i+"]] <= 0>>
					<<set delete $nationalities[setup.baseNationalities["+_i+"]]>>
				<</if>>
				<<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>>
			<</link>>@@
		">>
		<</if>>
	<<if $nationalities[_nation] > 1 >>
		<<print "
			@@.zeroButton;<<link '0'>>
				<<set delete $nationalities[setup.baseNationalities["+_i+"]]>>
				<<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>>
			<</link>>@@
		">>
	<</if>>
	<<if _i < setup.baseNationalities.length-1>>| <</if>>

	<</for>>

By dominant race/ethnicity (hover over the name to see the nationalities affected):

	<<foreach _race of setup.filterRaces>>
		<<set _racialNationalities = setup.baseNationalities.filter(function(n) {
			var races = setup.raceSelector[n] || setup.raceSelector[''];
			return races[_race.toLowerCase()] * 2 > hashSum(races); })>>
		<<if _racialNationalities.length > 0>>
			<<= "
 0 ? _racialNationalities.join(", ") : "(none)")
				+"'>_race @@.plusButton; <<link '+'>>
				<<run setup.baseNationalities.filter(function(n) {
						var races = setup.raceSelector[n] || setup.raceSelector[''];
						return races['" + _race.toLowerCase() + "'] * 2 > hashSum(races); }).forEach(function(n) { hashPush($nationalities, n);})>>
				<<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>>
			<</link>>@@ @@.zeroButton;<<link '0'>>
				<<run setup.baseNationalities.filter(function(n) {
						var races = setup.raceSelector[n] || setup.raceSelector[''];
						return races['" + _race.toLowerCase() + "'] * 2 > hashSum(races); }).forEach(function(n) { delete $nationalities[n]; })>>
				<<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>>
			<</link>>@@
">>
		<</if>>
	<</foreach>>
<<else>>
/* Filtered pop controls */
	<<set _controlsNationality = setup[$baseControlsFilter+'Nationalities']>>
	<<for _i = 0; _i < _controlsNationality.length; _i++>>

		<<set _nation = _controlsNationality[_i]>>
		<<print "
		_nation
			@@.plusButton;<<link '+'>>
				<<set hashPush($nationalities, _controlsNationality[" + _i + "])>>
				<<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>>
			<</link>>@@
		">>
	<<if def $nationalitiescheck[_nation]>>
		<<print "
			@@.minusButton;<<link '–'>>
				<<set $nationalities[_controlsNationality["+_i+"]] -= 1>>
				<<if $nationalities[_controlsNationality["+_i+"]] <= 0>>
					<<set delete $nationalities[_controlsNationality["+_i+"]]>>
				<</if>>
				<<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>>
			<</link>>@@
		">>
		<</if>>
	<<if $nationalities[_nation] > 1 >>
		<<print "
			@@.zeroButton;<<link '0'>>
				<<set delete $nationalities[_controlsNationality["+_i+"]]>>
				<<replace '#PopControl'>><<include 'Basenationalities Controls'>><</replace>>
			<</link>>@@
		">>
	<</if>>
	<<if _i < _controlsNationality.length-1>>| <</if>>

	<</for>>
<</if>>