Example #1
0
        private void SetVars(Slate slate)
        {
            if (pawn.GetValue(slate) == null || otherPawns.GetValue(slate) == null)
            {
                return;
            }
            tmpRelations.Clear();
            int num = 0;

            foreach (Pawn item in otherPawns.GetValue(slate))
            {
                PawnRelationDef mostImportantRelation = pawn.GetValue(slate).GetMostImportantRelation(item);
                if (mostImportantRelation != null)
                {
                    tmpRelations.Add(mostImportantRelation.GetGenderSpecificLabel(item));
                }
                else
                {
                    num++;
                }
            }
            if (num == 1)
            {
                tmpRelations.Add(nonRelatedLabel.GetValue(slate));
            }
            else if (num >= 2)
            {
                tmpRelations.Add(num + " " + nonRelatedLabelPlural.GetValue(slate));
            }
            if (tmpRelations.Any())
            {
                slate.Set(storeAs.GetValue(slate), tmpRelations.ToCommaList(useAnd: true));
                tmpRelations.Clear();
            }
        }
 private static FloatMenuOption MakeOpt(string key, Pawn pawn, PawnRelationDef rel, Building_CommsConsole console, Action action)
 {
     return(new FloatMenuOption(
                key.Translate(
                    pawn.Named("PAWN"),
                    rel.GetGenderSpecificLabel(pawn).CapitalizeFirst().Named("REL"),
                    pawn.Faction == null ? "LongDistance.Neutral".Translate().Named("FACTION") : pawn.Faction.Name.Named("FACTION")
                    ),
                action,
                pawn.Faction?.def.FactionIcon,
                pawn.Faction == null ? Color.white : pawn.Faction.Color
                ));
 }
Example #3
0
        public override void Notify_GeneratedByQuestGen(SitePart part, Slate slate, List <Rule> outExtraDescriptionRules, Dictionary <string, string> outExtraDescriptionConstants)
        {
            // Duplicate code so modularize in Util
            Util.SitePartWorker_Base_Notify_GeneratedByQuestGen(part, outExtraDescriptionRules, outExtraDescriptionConstants);

            // Replaces DownedRefugeeQuestUtility.GenerateRefugee
            Pawn pawn = GameComponent.GetRandomAllyForSpawning();

            Util.DressPawnIfCold(pawn, part.site.Tile);

            HealthUtility.DamageUntilDowned(pawn, false);
            HealthUtility.DamageLegsUntilIncapableOfMoving(pawn, false);

            part.things = new ThingOwner <Pawn>(part, true, LookMode.Deep);
            part.things.TryAdd(pawn, true);
            if (pawn.relations != null)
            {
                pawn.relations.everSeenByPlayer = true;
            }
            Pawn mostImportantColonyRelative = PawnRelationUtility.GetMostImportantColonyRelative(pawn);

            if (mostImportantColonyRelative != null)
            {
                PawnRelationDef mostImportantRelation = mostImportantColonyRelative.GetMostImportantRelation(pawn);
                TaggedString    taggedString          = "";
                if (mostImportantRelation != null && mostImportantRelation.opinionOffset > 0)
                {
                    pawn.relations.relativeInvolvedInRescueQuest = mostImportantColonyRelative;
                    taggedString = "\n\n" + "RelatedPawnInvolvedInQuest".Translate(mostImportantColonyRelative.LabelShort, mostImportantRelation.GetGenderSpecificLabel(pawn), mostImportantColonyRelative.Named("RELATIVE"), pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN", true);
                }
                else
                {
                    PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref taggedString, pawn);
                }
                outExtraDescriptionRules.Add(new Rule_String("pawnInvolvedInQuestInfo", taggedString));
            }
            outExtraDescriptionRules.AddRange(GrammarUtility.RulesForPawn("refugee", pawn, outExtraDescriptionConstants, true, true));
        }
        public override void Notify_GeneratedByQuestGen(SitePart part, Slate slate, List <Rule> outExtraDescriptionRules, Dictionary <string, string> outExtraDescriptionConstants)
        {
            base.Notify_GeneratedByQuestGen(part, slate, outExtraDescriptionRules, outExtraDescriptionConstants);
            Pawn pawn = DownedRefugeeQuestUtility.GenerateRefugee(part.site.Tile);

            part.things = new ThingOwner <Pawn>(part, oneStackOnly: true);
            part.things.TryAdd(pawn);
            if (pawn.relations != null)
            {
                pawn.relations.everSeenByPlayer = true;
            }
            Pawn mostImportantColonyRelative = PawnRelationUtility.GetMostImportantColonyRelative(pawn);

            if (mostImportantColonyRelative != null)
            {
                PawnRelationDef mostImportantRelation = mostImportantColonyRelative.GetMostImportantRelation(pawn);
                TaggedString    text = "";
                if (mostImportantRelation != null && mostImportantRelation.opinionOffset > 0)
                {
                    pawn.relations.relativeInvolvedInRescueQuest = mostImportantColonyRelative;
                    text = "\n\n" + "RelatedPawnInvolvedInQuest".Translate(mostImportantColonyRelative.LabelShort, mostImportantRelation.GetGenderSpecificLabel(pawn), mostImportantColonyRelative.Named("RELATIVE"), pawn.Named("PAWN")).AdjustedFor(pawn);
                }
                else
                {
                    PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, pawn);
                }
                outExtraDescriptionRules.Add(new Rule_String("pawnInvolvedInQuestInfo", text));
            }
            slate.Set("refugee", pawn);
        }