Пример #1
0
        protected OptionsBodyType InitializeAlienRaceBodyTypes(ThingDef def)
        {
            OptionsBodyType result    = new OptionsBodyType();
            AlienRace       alienRace = AlienRaceProvider.GetAlienRace(def);

            if (alienRace == null)
            {
                return(null);
            }
            if (alienRace.BodyTypes.Count > 0)
            {
                bool containsMale              = alienRace.BodyTypes.Contains(BodyTypeDefOf.Male);
                bool containsFemale            = alienRace.BodyTypes.Contains(BodyTypeDefOf.Female);
                bool containsBothMaleAndFemale = containsMale && containsFemale;
                foreach (BodyTypeDef type in alienRace.BodyTypes)
                {
                    if (type != BodyTypeDefOf.Male || !containsBothMaleAndFemale)
                    {
                        result.FemaleBodyTypes.Add(type);
                    }
                    if (type != BodyTypeDefOf.Female || !containsBothMaleAndFemale)
                    {
                        result.MaleBodyTypes.Add(type);
                    }
                    result.NoGenderBodyTypes.Add(type);
                }
            }

            if (result.MaleBodyTypes.Count == 0 && result.FemaleBodyTypes.Count == 0)
            {
                result = InitializeNonModdedDefaultHumanlikeBodyTypes();
                //if (alienRace.GraphicsPathForBodyTypes != null && !defaultBodyTypesPaths.Contains(alienRace.GraphicsPathForBodyTypes)) {
                //    result = InitializeHumanlikeBodyTypes();
                //    result.MaleBodyTypes = result.MaleBodyTypes.Where(d => ValidateBodyTypeForAlienRace(alienRace, d)).ToList();
                //    result.FemaleBodyTypes = result.FemaleBodyTypes.Where(d => ValidateBodyTypeForAlienRace(alienRace, d)).ToList();
                //}
                //else {
                //    result = InitializeNonModdedDefaultHumanlikeBodyTypes();
                //}
            }

            /*
             * // TODO: Is this right?
             * // Was this trying to guard against mod developers only defining male and not female body types?
             * if (result.MaleBodyTypes.Count == 0 && result.FemaleBodyTypes.Count > 0) {
             *  result.MaleBodyTypes = result.FemaleBodyTypes;
             * }
             * else if (result.FemaleBodyTypes.Count == 0 && result.MaleBodyTypes.Count > 0) {
             *  result.FemaleBodyTypes = result.MaleBodyTypes;
             * }
             *
             * if (result.MaleBodyTypes.Count == 0 && result.FemaleBodyTypes.Count == 0) {
             *  result = InitializeHumanlikeBodyTypes();
             * }
             */

            return(result);
        }
Пример #2
0
 protected OptionsBodyType InitializeBodyTypes(ThingDef def)
 {
     if (!ProviderAlienRaces.IsAlienRace(def))
     {
         return(InitializeHumanlikeBodyTypes());
     }
     else
     {
         OptionsBodyType result = InitializeAlienRaceBodyTypes(def);
         if (result == null)
         {
             Logger.Warning("Could not initialize body types for alien race, " + def.defName + ". Defaulting to humanlike body types.");
             return(InitializeHumanlikeBodyTypes());
         }
         return(result);
     }
 }
Пример #3
0
        protected OptionsBodyType InitializeHumanlikeBodyTypes()
        {
            OptionsBodyType result = new OptionsBodyType();

            foreach (BodyTypeDef d in DefDatabase <BodyTypeDef> .AllDefs)
            {
                if (d != BodyTypeDefOf.Female)
                {
                    result.MaleBodyTypes.Add(d);
                }
                if (d != BodyTypeDefOf.Male)
                {
                    result.FemaleBodyTypes.Add(d);
                }
                result.NoGenderBodyTypes.Add(d);
            }
            return(result);
        }
Пример #4
0
        protected OptionsBodyType InitializeNonModdedDefaultHumanlikeBodyTypes()
        {
            OptionsBodyType result = new OptionsBodyType();

            foreach (BodyTypeDef d in defaultNonModdedBodyTypes)
            {
                if (d != BodyTypeDefOf.Female)
                {
                    result.MaleBodyTypes.Add(d);
                }
                if (d != BodyTypeDefOf.Male)
                {
                    result.FemaleBodyTypes.Add(d);
                }
                result.NoGenderBodyTypes.Add(d);
            }
            return(result);
        }
        protected OptionsBodyType InitializeHumanlikeBodyTypes()
        {
            OptionsBodyType result = new OptionsBodyType();

            result.MaleBodyTypes.Add(BodyType.Male);
            result.MaleBodyTypes.Add(BodyType.Thin);
            result.MaleBodyTypes.Add(BodyType.Fat);
            result.MaleBodyTypes.Add(BodyType.Hulk);
            result.FemaleBodyTypes.Add(BodyType.Female);
            result.FemaleBodyTypes.Add(BodyType.Thin);
            result.FemaleBodyTypes.Add(BodyType.Fat);
            result.FemaleBodyTypes.Add(BodyType.Hulk);
            result.NoGenderBodyTypes.Add(BodyType.Male);
            result.NoGenderBodyTypes.Add(BodyType.Thin);
            result.NoGenderBodyTypes.Add(BodyType.Fat);
            result.NoGenderBodyTypes.Add(BodyType.Hulk);
            return(result);
        }
Пример #6
0
        protected OptionsBodyType InitializeAlienRaceBodyTypes(ThingDef def)
        {
            OptionsBodyType result    = new OptionsBodyType();
            AlienRace       alienRace = AlienRaceProvider.GetAlienRace(def);

            if (alienRace == null)
            {
                return(null);
            }
            if (alienRace.BodyTypes.Count > 0)
            {
                bool containsMale              = alienRace.BodyTypes.Contains(BodyTypeDefOf.Male);
                bool containsFemale            = alienRace.BodyTypes.Contains(BodyTypeDefOf.Female);
                bool containsBothMaleAndFemale = containsMale && containsFemale;
                foreach (BodyTypeDef type in alienRace.BodyTypes)
                {
                    if (type != BodyTypeDefOf.Male || !containsBothMaleAndFemale)
                    {
                        result.FemaleBodyTypes.Add(type);
                    }
                    if (type != BodyTypeDefOf.Female || !containsBothMaleAndFemale)
                    {
                        result.MaleBodyTypes.Add(type);
                    }
                    result.NoGenderBodyTypes.Add(type);
                }
            }

            if (result.MaleBodyTypes.Count == 0 && result.FemaleBodyTypes.Count > 0)
            {
                result.MaleBodyTypes = result.FemaleBodyTypes;
            }
            else if (result.FemaleBodyTypes.Count == 0 && result.MaleBodyTypes.Count > 0)
            {
                result.FemaleBodyTypes = result.MaleBodyTypes;
            }

            return(result);
        }
Пример #7
0
 protected OptionsBodyType InitializeBodyTypes(ThingDef def)
 {
     if (!ProviderAlienRaces.IsAlienRace(def))
     {
         return(InitializeHumanlikeBodyTypes());
     }
     else
     {
         OptionsBodyType result = InitializeAlienRaceBodyTypes(def);
         if (result == null)
         {
             Log.Warning("Prepare Carefully could not initialize body types for alien race, " + def.defName + ". Defaulting to humanlike body types.");
             return(InitializeHumanlikeBodyTypes());
         }
         if (result.MaleBodyTypes.Count == 0 || result.FemaleBodyTypes.Count == 0)
         {
             return(InitializeHumanlikeBodyTypes());
         }
         else
         {
             return(result);
         }
     }
 }