// Token: 0x06001042 RID: 4162 RVA: 0x0007BEDC File Offset: 0x0007A2DC
        public override void Generate(Map map, GenStepParams parms)
        {
            List <Pawn> list = new List <Pawn>();

            foreach (Pawn pawn in map.mapPawns.AllPawns)
            {
                if (!pawn.NonHumanlikeOrWildMan())
                {
                    list.Add(pawn);
                }
            }
            foreach (Pawn pawn in list)
            {
                //pawn.Kill(new DamageInfo(DamageDefOf.Bite, 7000));
                Thing zombie = GenSpawn.Spawn(ZombiefiedMod.GenerateZombieFromSource(pawn), pawn.Position, map, pawn.Rotation);
                pawn.Destroy();
                //ZombiefiedMod.ReanimateDeath(pawn.Corpse);
            }
        }
示例#2
0
        // Token: 0x06000D17 RID: 3351 RVA: 0x00061114 File Offset: 0x0005F514
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map map = (Map)parms.target;

            ResolveRaidPoints(parms);

            if (!TryResolveRaidFaction(parms))
            {
                return(false);
            }

            IntVec3 intVec;

            if (!RCellFinder.TryFindRandomPawnEntryCell(out intVec, map, CellFinder.EdgeRoadChance_Animal))
            {
                return(false);
            }

            PawnGroupKindDef    combat = PawnGroupKindDefOf.Combat;
            PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(combat, parms, false);

            List <Pawn> list = PawnGroupMakerUtility.GeneratePawns(defaultPawnGroupMakerParms, true).ToList <Pawn>();

            if (list.Count < 1)
            {
                Log.Error("Got no pawns spawning raid from parms " + parms, false);
                return(false);
            }
            else
            {
                for (int i = 0; i < list.Count; i++)
                {
                    Pawn pawn = list[i];
                    list[i] = ZombiefiedMod.GenerateZombieFromSource(list[i]);
                    pawn.Destroy(DestroyMode.Vanish);
                }
            }

            Rot4 rot = Rot4.FromAngleFlat((map.Center - intVec).AngleFlat);

            Faction zFaction = Faction.OfInsects;

            foreach (Faction faction in Find.FactionManager.AllFactionsListForReading)
            {
                if (faction.def.defName == "Zombie")
                {
                    zFaction = faction;
                }
            }

            for (int i = 0; i < list.Count; i++)
            {
                Pawn    pawn = list[i];
                IntVec3 loc  = CellFinder.RandomClosewalkCellNear(intVec, map, 10, null);
                pawn.SetFactionDirect(zFaction);
                pawn.apparel.DestroyAll();
                Pawn_Zombiefied zomb = (Pawn_Zombiefied)GenSpawn.Spawn(pawn, loc, map, rot);
                if (zomb != null)
                {
                    zomb.FixZombie();
                }
            }

            if (ZombiefiedMod.zombieRaidNotifications)
            {
                Find.LetterStack.ReceiveLetter("Zombies", "Some zombies walked into your territory. You might want to deal with them before they deal with you."
                                               , LetterDefOf.NeutralEvent, list[0], null);
                Find.TickManager.slower.SignalForceNormalSpeedShort();
            }
            LessonAutoActivator.TeachOpportunity(ConceptDefOf.ForbiddingDoors, OpportunityType.Critical);
            LessonAutoActivator.TeachOpportunity(ConceptDefOf.AllowedAreas, OpportunityType.Important);
            return(true);
        }