Example #1
0
 public static void Add(this Pawn pawn, Quirk quirk)
 {
     QuirkAdder.Add(pawn, quirk);
 }
Example #2
0
        // The main method for adding genitalia and orientation.
        public void Sexualize(Pawn pawn, bool reroll = false)
        {
            if (reroll)
            {
                Comp(pawn).orientation = Orientation.None;

                if (xxx.has_quirk(pawn, "Fertile"))
                {
                    Hediff fertility = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("IncreasedFertility"));
                    if (fertility != null)
                    {
                        pawn.health.RemoveHediff(fertility);
                    }
                }
                if (xxx.has_quirk(pawn, "Infertile"))
                {
                    Hediff fertility = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("DecreasedFertility"));
                    if (fertility != null)
                    {
                        pawn.health.RemoveHediff(fertility);
                    }
                }
                quirks = new StringBuilder();
            }
            else if (Comp(pawn).orientation != Orientation.None)
            {
                return;
            }

            //roll random RJW orientation
            Comp(pawn).orientation = xxx.is_animal(pawn) ? RollAnimalOrientation(pawn) : RollOrientation(pawn);

            //Asexual nymp re-roll
            //if (xxx.is_nympho(pawn))
            //	while (Comp(pawn).orientation == Orientation.Asexual)
            //	{
            //		Comp(pawn).orientation = RollOrientation();
            //	}

            //Log.Message("Sexualizing pawn " + pawn?.Name + ", def: " + pawn?.def?.defName);

            if (!reroll)
            {
                Sexualizer.sexualize_pawn(pawn);
            }
            //Log.Message("Orientation for pawn " + pawn?.Name + " is " + orientation);

            if (xxx.has_traits(pawn) && Genital_Helper.has_genitals(pawn) && !(pawn.kindDef.race.defName.ToLower().Contains("droid") && !AndroidsCompatibility.IsAndroid(pawn)))
            {
                if (RJWPreferenceSettings.sexuality_distribution == RJWPreferenceSettings.Rjw_sexuality.Vanilla)
                {
                    VanillaTraitCheck(pawn);
                }
                if (RJWPreferenceSettings.sexuality_distribution == RJWPreferenceSettings.Rjw_sexuality.Psychology)
                {
                    CopyPsychologySexuality(pawn);
                }
                if (RJWPreferenceSettings.sexuality_distribution == RJWPreferenceSettings.Rjw_sexuality.SYRIndividuality)
                {
                    CopyIndividualitySexuality(pawn);
                }
            }
            else if ((pawn.kindDef.race.defName.ToLower().Contains("droid") && !AndroidsCompatibility.IsAndroid(pawn)) || !Genital_Helper.has_genitals(pawn))
            {
                // Droids with no genitalia are set as asexual.
                // If player later adds genitalia to the droid, the droid 'sexuality' gets rerolled.
                Comp(pawn).orientation = Orientation.Asexual;
            }

            QuirkAdder.Generate(pawn);

            if (quirks.Length == 0)
            {
                quirks.Append("None");
                quirksave = quirks.ToString();
            }
        }
Example #3
0
        static void DrawQuirks(Pawn pawn, Rect row)
        {
            var quirks = Quirk.All
                         .Where(quirk => pawn.Has(quirk))
                         .OrderBy(quirk => quirk.Key)
                         .ToList();

            // Not actually localized.
            var quirkString = quirks.Select(quirk => quirk.Key).ToCommaList();

            if ((Current.ProgramState == ProgramState.Playing &&
                 pawn.IsDesignatedHero() && pawn.IsHeroOwner() ||
                 Prefs.DevMode) ||
                Current.ProgramState == ProgramState.Entry)

            {
                var quirksAll = Quirk.All
                                .OrderBy(quirk => quirk.Key)
                                .ToList();

                if (!RJWSettings.DevMode)
                {
                    quirksAll.Remove(Quirk.Breeder);
                    quirksAll.Remove(Quirk.Incubator);
                }

                if (xxx.is_insect(pawn))
                {
                    quirksAll.Add(Quirk.Incubator);
                }

                if (Widgets.ButtonText(row, "Quirks".Translate() + quirkString, false))
                {
                    var list = new List <FloatMenuOption>();
                    list.Add(new FloatMenuOption("Reset", (() => QuirkAdder.Clear(pawn)), MenuOptionPriority.Default));
                    foreach (Quirk quirk in quirksAll)
                    {
                        list.Add(new FloatMenuOption(quirk.Key, (() => QuirkAdder.Add(pawn, quirk))));
                        //TODO: fix quirk description box in 1.1 menus
                        //list.Add(new FloatMenuOption(quirk.Key, (() => QuirkAdder.Add(pawn, quirk)), MenuOptionPriority.Default, delegate
                        //{
                        //	TooltipHandler.TipRegion(row, quirk.LocaliztionKey.Translate(pawn.Named("pawn")));
                        //}
                        //));
                    }
                    Find.WindowStack.Add(new FloatMenu(list));
                }
            }
            else
            {
                // TODO: long quirk list support
                // This can be too long and line wrap.
                // Should probably be a vertical list like traits.
                Widgets.Label(row, "Quirks".Translate() + quirkString);
            }

            if (!Mouse.IsOver(row))
            {
                return;
            }

            Widgets.DrawHighlight(row);
            if (quirks.NullOrEmpty())
            {
                TooltipHandler.TipRegion(row, "NoQuirks".Translate());
            }
            else
            {
                StringBuilder stringBuilder = new StringBuilder();
                foreach (var q in quirks)
                {
                    stringBuilder.AppendLine(q.Key.Colorize(Color.yellow));
                    stringBuilder.AppendLine(q.LocaliztionKey.Translate(pawn.Named("pawn")).AdjustedFor(pawn).Resolve());
                    stringBuilder.AppendLine("");
                }
                string str = stringBuilder.ToString().TrimEndNewlines();
                TooltipHandler.TipRegion(row, str);
            }
        }