예제 #1
0
 public void FactionTick()
 {
     this.CheckNaturalTendencyToReachGoodwillThreshold();
     this.kidnapped.KidnappedPawnsTrackerTick();
     for (int i = this.predatorThreats.Count - 1; i >= 0; i--)
     {
         PredatorThreat predatorThreat = this.predatorThreats[i];
         if (predatorThreat.Expired)
         {
             this.predatorThreats.RemoveAt(i);
             if (predatorThreat.predator.Spawned)
             {
                 predatorThreat.predator.Map.attackTargetsCache.UpdateTarget(predatorThreat.predator);
             }
         }
     }
     if (Find.TickManager.TicksGame % 1000 == 200 && this.IsPlayer)
     {
         if (NamePlayerFactionAndSettlementUtility.CanNameFactionNow())
         {
             List <Settlement> settlements = Find.WorldObjects.Settlements;
             if (Faction.< > f__mg$cache0 == null)
             {
                 Faction.< > f__mg$cache0 = new Predicate <Settlement>(NamePlayerFactionAndSettlementUtility.CanNameSettlementSoon);
             }
             Settlement settlement = settlements.Find(Faction.< > f__mg$cache0);
             if (settlement != null)
             {
                 Find.WindowStack.Add(new Dialog_NamePlayerFactionAndSettlement(settlement));
             }
             else
             {
                 Find.WindowStack.Add(new Dialog_NamePlayerFaction());
             }
         }
         else
         {
             List <Settlement> settlements2 = Find.WorldObjects.Settlements;
             if (Faction.< > f__mg$cache1 == null)
             {
                 Faction.< > f__mg$cache1 = new Predicate <Settlement>(NamePlayerFactionAndSettlementUtility.CanNameSettlementNow);
             }
             Settlement settlement2 = settlements2.Find(Faction.< > f__mg$cache1);
             if (settlement2 != null)
             {
                 if (NamePlayerFactionAndSettlementUtility.CanNameFactionSoon())
                 {
                     Find.WindowStack.Add(new Dialog_NamePlayerFactionAndSettlement(settlement2));
                 }
                 else
                 {
                     Find.WindowStack.Add(new Dialog_NamePlayerSettlement(settlement2));
                 }
             }
         }
     }
 }
예제 #2
0
        public void FactionTick()
        {
            CheckNaturalTendencyToReachGoodwillThreshold();
            kidnapped.KidnappedPawnsTrackerTick();
            for (int num = predatorThreats.Count - 1; num >= 0; num--)
            {
                PredatorThreat predatorThreat = predatorThreats[num];
                if (predatorThreat.Expired)
                {
                    predatorThreats.RemoveAt(num);
                    if (predatorThreat.predator.Spawned)
                    {
                        predatorThreat.predator.Map.attackTargetsCache.UpdateTarget(predatorThreat.predator);
                    }
                }
            }
            if (Find.TickManager.TicksGame % 1000 != 200 || !IsPlayer)
            {
                return;
            }
            if (NamePlayerFactionAndSettlementUtility.CanNameFactionNow())
            {
                Settlement settlement = Find.WorldObjects.Settlements.Find((Settlement x) => NamePlayerFactionAndSettlementUtility.CanNameSettlementSoon(x));
                if (settlement != null)
                {
                    Find.WindowStack.Add(new Dialog_NamePlayerFactionAndSettlement(settlement));
                }
                else
                {
                    Find.WindowStack.Add(new Dialog_NamePlayerFaction());
                }
                return;
            }
            Settlement settlement2 = Find.WorldObjects.Settlements.Find((Settlement x) => NamePlayerFactionAndSettlementUtility.CanNameSettlementNow(x));

            if (settlement2 != null)
            {
                if (NamePlayerFactionAndSettlementUtility.CanNameFactionSoon())
                {
                    Find.WindowStack.Add(new Dialog_NamePlayerFactionAndSettlement(settlement2));
                }
                else
                {
                    Find.WindowStack.Add(new Dialog_NamePlayerSettlement(settlement2));
                }
            }
        }
 private static bool CanNameSettlement(Settlement factionBase, int ticksPassed)
 {
     return(factionBase.Faction == Faction.OfPlayer && !factionBase.namedByPlayer && (float)ticksPassed / 60000f >= 3f && factionBase.HasMap && factionBase.Map.dangerWatcher.DangerRating != StoryDanger.High && factionBase.Map.mapPawns.FreeColonistsSpawnedCount != 0 && NamePlayerFactionAndSettlementUtility.CanNameAnythingNow());
 }
 private static bool CanNameFaction(int ticksPassed)
 {
     return(!Faction.OfPlayer.HasName && (float)ticksPassed / 60000f >= 3f && NamePlayerFactionAndSettlementUtility.CanNameAnythingNow());
 }
 public static bool CanNameSettlementSoon(Settlement factionBase)
 {
     return(NamePlayerFactionAndSettlementUtility.CanNameSettlement(factionBase, Find.TickManager.TicksGame - factionBase.creationGameTicks + 30000));
 }
 public static bool CanNameFactionSoon()
 {
     return(NamePlayerFactionAndSettlementUtility.CanNameFaction(Find.TickManager.TicksGame + 30000));
 }