Пример #1
0
        public static void Postfix(Map __instance)
        {
            Log.Message("WeatherChecker: " + __instance.ToString());
            bool comeFromOuterSource;
            var  tempComp = new WorldObjectComp_InfectedTile();

            tempComp.infectedTile = __instance.Tile;
            if (PurpleIvyUtils.getFogProgressWithOuterSources(0, tempComp, out comeFromOuterSource) > 0f &&
                !__instance.gameConditionManager.ConditionIsActive(PurpleIvyDefOf.PurpleFogGameCondition))
            {
                GameCondition_PurpleFog gameCondition =
                    (GameCondition_PurpleFog)GameConditionMaker.MakeConditionPermanent
                        (PurpleIvyDefOf.PurpleFogGameCondition);
                __instance.gameConditionManager.RegisterCondition(gameCondition);
                tempComp.parent = __instance.Parent;
                tempComp.StartInfection();
                tempComp.gameConditionCaused = PurpleIvyDefOf.PurpleFogGameCondition;
                tempComp.counter             = 0;
                tempComp.infected            = false;
                tempComp.infectedTile        = __instance.Tile;
                tempComp.radius = tempComp.GetRadius();
                PurpleIvyData.TotalFogProgress[tempComp] = PurpleIvyUtils.getFogProgress(tempComp.counter);
                tempComp.fillRadius();
                __instance.Parent.AllComps.Add(tempComp);
            }
        }
 public void AlienAmbush(Caravan caravan, WorldObjectComp_InfectedTile site)
 {
     LongEventHandler.QueueLongEvent(delegate()
     {
         IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow
                                           (IncidentCategoryDefOf.ThreatBig, caravan);
         List <Pawn> list = this.generateAliensFrom(site);
         Map map          = CaravanIncidentUtility.SetupCaravanAttackMap(caravan, list, false);
         Find.TickManager.CurTimeSpeed     = 0;
         GlobalTargetInfo globalTargetInfo = (!GenCollection.Any <Pawn>(list))
         ? GlobalTargetInfo.Invalid : new GlobalTargetInfo(list[0].Position, map, false);
         Find.LetterStack.ReceiveLetter("AlienAmbush".Translate(), "AlienAmbushDesc".Translate()
                                        , LetterDefOf.ThreatBig, globalTargetInfo, null, null, null, null);
     }, "GeneratingMapForNewEncounter", false, null, true);
 }
