From 50d4f083d4cf73b060ce3128716f7e227c811878 Mon Sep 17 00:00:00 2001
From: j <okp57855@psoxs.com>
Date: Thu, 4 Jan 2018 22:28:58 +1300
Subject: [PATCH] Resorting and adding missing catches.

---
 src/init/storyInit.tw                       |   2 +-
 src/uncategorized/BackwardsCompatibility.tw | 205 ++++++++++----------
 2 files changed, 105 insertions(+), 102 deletions(-)

diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw
index 697af0eb635..d8e8f97b6bd 100644
--- a/src/init/storyInit.tw
+++ b/src/init/storyInit.tw
@@ -1212,7 +1212,7 @@ FertilityAge($fertilityAge)
 
 /* Colonel */
 <<set $securityForceSexedColonelToken = 0>>			/* Has the player sexed The colonel this week? */
-<<set $ColonelCore = 0>>							/* What is the core of The Colonel? */
+<<set $ColonelCore = "">>							/* What is the core of The Colonel? */
 <<set $securityForceColonelToken = 0>>				/* Flag to keep track of talking to the colonel. */
 <<set $securityForceColonelSexed = 0>>				/* Has the player sexed The colonel this week? */
 
diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw
index 69bc9089264..d4ae955c23b 100644
--- a/src/uncategorized/BackwardsCompatibility.tw
+++ b/src/uncategorized/BackwardsCompatibility.tw
@@ -661,114 +661,117 @@
 	<<set $failedElite = 0>>
 <</if>>
 
-/* SF anon additional Special Force Variables [SFVAR] */
+<<if $SFMODToggle == 1 && $securityForceCreate == 1>> 
+	/* SF anon additional Special Force Variables [SFVAR] */
 
-/* Personnel/Gear  */
-<<if ndef $securityForceHeavyBattleTank>>
-	<<set $securityForceHeavyBattleTank = 0>>
-<</if>>
-<<if ndef $securityForceColonelToken>>
-	<<set $securityForceColonelToken = 0>>
-<</if>>
-<<if ndef $securityForceSpacePlanePower>>
-	<<set $securityForceSpacePlanePower = 0>>
-<</if>>
-<<if ndef $securityForceFortressZeppelin>>
-	<<set $securityForceFortressZeppelin = 0>>
-<</if>>
-<<if ndef $securityForceAC130>>
-	<<set $securityForceAC130 = 0>>
-<</if>>
-<<if ndef $securityForceHeavyTransport>>
-	<<set $securityForceHeavyTransport = 0>>
-<</if>>
-<<if ndef $securityForceSatellitePower>>
-	<<set $securityForceSatellitePower = 0>>
-<</if>>
-<<if ndef $securityForceGiantRobot>>
-	<<set $securityForceGiantRobot = 0>>
-<</if>>
-<<if ndef $securityForceMissileSilo>>
-	<<set $securityForceMissileSilo = 0>>
-<</if>>
-<<if ndef $SSLevelNavalYard && $terrain == "oceanic">>
-	<<set $SSLevelNavalYard = 0>>
-<</if>>
-<<if ndef $securityForceAircraftCarrier && $terrain == "oceanic">>
-	<<set $securityForceAircraftCarrier = 0>>
-<</if>>
-<<if ndef $securityForceSubmarine && $terrain == "oceanic">>
-	<<set $securityForceSubmarine = 0>>
-<</if>>
+	/* Personnel/Gear  */
+	<<if ndef $securityForceHeavyBattleTank>>
+		<<set $securityForceHeavyBattleTank = 0>>
+	<</if>>
+	<<if ndef $securityForceSpacePlanePower>>
+		<<set $securityForceSpacePlanePower = 0>>
+	<</if>>
+	<<if ndef $securityForceFortressZeppelin>>
+		<<set $securityForceFortressZeppelin = 0>>
+	<</if>>
+	<<if ndef $securityForceAC130>>
+		<<set $securityForceAC130 = 0>>
+	<</if>>
+	<<if ndef $securityForceHeavyTransport>>
+		<<set $securityForceHeavyTransport = 0>>
+	<</if>>
+	<<if ndef $securityForceSatellitePower>>
+		<<set $securityForceSatellitePower = 0>>
+	<</if>>
+	<<if $terrain != "oceanic" && $terrain != "marine">>
+		<<if ndef $securityForceGiantRobot>>
+			<<set $securityForceGiantRobot = 0>>
+		<</if>>
+		<<if ndef $securityForceMissileSilo>>
+			<<set $securityForceMissileSilo = 0>>
+		<</if>>
+	<</if>>
+	<<if $terrain == "oceanic" || $terrain == "marine">>
+		<<if ndef $HeavyAmphibiousTransport>
+			<<set $HeavyAmphibiousTransport = 0>>
+		<</if>>
+		<<if ndef $securityForceAircraftCarrier>>
+			<<set $securityForceAircraftCarrier = 0>>
+		<</if>>
+		<<if ndef $securityForceSubmarine>>
+			<<set $securityForceSubmarine = 0>>
+		<</if>>
+	<</if>>
 
