private void DoEnter(Caravan caravan, Site site)
        {
            LookTargets lookTargets    = new LookTargets(caravan.PawnsListForReading);
            bool        draftColonists = site.Faction == null || site.Faction.HostileTo(Faction.OfPlayer);
            bool        num            = !site.HasMap;
            Map         orGenerateMap  = GetOrGenerateMapUtility.GetOrGenerateMap(site.Tile, MapSize, null);

            if (num)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(orGenerateMap.mapPawns.AllPawns, "LetterRelatedPawnsSite".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, informEvenIfSeenBefore: true);
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("LetterCaravanEnteredMap".Translate(caravan.Label, site).CapitalizeFirst());
                AppendThreatInfo(stringBuilder, site, orGenerateMap, out var letterDef, out var allLookTargets);
                TaggedString letterText = null;
                SettlementUtility.AffectRelationsOnAttacked_NewTmp(site, ref letterText);
                if (!letterText.NullOrEmpty())
                {
                    if (stringBuilder.Length > 0)
                    {
                        stringBuilder.AppendLine();
                    }
                    stringBuilder.AppendLineTagged(letterText);
                }
                List <HediffDef> list = null;
                foreach (SitePart part in site.parts)
                {
                    if (part.def.arrivedLetterHediffHyperlinks.NullOrEmpty())
                    {
                        continue;
                    }
                    if (list == null)
                    {
                        list = new List <HediffDef>();
                    }
                    foreach (HediffDef arrivedLetterHediffHyperlink in part.def.arrivedLetterHediffHyperlinks)
                    {
                        if (!list.Contains(arrivedLetterHediffHyperlink))
                        {
                            list.Add(arrivedLetterHediffHyperlink);
                        }
                    }
                }
                ChoiceLetter choiceLetter = LetterMaker.MakeLetter("LetterLabelCaravanEnteredMap".Translate(site), stringBuilder.ToString(), letterDef ?? LetterDefOf.NeutralEvent, allLookTargets.IsValid() ? allLookTargets : lookTargets);
                choiceLetter.hyperlinkHediffDefs = list;
                Find.LetterStack.ReceiveLetter(choiceLetter);
            }
            else
            {
                Find.LetterStack.ReceiveLetter("LetterLabelCaravanEnteredMap".Translate(site), "LetterCaravanEnteredMap".Translate(caravan.Label, site).CapitalizeFirst(), LetterDefOf.NeutralEvent, lookTargets);
            }
            CaravanEnterMapUtility.Enter(caravan, orGenerateMap, CaravanEnterMode.Edge, CaravanDropInventoryMode.DoNotDrop, draftColonists);
        }
Ejemplo n.º 2
0
        public override void Arrived(List <ActiveDropPodInfo> pods, int tile)
        {
            Thing        lookTarget    = TransportPodsArrivalActionUtility.GetLookTarget(pods);
            bool         num           = !settlement.HasMap;
            Map          orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(settlement.Tile, null);
            TaggedString letterLabel   = "LetterLabelCaravanEnteredEnemyBase".Translate();
            TaggedString letterText    = "LetterTransportPodsLandedInEnemyBase".Translate(settlement.Label).CapitalizeFirst();

            SettlementUtility.AffectRelationsOnAttacked_NewTmp(settlement, ref letterText);
            if (num)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(orGenerateMap.mapPawns.AllPawns, ref letterLabel, ref letterText, "LetterRelatedPawnsInMapWherePlayerLanded".Translate(Faction.OfPlayer.def.pawnsPlural), informEvenIfSeenBefore: true);
            }
            Find.LetterStack.ReceiveLetter(letterLabel, letterText, LetterDefOf.NeutralEvent, lookTarget, settlement.Faction);
            arrivalMode.Worker.TravelingTransportPodsArrived(pods, orGenerateMap);
        }