diff --git a/src/js/datatypeCleanupJS.js b/src/js/datatypeCleanupJS.js index 0d08a8dba843f8dd01e0aa64a61440bfe0f2bfdc..30211386f3b9950f1bc18c0bdc5702402c146c11 100644 --- a/src/js/datatypeCleanupJS.js +++ b/src/js/datatypeCleanupJS.js @@ -1328,6 +1328,110 @@ window.ArcologyDatatypeCleanup = function ArcologyDatatypeCleanup() { V.TFS.schoolProsperity = Math.clamp(+V.TFS.schoolProsperity, -10, 10) || 0; }; +window.FacilityDatatypeCleanup = function() { + FacilityIDArrayCleanup(); + FacilityDecorationCleanup(); + FacilityNameCleanup(); +}; + +window.FacilityIDArrayCleanup = function() { + const V = State.variables; + if (!Array.isArray(V.BrothiIDs)) + V.BrothiIDs = []; + else if (typeof V.BrothiIDs[0] === "object") + V.BrothiIDs = V.BrothiIDs.map(function(a) { return a.ID; }); + + if (!Array.isArray(V.DairyiIDs)) + V.DairyiIDs = []; + else if (typeof V.DairyiIDs[0] === "object") + V.DairyiIDs = V.DairyiIDs.map(function(a) { return a.ID; }); + + if (!Array.isArray(V.ClubiIDs)) + V.ClubiIDs = []; + else if (typeof V.ClubiIDs[0] === "object") + V.ClubiIDs = V.ClubiIDs.map(function(a) { return a.ID; }); + + if (!Array.isArray(V.ServQiIDs)) + V.ServQiIDs = []; + else if (typeof V.ServQiIDs[0] === "object") + V.ServQiIDs = V.ServQiIDs.map(function(a) { return a.ID; }); + + if (!Array.isArray(V.SchlRiIDs)) + V.SchlRiIDs = []; + else if (typeof V.SchlRiIDs[0] === "object") + V.SchlRiIDs = V.SchlRiIDs.map(function(a) { return a.ID; }); + + if (!Array.isArray(V.SpaiIDs)) + V.SpaiIDs = []; + else if (typeof V.SpaiIDs[0] === "object") + V.SpaiIDs = V.SpaiIDs.map(function(a) { return a.ID; }); + + if (!Array.isArray(V.CliniciIDs)) + V.CliniciIDs = []; + else if (typeof V.CliniciIDs[0] === "object") + V.CliniciIDs = V.CliniciIDs.map(function(a) { return a.ID; }); + + if (!Array.isArray(V.ArcadeiIDs)) + V.ArcadeiIDs = []; + else if (typeof V.ArcadeiIDs[0] === "object") + V.ArcadeiIDs = V.ArcadeiIDs.map(function(a) { return a.ID; }); + + if (!Array.isArray(V.CellBiIDs)) + V.CellBiIDs = []; + else if (typeof V.CellBiIDs[0] === "object") + V.CellBiIDs = V.CellBiIDs.map(function(a) { return a.ID; }); + + if (!Array.isArray(V.MastSiIDs)) + V.MastSiIDs = []; + else if (typeof V.MastSiIDs[0] === "object") + V.MastSiIDs = V.MastSiIDs.map(function(a) { return a.ID; }); + + if (!Array.isArray(V.HGSuiteiIDs)) + V.HGSuiteiIDs = []; + else if (typeof V.HGSuiteiIDs[0] === "object") + V.HGSuiteiIDs = V.HGSuiteiIDs.map(function(a) { return a.ID; }); + + if (!Array.isArray(V.NurseryiIDs)) + V.NurseryiIDs = []; + else if (typeof V.NurseryiIDs[0] === "object") + V.NurseryiIDs = V.NurseryiIDs.map(function(a) { return a.ID; }); + + if (!Array.isArray(V.FarmyardiIDs)) + V.FarmyardiIDs = []; + else if (typeof V.FarmyardiIDs[0] === "object") + V.FarmyardiIDs = V.FarmyardiIDs.map(function(a) { return a.ID; }); +}; + +window.FacilityDecorationCleanup = function() { + const V = State.variables; + if (typeof V.brothelDecoration !== "string") + V.brothelDecoration = "standard"; + if (typeof V.dairyDecoration !== "string") + V.dairyDecoration = "standard"; + if (typeof V.clubDecoration !== "string") + V.clubDecoration = "standard"; + if (typeof V.servantsQuartersDecoration !== "string") + V.servantsQuartersDecoration = "standard"; + if (typeof V.schoolroomDecoration !== "string") + V.schoolroomDecoration = "standard"; + if (typeof V.spaDecoration !== "string") + V.spaDecoration = "standard"; + if (typeof V.clinicDecoration !== "string") + V.clinicDecoration = "standard"; + if (typeof V.arcadeDecoration !== "string") + V.arcadeDecoration = "standard"; + if (typeof V.cellblockDecoration !== "string") + V.cellblockDecoration = "standard"; + if (typeof V.masterSuiteDecoration !== "string") + V.masterSuiteDecoration = "standard"; + if (typeof V.nurseryDecoration !== "string") + V.nurseryDecoration = "standard"; + if (typeof V.farmyardDecoration !== "string") + V.farmyardDecoration = "standard"; + if (typeof V.brothelDecoration !== "string") + V.brothelDecoration = "standard"; +}; + window.FacilityNameCleanup = function FacilityNameCleanup() { const V = State.variables; V.arcologies[0].name = V.arcologies[0].name || "Arcology X-4"; diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index 36da2c0c97bfbb923573016b7be59c4da90e5715..51cb9703282805a5d9d2c91f9b14d50a814e3dda 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -694,12 +694,6 @@ <<if ndef $incubatorGrowthStimsSetting>> <<set $incubatorGrowthStimsSetting = 0>> <</if>> -<<if ndef $incubatorName>> - <<set $incubatorName = "the Incubator">> -<</if>> -<<if ndef $incubatorNameCaps>> - <<set $incubatorNameCaps = "The Incubator">> -<</if>> <<if ndef $reservedChildren>> <<set $reservedChildren = 0>> <</if>> @@ -719,12 +713,6 @@ <<if ndef $nurserySlaves>> <<set $nurserySlaves = 0>> <</if>> -<<if ndef $NurseryiIDs>> - <<set $NurseryiIDs = []>> -<</if>> -<<if $NurseryiIDs.length > 0 && typeof $NurseryiIDs[0] === 'object'>> - <<set $NurseryiIDs = $NurseryiIDs.map(function(a) { return a.ID; })>> -<</if>> <<if ndef $Matron>> <<set $Matron = 0>> <</if>> @@ -737,15 +725,6 @@ <<if ndef $MatronInfluence>> <<set $MatronInfluence = 0>> <</if>> -<<if ndef $nurseryName>> - <<set $nurseryName = "the Nursery">> -<</if>> -<<if ndef $nurseryNameCaps>> - <<set $nurseryNameCaps = "The Nursery">> -<</if>> -<<if ndef $nurseryDecoration>> - <<set $nurseryDecoration = "standard">> -<</if>> <<if ndef $nurseryWeight>> <<set $nurseryWeight = 0>> <</if>> @@ -783,24 +762,9 @@ <<set $cribsFreed = []>> <</if>> -<<if ndef $FarmyardiIDs>> - <<set $FarmyardiIDs = []>> -<</if>> -<<if $FarmyardiIDs.length > 0 && typeof $FarmyardiIDs[0] === 'object'>> - <<set $FarmyardiIDs = $FarmyardiIDs.map(function(a) { return a.ID; })>> -<</if>> <<if ndef $Farmer>> <<set $Farmer = 0>> <</if>> -<<if ndef $farmyardName>> - <<set $farmyardName = "the Farmyard">> -<</if>> -<<if ndef $farmyardNameCaps>> - <<set $farmyardNameCaps = "The Farmyard">> -<</if>> -<<if ndef $farmyardDecoration>> - <<set $farmyardDecoration = "standard">> -<</if>> <<if ndef $farmyard>> <<set $farmyard = 0>> <</if>> @@ -1809,37 +1773,6 @@ Setting missing global variables: <<set $roomsPopulation = 0>> <</if>> -<<if ndef $BrothiIDs>> - <<set $BrothiIDs = []>> -<</if>> -<<if $BrothiIDs.length > 0 && typeof $BrothiIDs[0] === 'object'>> - <<set $BrothiIDs = $BrothiIDs.map(function(a) { return a.ID; })>> -<</if>> -<<if ndef $brothelName>> - <<set $brothelName = "the Brothel">> -<</if>> -<<if ndef $brothelNameCaps>> - <<set $brothelNameCaps = "The Brothel">> -<</if>> -<<if ndef $brothelDecoration>> - <<set $brothelDecoration = "standard">> -<</if>> - -<<if ndef $DairyiIDs>> - <<set $DairyiIDs = []>> -<</if>> -<<if $DairyiIDs.length > 0 && typeof $DairyiIDs[0] === 'object'>> - <<set $DairyiIDs = $DairyiIDs.map(function(a) { return a.ID; })>> -<</if>> -<<if ndef $dairyName>> - <<set $dairyName = "the Dairy">> -<</if>> -<<if ndef $dairyNameCaps>> - <<set $dairyNameCaps = "The Dairy">> -<</if>> -<<if ndef $dairyDecoration>> - <<set $dairyDecoration = "standard">> -<</if>> <<if ndef $dairyFeedersUpgrade>> <<set $dairyFeedersUpgrade = 0>> <</if>> @@ -1869,88 +1802,13 @@ Setting missing global variables: <<set $bioreactorsBarren = 0>> <</if>> -<<if ndef $ClubiIDs>> - <<set $ClubiIDs = []>> -<</if>> -<<if $ClubiIDs.length > 0 && typeof $ClubiIDs[0] === 'object'>> - <<set $ClubiIDs = $ClubiIDs.map(function(a) { return a.ID; })>> -<</if>> -<<if ndef $clubName>> - <<set $clubName = "the Club">> -<</if>> -<<if ndef $clubNameCaps>> - <<set $clubNameCaps = "The Club">> -<</if>> -<<if ndef $clubDecoration>> - <<set $clubDecoration = "standard">> -<</if>> - -<<if ndef $ServQiIDs>> - <<set $ServQiIDs = []>> -<</if>> -<<if $ServQiIDs.length > 0 && typeof $ServQiIDs[0] === 'object'>> - <<set $ServQiIDs = $ServQiIDs.map(function(a) { return a.ID; })>> -<</if>> -<<if ndef $servantsQuartersName>> - <<set $servantsQuartersName = "the Servants' Quarters">> -<</if>> -<<if ndef $servantsQuartersNameCaps>> - <<set $servantsQuartersNameCaps = "The Servants' Quarters">> -<</if>> -<<if ndef $servantsQuartersDecoration >> - <<set $servantsQuartersDecoration = "standard">> -<</if>> - -<<if ndef $SchlRiIDs>> - <<set $SchlRiIDs = []>> -<</if>> -<<if $SchlRiIDs.length > 0 && typeof $SchlRiIDs[0] === 'object'>> - <<set $SchlRiIDs = $SchlRiIDs.map(function(a) { return a.ID; })>> -<</if>> -<<if ndef $schoolroomName>> - <<set $schoolroomName = "the Schoolroom">> -<</if>> -<<if ndef $schoolroomNameCaps>> - <<set $schoolroomNameCaps = "The Schoolroom">> -<</if>> <<if ndef $schoolroomUpgradeSkills>> <<set $schoolroomUpgradeSkills = 0>> <</if>> <<if ndef $schoolroomUpgradeLanguage>> <<set $schoolroomUpgradeLanguage = 0>> <</if>> -<<if ndef $schoolroomDecoration>> - <<set $schoolroomDecoration = "standard">> -<</if>> - -<<if ndef $SpaiIDs>> - <<set $SpaiIDs = []>> -<</if>> -<<if $SpaiIDs.length > 0 && typeof $SpaiIDs[0] === 'object'>> - <<set $SpaiIDs = $SpaiIDs.map(function(a) { return a.ID; })>> -<</if>> -<<if ndef $spaName>> - <<set $spaName = "the Spa">> -<</if>> -<<if ndef $spaNameCaps>> - <<set $spaNameCaps = "The Spa">> -<</if>> -<<if ndef $spaDecoration>> - <<set $spaDecoration = "standard">> -<</if>> -<<if ndef $CliniciIDs>> - <<set $CliniciIDs = []>> -<</if>> -<<if $CliniciIDs.length > 0 && typeof $CliniciIDs[0] === 'object'>> - <<set $CliniciIDs = $CliniciIDs.map(function(a) { return a.ID; })>> -<</if>> -<<if ndef $clinicName>> - <<set $clinicName = "the Clinic">> -<</if>> -<<if ndef $clinicNameCaps>> - <<set $clinicNameCaps = "The Clinic">> -<</if>> <<if ndef $clinicSlaves>> <<set $clinicSlaves = 0>> <</if>> @@ -1963,57 +1821,11 @@ Setting missing global variables: <<if ndef $clinicUpgradeScanner>> <<set $clinicUpgradeScanner = 0>> <</if>> -<<if ndef $clinicDecoration>> - <<set $clinicDecoration = "standard">> -<</if>> -<<if ndef $ArcadeiIDs>> - <<set $ArcadeiIDs = []>> -<</if>> -<<if $ArcadeiIDs.length > 0 && typeof $ArcadeiIDs[0] === 'object'>> - <<set $ArcadeiIDs = $ArcadeiIDs.map(function(a) { return a.ID; })>> -<</if>> -<<if ndef $arcadeName>> - <<set $arcadeName = "the Arcade">> -<</if>> -<<if ndef $arcadeNameCaps>> - <<set $arcadeNameCaps = "The Arcade">> -<</if>> -<<if ndef $arcadeDecoration>> - <<set $arcadeDecoration = "standard">> -<</if>> - -<<if ndef $CellBiIDs>> - <<set $CellBiIDs = []>> -<</if>> -<<if $CellBiIDs.length > 0 && typeof $CellBiIDs[0] === 'object'>> - <<set $CellBiIDs = $CellBiIDs.map(function(a) { return a.ID; })>> -<</if>> -<<if ndef $cellblockName>> - <<set $cellblockName = "the Cellblock">> -<</if>> -<<if ndef $cellblockNameCaps>> - <<set $cellblockNameCaps = "The Cellblock">> -<</if>> -<<if ndef $cellblockDecoration>> - <<set $cellblockDecoration = "standard">> -<</if>> <<if ndef $cellblockWardenCumsInside>> <<set $cellblockWardenCumsInside = 0>> <</if>> -<<if ndef $MastSiIDs>> - <<set $MastSiIDs = []>> -<</if>> -<<if $MastSiIDs.length > 0 && typeof $MastSiIDs[0] === 'object'>> - <<set $MastSiIDs = $MastSiIDs.map(function(a) { return a.ID; })>> -<</if>> -<<if ndef $masterSuiteName>> - <<set $masterSuiteName = "the Master Suite">> -<</if>> -<<if ndef $masterSuiteNameCaps>> - <<set $masterSuiteNameCaps = "The Master Suite">> -<</if>> <<if ndef $masterSuiteUpgradePregnancy>> <<set $masterSuiteUpgradePregnancy = 0>> <</if>> @@ -2029,22 +1841,7 @@ Setting missing global variables: <<if ndef $universalHGImpregnateMasterSuiteToggle>> <<set $universalHGImpregnateMasterSuiteToggle = 0>> <</if>> -<<if ndef $masterSuiteDecoration>> - <<set $masterSuiteDecoration = "standard">> -<</if>> -<<if ndef $HGSuiteiIDs>> - <<set $HGSuiteiIDs = []>> -<</if>> -<<if $HGSuiteiIDs.length > 0 && typeof $HGSuiteiIDs[0] === 'object'>> - <<set $HGSuiteiIDs = $HGSuiteiIDs.map(function(a) { return a.ID; })>> -<</if>> -<<if ndef $HGSuiteName>> - <<set $HGSuiteName = "the Head Girl Suite">> -<</if>> -<<if ndef $HGSuiteNameCaps>> - <<set $HGSuiteNameCaps = "The Head Girl Suite">> -<</if>> <<if ndef $HGSuiteSurgery>> <<set $HGSuiteSurgery = 1>> <</if>> @@ -2058,12 +1855,8 @@ Setting missing global variables: <<set $HGSuiteEquality = 0>> <</if>> -<<if ndef $pitName>> - <<set $pitName = "the Pit">> -<</if>> -<<if ndef $pitNameCaps>> - <<set $pitNameCaps = "The Pit">> -<</if>> +<<run FacilityDatatypeCleanup()>> + <<if ndef $fighterIDs>> <<set $fighterIDs = []>> <</if>> diff --git a/src/uncategorized/main.tw b/src/uncategorized/main.tw index 15a86ebf74830ad4b2324fb295e80af8178a4c4e..0f8a78e26df06f187a4299e786f8eda846a4212f 100644 --- a/src/uncategorized/main.tw +++ b/src/uncategorized/main.tw @@ -69,7 +69,6 @@ <<set $nextButton = "END WEEK", $nextLink = "End Week", $showEncyclopedia = 1, $encyclopedia = "How to Play">> <<set $costs = Math.trunc(predictCost($slaves))>> -<<run FacilityNameCleanup()>> <<if ($PC.customTitle == "")>> <<set $PC.customTitle = undefined, $PC.customTitleLisp = undefined>> <</if>>