-/* FacilitySupport */
-<<if ndef $FacSupIDs>>
-	<<set $FacSupIDs = []>>
-<</if>>
-<<if $FacSupIDs.length > 0 && typeof $FacSupIDs[0] === 'object'>>
-	<<set $FacSupIDs = $FacSupIDs.map(function(a) { return a.ID; })>>
-<</if>>
-<<if ndef $facilitysupportName>>
-	<<set $facilitysupportName = "facility support">>
-<</if>>
-<<if ndef $facilitysupportNameCaps>>
-	<<set $facilitysupportNameCaps = "facility support">>
-<</if>>
-<<if ndef $facilitysupportName>>
-	<<set $facilitysupportName = "standard">>
-<</if>>
+	/* FacilitySupport */
+	<<if ndef $FacSupIDs>>
+		<<set $FacSupIDs = []>>
+	<</if>>
+	<<if $FacSupIDs.length > 0 && typeof $FacSupIDs[0] === 'object'>>
+		<<set $FacSupIDs = $FacSupIDs.map(function(a) { return a.ID; })>>
+	<</if>>
+	<<if ndef $facilitysupportName>>
+		<<set $facilitysupportName = "facility support">>
+	<</if>>
+	<<if ndef $facilitysupportNameCaps>>
+		<<set $facilitysupportNameCaps = "facility support">>
+	<</if>>
+	<<if ndef $facilitysupportName>>
+		<<set $facilitysupportName = "standard">>
+	<</if>>
 
-<<if ndef $Lieutenantcolonel>>
-	<<set $Lieutenantcolonel = 0>>
-<</if>>
-<<if ndef $FacilitySupportSlaves>>
-	<<set $FacilitySupportSlaves = 0>>
-<</if>>
+	<<if ndef $Lieutenantcolonel>>
+		<<set $Lieutenantcolonel = 0>>
+	<</if>>
+	<<if ndef $FacilitySupportSlaves>>
+		<<set $FacilitySupportSlaves = 0>>
+	<</if>>
 
-<<if ndef $FacilitySupportfficiency>>
-	<<set $FacilitySupportfficiency = 0>>
-<</if>>
-<<if ndef $FacilitySupportUpgrade>>
-	<<set $FacilitySupportUpgrade = 0>>
-<</if>>
+	<<if ndef $FacilitySupportfficiency>>
+		<<set $FacilitySupportfficiency = 0>>
+	<</if>>
+	<<if ndef $FacilitySupportUpgrade>>
+		<<set $FacilitySupportUpgrade = 0>>
+	<</if>>
 
-/* Colonel /*
-<<if $colonelCore != "shell shocked">>
-	<<set $colonelCore = "shell shocked">>
-<</if>>
-<<if ndef $securityForceColonelToken>>
-	<<set $securityForceColonelToken = 0>>
-<</if>>
-<<if ndef $securityForceSexedColonelToken>>
-	<<set $securityForceSexedColonelToken = 0>>
-<</if>>
-<<if ndef $securityForceColonelSexed>>
-	<<set $securityForceColonelSexed = 0>>
-<</if>>
+	/* Colonel /*
+	<<if ndef $ColonelCore>>
+		<<set $ColonelCore = "">>
+	<</if>>
+	<<if ndef $securityForceColonelToken>>
+		<<set $securityForceColonelToken = 0>>
+	<</if>>
+	<<if ndef $securityForceSexedColonelToken>>
+		<<set $securityForceSexedColonelToken = 0>>
+	<</if>>
+	<<if ndef $securityForceColonelSexed>>
+		<<set $securityForceColonelSexed = 0>>
+	<</if>>
 
-/* TradeShow */
-<<if ndef $TradeShowAttendanceGranted>>
-	<<set $TradeShowAttendanceGranted = 0>>
-<</if>>
-<<if ndef $OverallTradeShowAttendance>>
-	<<set $OverallTradeShowAttendance = 0>>
-<</if>>
-<<if ndef $CurrentTradeShowAttendance>>
-	<<set $CurrentTradeShowAttendance = 0>>
-<</if>>
-<<if ndef $TradeShowIncome>>
-	<<set $TradeShowIncome = 0>>
-<</if>>
-<<if ndef $TotalTradeShowIncome>>
-	<<set $TotalTradeShowIncome = 0>>
-<</if>>
-<<if ndef $TradeShowHelots>>
-	<<set $TradeShowHelots = 0>>
-<</if>>
-<<if ndef $TotalTradeShowHelots>>
-	<<set $TotalTradeShowHelots = 0>>
-<</if>>
+	/* TradeShow */
+	<<if ndef $TradeShowAttendanceGranted>>
+		<<set $TradeShowAttendanceGranted = 0>>
+	<</if>>
+	<<if ndef $OverallTradeShowAttendance>>
+		<<set $OverallTradeShowAttendance = 0>>
+	<</if>>
+	<<if ndef $CurrentTradeShowAttendance>>
+		<<set $CurrentTradeShowAttendance = 0>>
+	<</if>>
+	<<if ndef $TradeShowIncome>>
+		<<set $TradeShowIncome = 0>>
+	<</if>>
+	<<if ndef $TotalTradeShowIncome>>
+		<<set $TotalTradeShowIncome = 0>>
+	<</if>>
+	<<if ndef $TradeShowHelots>>
+		<<set $TradeShowHelots = 0>>
+	<</if>>
+	<<if ndef $TotalTradeShowHelots>>
+		<<set $TotalTradeShowHelots = 0>>
+	<</if>>
 
+<</if>>
 
 <<if ndef $arcologies[0].FSAztecRevivalist>>
 	<<for _bci = 0; _bci < $arcologies.length; _bci++>>
-- 
GitLab