Beispiel #1
0
        private static IEnumerable <Backstory> NewBackstories()
        {
            if (backstories == null)
            {
                Backstory backstory;

                backstories = new List <Backstory>();
                string   txtBaseDesc   = "----------";
                string   txtTitle      = "---";
                string   txtTitleShort = "AI";
                BodyType bodyType      = BodyType.Female;

                if (workTagCollection == null)
                {
                    // Set a list with the possible disabled items
                    workTagCollection = new List <WorkTags>();
                    workTagCollection.Add(WorkTags.Animals);
                    //workTagCollection.Add(WorkTags.Artistic); //- In BasicWorkDisables
                    workTagCollection.Add(WorkTags.Caring);
                    workTagCollection.Add(WorkTags.Cleaning);
                    workTagCollection.Add(WorkTags.Cooking);
                    workTagCollection.Add(WorkTags.Crafting);
                    workTagCollection.Add(WorkTags.Firefighting);
                    workTagCollection.Add(WorkTags.Hauling);
                    workTagCollection.Add(WorkTags.Intellectual);
                    workTagCollection.Add(WorkTags.ManualDumb);
                    workTagCollection.Add(WorkTags.ManualSkilled);
                    workTagCollection.Add(WorkTags.Mining);
                    workTagCollection.Add(WorkTags.PlantWork);
                    workTagCollection.Add(WorkTags.Social);
                    workTagCollection.Add(WorkTags.Violent);
                    //workTagCollection.Add();
                }

                // Get the base disables (The AI can never do these)
                WorkTags workDisables1 = GetBasicWorkDisables();
                WorkTags workDisables2;

                // Create minimal backstory
                backstory          = new Backstory();
                backstory.baseDesc = txtBaseDesc;
                backstory.SetTitle(txtTitle);
                backstory.SetTitleShort(txtTitleShort);
                backstory.bodyTypeGlobal = bodyType;
                backstory.bodyTypeFemale = BodyType.Female;
                backstory.bodyTypeMale   = BodyType.Male;
                backstory.workDisables   = workDisables1;
                backstory.identifier     = GetBackstoryUniqueKey(backstory.workDisables);
                backstories.Add(backstory);

                //string log = workDisables1.ToString().Replace(", ", "_"); //Logging

                // add other backstories
                if (allCombos == null)
                {
                    allCombos = HelperAIPawn.GetAllCombos <WorkTags>(workTagCollection);
                }

                foreach (List <WorkTags> activeCombo in allCombos)
                {
                    workDisables2 = GetBasicWorkDisables();
                    foreach (WorkTags entry in activeCombo)
                    {
                        workDisables2 = workDisables2 | entry;
                    }

                    backstory          = new Backstory();
                    backstory.baseDesc = txtBaseDesc;
                    backstory.SetTitle(txtTitle);
                    backstory.SetTitleShort(txtTitleShort);
                    backstory.bodyTypeGlobal = bodyType;
                    backstory.bodyTypeFemale = BodyType.Female;
                    backstory.bodyTypeMale   = BodyType.Male;
                    backstory.workDisables   = workDisables2;
                    backstory.identifier     = GetBackstoryUniqueKey(backstory.workDisables);
                    backstories.Add(backstory);

                    //log = log + Environment.NewLine + backstory.defName; // workDisables2.ToString().Replace(", ", "_"); //Logging
                }
            }

            //Log.Error(log); //Logging

            return(backstories.AsEnumerable <Backstory>());
        }