Пример #3
0
 public override float SkyTargetLerpFactor(Map map)
 {
     if (this.fogProgress.ContainsKey(map))
     {
         return(this.fogProgress[map]);
     }
     else
     {
         Log.Error("Something went wrong with the map " + map + ". It was not represented in " +
                   "the fogProgress dictionary.");
         bool temp;
         var  comp = map.Parent.GetComponent <WorldObjectComp_InfectedTile>();
         if (comp == null)
         {
             Log.Message("Adding new comp, due missing the one in the mapParent");
             comp = new WorldObjectComp_InfectedTile();
             int count = map.listerThings.ThingsOfDef(PurpleIvyDefOf.PurpleIvy).Count;
             count      += map.listerThings.ThingsOfDef(PurpleIvyDefOf.EggSac).Count;
             count      += map.listerThings.ThingsOfDef(PurpleIvyDefOf.EggSacBeta).Count;
             count      += map.listerThings.ThingsOfDef(PurpleIvyDefOf.EggSacGamma).Count;
             count      += map.listerThings.ThingsOfDef(PurpleIvyDefOf.EggSacNestGuard).Count;
             count      += map.listerThings.ThingsOfDef(PurpleIvyDefOf.ParasiteEgg).Count;
             count      += map.listerThings.ThingsOfDef(PurpleIvyDefOf.GasPump).Count;
             count      += map.listerThings.ThingsOfDef(PurpleIvyDefOf.GenTurretBase).Count;
             count      += map.listerThings.ThingsOfDef(PurpleIvyDefOf.Turret_GenMortarSeed).Count;
             count      += map.listerThings.ThingsOfDef(PurpleIvyDefOf.PI_Nest).Count;
             comp.parent = map.Parent;
             comp.StartInfection();
             comp.gameConditionCaused = PurpleIvyDefOf.PurpleFogGameCondition;
             comp.counter             = count;
             comp.infectedTile        = map.Tile;
             comp.radius = comp.GetRadius();
             PurpleIvyData.TotalFogProgress[comp] = PurpleIvyUtils.getFogProgress(comp.counter);
             comp.fillRadius();
             map.Parent.AllComps.Add(comp);
             PurpleIvyData.TotalFogProgress[comp] = PurpleIvyUtils.getFogProgress(count);
             this.fogProgress[map] = PurpleIvyUtils.getFogProgressWithOuterSources(count, comp, out temp);
         }
         else
         {
             this.fogProgress[map] = 0f;
             Log.Message("The fogProgress value is reset to 0");
         }
         return(this.fogProgress[map]);
     }
 }
        public List <Pawn> generateAliensFrom(WorldObjectComp_InfectedTile site)
        {
            List <Pawn> list = new List <Pawn>();
            int         AlphaParasitesCount = site.counter / 33;
            int         BetaParasitesCount  = site.counter / 22;
            int         GammaParasitesCount = site.counter / 22;
            int         OmegaParasitesCount = site.counter / 11;

            AlphaParasitesCount = (AlphaParasitesCount / 10) - (site.AlienPowerSpent / 33);
            BetaParasitesCount  = (BetaParasitesCount / 10) - (site.AlienPowerSpent / 33);
            GammaParasitesCount = (GammaParasitesCount / 10) - (site.AlienPowerSpent / 33);
            OmegaParasitesCount = (OmegaParasitesCount / 10) - (site.AlienPowerSpent / 33);

            Log.Message("counter: " + site.counter.ToString()
                        + " AlphaParasitesCount " + AlphaParasitesCount.ToString()
                        + " BetaParasitesCount " + BetaParasitesCount.ToString()
                        + " GammaParasitesCount " + GammaParasitesCount.ToString()
                        + " OmegaParasitesCount " + OmegaParasitesCount.ToString());

            foreach (var i in Enumerable.Range(1, AlphaParasitesCount))
            {
                Pawn NewPawn = PurpleIvyUtils.GenerateParasite(PurpleIvyData.Genny_ParasiteAlpha);
                list.Add(NewPawn);
            }
            foreach (var i in Enumerable.Range(1, BetaParasitesCount))
            {
                Pawn NewPawn = PurpleIvyUtils.GenerateParasite(PurpleIvyData.Genny_ParasiteBeta);
                list.Add(NewPawn);
            }

            foreach (var i in Enumerable.Range(1, GammaParasitesCount))
            {
                Pawn NewPawn = PurpleIvyUtils.GenerateParasite(PurpleIvyData.Genny_ParasiteGamma);
                list.Add(NewPawn);
            }
            foreach (var i in Enumerable.Range(1, OmegaParasitesCount))
            {
                Pawn NewPawn = PurpleIvyUtils.GenerateParasite(PurpleIvyData.Genny_ParasiteOmega);
                list.Add(NewPawn);
            }
            site.AlienPowerSpent = AlphaParasitesCount + BetaParasitesCount
                                   + GammaParasitesCount + OmegaParasitesCount;
            return(list);
        }
        public void AlienRaid(Map map, WorldObjectComp_InfectedTile site)
        {
            IncidentParms incidentParms = StorytellerUtility.DefaultParmsNow
                                              (IncidentCategoryDefOf.ThreatBig, map);

            Log.Message("ALIEN RAID: map tile - " + map.Tile + " - infected site tile: " + site.infectedTile);
            List <Pawn> list = this.generateAliensFrom(site);

            Log.Message((map != null).ToString());
            incidentParms.target = map;
            Dictionary <Pawn, int> pawnList = new Dictionary <Pawn, int>();

            foreach (Pawn alien in list)
            {
                pawnList[alien] = 0;
            }
            incidentParms.pawnGroups = pawnList;
            Find.Storyteller.incidentQueue.Add(PurpleIvyDefOf.PI_AlienRaid, Find.TickManager.TicksGame, incidentParms, 0);
        }
