Пример #1
0
        public static List <Pawn> GenerateAnimals(PawnKindDef animalKind, int tile, float points)
        {
            int         animalsCount = ManhunterPackIncidentUtility.GetAnimalsCount(animalKind, points);
            List <Pawn> list         = new List <Pawn>();

            for (int i = 0; i < animalsCount; i++)
            {
                PawnGenerationRequest request = new PawnGenerationRequest(animalKind, null, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, false, 1f, false, true, true, false, false, false, false, null, null, null, null, null, null, null, null);
                Pawn item = PawnGenerator.GeneratePawn(request);
                list.Add(item);
            }
            return(list);
        }
Пример #2
0
 private int GetAnimalsCount(SiteCoreOrPartParams parms)
 {
     return(ManhunterPackIncidentUtility.GetAnimalsCount(parms.animalKind, parms.threatPoints));
 }
Пример #3
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map         map        = (Map)parms.target;
            PawnKindDef animalKind = parms.pawnKind;

            if ((animalKind == null && !ManhunterPackIncidentUtility.TryFindManhunterAnimalKind(parms.points, map.Tile, out animalKind)) || ManhunterPackIncidentUtility.GetAnimalsCount(animalKind, parms.points) == 0)
            {
                return(false);
            }
            IntVec3 result = parms.spawnCenter;

            if (!result.IsValid && !RCellFinder.TryFindRandomPawnEntryCell(out result, map, CellFinder.EdgeRoadChance_Animal))
            {
                return(false);
            }
            List <Pawn> list = ManhunterPackIncidentUtility.GenerateAnimals_NewTmp(animalKind, map.Tile, parms.points * 1f, parms.pawnCount);
            Rot4        rot  = Rot4.FromAngleFlat((map.Center - result).AngleFlat);

            for (int i = 0; i < list.Count; i++)
            {
                Pawn    pawn = list[i];
                IntVec3 loc  = CellFinder.RandomClosewalkCellNear(result, map, 10);
                QuestUtility.AddQuestTag(GenSpawn.Spawn(pawn, loc, map, rot), parms.questTag);
                pawn.health.AddHediff(HediffDefOf.Scaria);
                pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent);
                pawn.mindState.exitMapAfterTick = Find.TickManager.TicksGame + Rand.Range(60000, 120000);
            }
            SendStandardLetter("LetterLabelManhunterPackArrived".Translate(), "ManhunterPackArrived".Translate(animalKind.GetLabelPlural()), LetterDefOf.ThreatBig, parms, list[0]);
            Find.TickManager.slower.SignalForceNormalSpeedShort();
            LessonAutoActivator.TeachOpportunity(ConceptDefOf.ForbiddingDoors, OpportunityType.Critical);
            LessonAutoActivator.TeachOpportunity(ConceptDefOf.AllowedAreas, OpportunityType.Important);
            return(true);
        }