Пример #6
0
        public static float getFogProgressWithOuterSources(int count, WorldObjectComp_InfectedTile comp, out bool comeFromOuterSource)
        {
            var result = PurpleIvyUtils.getFogProgress(count);
            //Log.Message("fog progress: " + result.ToString());
            var outerSource = 0f;

            foreach (var data in PurpleIvyData.TotalFogProgress.Where(data => data.Key != comp))
            {
                int distance = Find.WorldGrid.TraversalDistanceBetween(comp.infectedTile, data.Key.infectedTile, true, int.MaxValue);
                if (distance <= data.Key.radius)
                {
                    float floatRadius = ((float)data.Key.counter - 500f) / 100f;
                    if (floatRadius < 0)
                    {
                        floatRadius = 0;
                    }
                    float newValue = GetPartFromPercentage(GetPercentageFromPartWhole(floatRadius, distance) / 100f, data.Value);
                    if (newValue > data.Value)
                    {
                        outerSource += data.Value;
                    }
                    else
                    {
                        outerSource += newValue;
                    }
                }
            }
            if (outerSource < 0f)
            {
                outerSource = 0f;
            }
            if (result == 0f && outerSource > 0f)
            {
                comeFromOuterSource = true;
            }
            else
            {
                comeFromOuterSource = false;
            }
            return(result + outerSource);
        }
        public override void GameComponentTick()
        {
            base.GameComponentTick();
            bool temp;

            if (PurpleIvyData.BiomesDirty == true)
            {
                PurpleIvyUtils.UpdateBiomes();
            }
            if (Find.TickManager.TicksGame % 3451 == 0) // same as for toxic weather
            {
                bool raidHappened = false;
                var  tempComp     = new WorldObjectComp_InfectedTile();
                Log.Message("Total polluted biomes to check: " + PurpleIvyData.TotalPollutedBiomes.Count);
                foreach (var tile in PurpleIvyData.TotalPollutedBiomes)
                {
                    var worldObjects = Find.WorldObjects.ObjectsAt(tile);
                    foreach (var worldObject in worldObjects)
                    {
                        if (worldObject is Caravan caravan)
                        {
                            tempComp.infectedTile = caravan.Tile;
                            float fogProgress = PurpleIvyUtils.getFogProgressWithOuterSources(0, tempComp, out temp);
                            if (fogProgress > 0f)
                            {
                                foreach (Pawn p in caravan.pawns)
                                {
                                    if (p.Faction != PurpleIvyData.AlienFaction && p.RaceProps.IsFlesh)
                                    {
                                        float num = fogProgress / 20; //TODO: balance it
                                        num *= p.GetStatValue(StatDefOf.ToxicSensitivity, true);
                                        if (num != 0f)
                                        {
                                            HealthUtility.AdjustSeverity(p, HediffDefOf.ToxicBuildup, num);
                                        }
                                    }
                                }
                            }
                            if (raidHappened != true)
                            {
                                var infectedSites = getInfectedTilesNearby(worldObject.Tile);
                                if (infectedSites != null && infectedSites.Count > 0)
                                {
                                    if (fogProgress > 0.7f)
                                    {
                                        fogProgress = 0.7f;
                                    }
                                    int           raidChance = (int)(fogProgress * 100);
                                    System.Random random     = new System.Random(caravan.Tile);
                                    Log.Message("An attempt to ambush caravan, raid chance: " + raidChance.ToString()
                                                + " - fogProgress: " + fogProgress.ToString());
                                    if (raidChance >= random.Next(1, 100))
                                    {
                                        Log.Message("The caravan has been ambushed! RaidChance: " + raidChance.ToString()
                                                    + " - fogProgress: " + fogProgress.ToString());
                                        this.AlienAmbush(caravan, infectedSites.RandomElement());
                                        raidHappened = true;
                                    }
                                }
                            }
                        }
                        else if (worldObject is MapParent mapParent)
                        {
                            tempComp.infectedTile = mapParent.Tile;
                            float?fogProgress = null;
                            if (raidHappened != true && mapParent.Map != null)
                            {
                                var infectedSites = getInfectedTilesNearby(mapParent.Tile);
                                if (infectedSites != null && infectedSites.Count > 0)
                                {
                                    fogProgress = PurpleIvyUtils.getFogProgressWithOuterSources(0, tempComp, out temp);
                                    int           raidChance   = (int)(fogProgress * 100) / 10;
                                    System.Random random       = new System.Random();
                                    int           randomChance = random.Next(1, 100);
                                    Log.Message("An attempt to raid map, raid chance: " + raidChance.ToString()
                                                + " - randomChance: " + randomChance.ToString()
                                                + " - fogProgress: " + fogProgress.ToString());
                                    if (raidChance >= randomChance)
                                    {
                                        Log.Message("Alien Raid! RaidChance: " + raidChance.ToString()
                                                    + " - fogProgress: " + fogProgress.ToString() + " map: " + mapParent.Map.ToString());
                                        this.AlienRaid(mapParent.Map, infectedSites.RandomElement());
                                        raidHappened = true;
                                    }
                                }
                            }
                            if (mapParent.Faction != Faction.OfPlayer && mapParent.Faction != PurpleIvyData.AlienFaction)
                            {
                                if (!fogProgress.HasValue)
                                {
                                    fogProgress = PurpleIvyUtils.getFogProgressWithOuterSources(0, tempComp, out temp);
                                }
                                if (fogProgress > 0f)
                                {
                                    int           abandonChance = (int)(fogProgress * 100) / 10;
                                    System.Random random        = new System.Random(Find.TickManager.TicksGame);
                                    Log.Message(mapParent.Faction.ToString());
                                    Log.Message("An attempt to abandon NPC base, abandon chance: " + abandonChance.ToString()
                                                + " - fogProgress: " + fogProgress.ToString());
                                    if (abandonChance >= random.Next(1, 100))
                                    {
                                        Log.Message("NPC base abandoned! Chance: " + abandonChance.ToString()
                                                    + " - fogProgress: " + fogProgress.ToString() + " base: " + mapParent.ToString());
                                        Site site = (Site)WorldObjectMaker.MakeWorldObject(PurpleIvyDefOf.PI_AbandonedBase);
                                        site.Tile = mapParent.Tile;
                                        site.SetFaction(mapParent.Faction);
                                        mapParent.Destroy();
                                        Find.LetterStack.ReceiveLetter("AbandonedBase".Translate(),
                                                                       "AbandonedBaseDesc".Translate(), LetterDefOf.NeutralEvent,
                                                                       site, mapParent.Faction, null, null, null);
                                    }
                                    else
                                    {
                                        int defeatChance = (int)(fogProgress * 100) / 10;
                                        random = new System.Random(Find.TickManager.TicksGame + mapParent.Tile);
                                        Log.Message(mapParent.Faction.ToString());
                                        Log.Message("An attempt to defeat NPC base, defeat chance: " + abandonChance.ToString()
                                                    + " - fogProgress: " + fogProgress.ToString());
                                        if (defeatChance >= random.Next(1, 100))
                                        {
                                            Log.Message("NPC base defeated! Chance: " + defeatChance.ToString()
                                                        + " - fogProgress: " + fogProgress.ToString() + " base: " + mapParent.ToString());
                                            Site site = (Site)WorldObjectMaker.MakeWorldObject(PurpleIvyDefOf.PI_DefeatedBase);
                                            site.Tile = mapParent.Tile;
                                            site.SetFaction(mapParent.Faction);
                                            mapParent.Destroy();
                                            Find.LetterStack.ReceiveLetter("DefeatedBase".Translate(),
                                                                           "DefeatedBaseDesc".Translate(), LetterDefOf.NegativeEvent,
                                                                           site, mapParent.Faction, null, null, null);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #8
0
        public override void MapComponentTick()
        {
            base.MapComponentTick();
            if (Find.TickManager.TicksGame % 250 == 0)
            {
                var plants = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.PurpleIvy);
                //Log.Message("Checking orbital strike, " + this.OrbitalHelpActive + " - " + plants.Count);
                if (plants != null && ((this.OrbitalHelpActive == true && plants.Count > 0) ||
                                       plants.Count > 2000)) // && Rand.Chance(PurpleIvyData.getFogProgress(plants.Count)))
                {
                    if (this.OrbitalHelpActive == false)
                    {
                        this.OrbitalHelpActive = true;
                        Find.LetterStack.ReceiveLetter("OrbitalHelpFromAncients".Translate(),
                                                       "OrbitalHelpFromAncientsDesc".Translate(),
                                                       LetterDefOf.NeutralEvent, new TargetInfo(plants.RandomElement().Position, map, false));
                    }
                    PowerBeam powerBeam = (PowerBeam)GenSpawn.Spawn(PurpleIvyDefOf.PI_PowerBeam,
                                                                    plants.RandomElement().Position, this.map, 0);
                    powerBeam.duration   = 200;
                    powerBeam.instigator = null;
                    powerBeam.weaponDef  = null;
                    powerBeam.StartStrike();
                }
                if ((plants.Count <= 0 || plants == null) && this.OrbitalHelpActive == true)
                {
                    Log.Message("Orbital help");
                    this.OrbitalHelpActive = false;
                    List <Pawn> list = new List <Pawn>();

                    var alpha = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.Genny_ParasiteAlpha);
                    var beta  = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.Genny_ParasiteBeta);
                    var gamma = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.Genny_ParasiteGamma);
                    var omega = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.Genny_ParasiteOmega);
                    var guard = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.Genny_ParasiteNestGuard);

                    int pawnCount = alpha.Count;
                    pawnCount += beta.Count;
                    pawnCount += gamma.Count;
                    pawnCount += omega.Count;
                    pawnCount += guard.Count;
                    Predicate <IntVec3> predicate = delegate(IntVec3 c)
                    {
                        return(!GridsUtility.Fogged(c, map) &&
                               !GridsUtility.Roofed(c, map) &&
                               GenGrid.InBounds(c, map) &&
                               GenRadial.RadialCellsAround(c, 10, true).Where(x =>
                                                                              map.thingGrid.ThingsListAt(x).Where(y => y.Faction == PurpleIvyData.AlienFaction)
                                                                              != null) != null);
                    };
                    IntVec3 position = CellFinder.RandomClosewalkCellNear(this.map.Center, this.map, 500,
                                                                          predicate);
                    foreach (var num in Enumerable.Range(1, pawnCount / 2))
                    {
                        Faction faction = FactionUtility.DefaultFactionFrom(PurpleIvyDefOf.KorsolianFaction);
                        Pawn    NewPawn = PawnGenerator.GeneratePawn(PurpleIvyDefOf.KorsolianSoldier, faction);
                        if (faction != null && faction != Faction.OfPlayer)
                        {
                            Lord lord = null;
                            if (this.map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) =>
                                                                                     p != NewPawn))
                            {
                                lord = ((Pawn)GenClosest.ClosestThing_Global(NewPawn.Position,
                                                                             this.map.mapPawns.SpawnedPawnsInFaction(faction), 99999f,
                                                                             (Thing p) => p != NewPawn && ((Pawn)p).GetLord() != null, null)).GetLord();
                            }
                            if (lord == null)
                            {
                                var lordJob = new LordJob_AssistColony(Faction.OfPlayer, position);
                                //LordJob_DefendPoint lordJob = new LordJob_DefendPoint(position);
                                lord = LordMaker.MakeNewLord(faction, lordJob, this.map, null);
                            }
                            lord.AddPawn(NewPawn);
                        }
                        Log.Message(NewPawn?.Faction?.def?.defName);
                        list.Add(NewPawn);
                    }
                    DropPodUtility.DropThingsNear(position, this.map, list, 30, false, true, true, true);
                    Find.LetterStack.ReceiveLetter("AncientsLandOnTheGround".Translate(),
                                                   "AncientsLandOnTheGroundDesc".Translate(),
                                                   LetterDefOf.NeutralEvent, new TargetInfo(position, map, false));
                }
                //Log.Message("Alpha limit: " + PurpleIvySettings.TotalAlienLimit[PurpleIvyDefOf.Genny_ParasiteAlpha.defName]);
                //Log.Message("Beta limit: " + PurpleIvySettings.TotalAlienLimit[PurpleIvyDefOf.Genny_ParasiteBeta.defName]);
                //Log.Message("Gamma limit: " + PurpleIvySettings.TotalAlienLimit[PurpleIvyDefOf.Genny_ParasiteGamma.defName]);
                //Log.Message("Omega limit: " + PurpleIvySettings.TotalAlienLimit[PurpleIvyDefOf.Genny_ParasiteOmega.defName]);
                int  count = plants.Count;
                bool comeFromOuterSource;
                var  tempComp = new WorldObjectComp_InfectedTile();
                tempComp.infectedTile = map.Tile;
                if (PurpleIvyUtils.getFogProgressWithOuterSources(count, tempComp, out comeFromOuterSource) > 0f &&
                    !map.gameConditionManager.ConditionIsActive(PurpleIvyDefOf.PurpleFogGameCondition))
                {
                    GameCondition_PurpleFog gameCondition =
                        (GameCondition_PurpleFog)GameConditionMaker.MakeConditionPermanent
                            (PurpleIvyDefOf.PurpleFogGameCondition);
                    map.gameConditionManager.RegisterCondition(gameCondition);
                    if (comeFromOuterSource == false)
                    {
                        Find.LetterStack.ReceiveLetter(gameCondition.LabelCap,
                                                       gameCondition.LetterText, gameCondition.def.letterDef,
                                                       new TargetInfo(map.Center, map, false));
                    }
                    else
                    {
                        Find.LetterStack.ReceiveLetter("PurpleFogСomesFromInfectedSites".Translate(),
                                                       "PurpleFogСomesFromInfectedSitesDesc".Translate(),
                                                       LetterDefOf.ThreatBig, new TargetInfo(map.Center, map, false));
                        Log.Message("PurpleFogСomesFromInfectedSites: " + map.ToString()
                                    + " - " + Find.TickManager.TicksGame.ToString());
                    }
                    if (map.Parent.GetComponent <WorldObjectComp_InfectedTile>() == null)
                    {
                        var comp = new WorldObjectComp_InfectedTile();
                        comp.parent = map.Parent;
                        comp.StartInfection();
                        comp.gameConditionCaused = PurpleIvyDefOf.PurpleFogGameCondition;
                        comp.counter             = count;
                        comp.infectedTile        = map.Tile;
                        comp.radius = comp.GetRadius();
                        PurpleIvyData.TotalFogProgress[comp] = PurpleIvyUtils.getFogProgress(comp.counter);
                        comp.fillRadius();
                        map.Parent.AllComps.Add(comp);
                        Log.Message("Adding comp to: " + map.Parent.ToString());
                    }
                }
            }
            if (Find.TickManager.TicksGame % 60000 == 0)
            {
                int count     = 0;
                var alphaEggs = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.EggSac);
                var betaEggs  = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.EggSacBeta);
                var gammaEggs = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.EggSacGamma);
                var nestsEggs = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.EggSacNestGuard);
                var omegaEggs = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.ParasiteEgg);

                Log.Message("Total PurpleIvy count on the map: " +
                            this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.PurpleIvy).Count.ToString(), true);

                count = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.Genny_ParasiteAlpha).Count;
                if (count > PurpleIvySettings.TotalAlienLimit[PurpleIvyDefOf.Genny_ParasiteAlpha.defName])
                {
                    foreach (var egg in alphaEggs)
                    {
                        var eggSac = (Building_EggSac)egg;
                        eggSac.TryGetComp <AlienInfection>().stopSpawning = true;
                    }
                }
                else
                {
                    foreach (var egg in alphaEggs)
                    {
                        var eggSac = (Building_EggSac)egg;
                        eggSac.TryGetComp <AlienInfection>().stopSpawning = false;
                    }
                }
                Log.Message("Total Genny_ParasiteAlpha count on the map: " + count.ToString(), true);
                count = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.Genny_ParasiteBeta).Count;
                if (count > PurpleIvySettings.TotalAlienLimit[PurpleIvyDefOf.Genny_ParasiteBeta.defName])
                {
                    foreach (var egg in betaEggs)
                    {
                        var eggSac = (Building_EggSac)egg;
                        eggSac.TryGetComp <AlienInfection>().stopSpawning = true;
                    }
                }
                else
                {
                    foreach (var egg in betaEggs)
                    {
                        var eggSac = (Building_EggSac)egg;
                        eggSac.TryGetComp <AlienInfection>().stopSpawning = false;
                    }
                }
                Log.Message("Total Genny_ParasiteBeta count on the map: " + count.ToString(), true);
                count = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.Genny_ParasiteGamma).Count;
                if (count > PurpleIvySettings.TotalAlienLimit[PurpleIvyDefOf.Genny_ParasiteGamma.defName])
                {
                    foreach (var egg in gammaEggs)
                    {
                        var eggSac = (Building_EggSac)egg;
                        eggSac.TryGetComp <AlienInfection>().stopSpawning = true;
                    }
                }
                else
                {
                    foreach (var egg in gammaEggs)
                    {
                        var eggSac = (Building_EggSac)egg;
                        eggSac.TryGetComp <AlienInfection>().stopSpawning = false;
                    }
                }
                Log.Message("Total Genny_ParasiteGamma count on the map: " + count.ToString(), true);
                count = this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.Genny_ParasiteOmega).Count;
                if (count > PurpleIvySettings.TotalAlienLimit[PurpleIvyDefOf.Genny_ParasiteOmega.defName])
                {
                    foreach (var egg in omegaEggs)
                    {
                        var eggSac = (Building_EggSac)egg;
                        eggSac.TryGetComp <AlienInfection>().stopSpawning = true;
                    }
                }
                else
                {
                    foreach (var egg in omegaEggs)
                    {
                        var eggSac = (Building_EggSac)egg;
                        eggSac.TryGetComp <AlienInfection>().stopSpawning = false;
                    }
                }
                Log.Message("Total Genny_ParasiteOmega count on the map: " + count.ToString(), true);
                Log.Message("Total Genny_ParasiteNestGuard count on the map: " +
                            this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.Genny_ParasiteNestGuard).Count.ToString(), true);
                Log.Message("Total EggSac count on the map: " + alphaEggs.Count.ToString(), true);
                Log.Message("Total EggSac beta count on the map: " + betaEggs.Count.ToString(), true);
                Log.Message("Total EggSac gamma count on the map: " + gammaEggs.Count.ToString(), true);
                Log.Message("Total EggSac NestGuard count on the map: " + nestsEggs.Count.ToString(), true);
                Log.Message("Total ParasiteEgg count on the map: " + omegaEggs.Count.ToString(), true);
                Log.Message("Total GasPump count on the map: " +
                            this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.GasPump).Count.ToString(), true);
                Log.Message("Total GenTurretBase count on the map: " +
                            this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.GenTurretBase).Count.ToString(), true);
                Log.Message("Total Turret_GenMortarSeed count on the map: " +
                            this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.Turret_GenMortarSeed).Count.ToString(), true);
                Log.Message("Total Nest count on the map: " +
                            this.map.listerThings.ThingsOfDef(PurpleIvyDefOf.PI_Nest).Count.ToString(), true);
            }
        }