Exemplo n.º 1
0
        static bool Prefix(ref ThingSetMaker_RefugeePod __instance, ThingSetMakerParams parms, List <Thing> outThings)
        {
            Faction faction = DownedRefugeeQuestUtility.GetRandomFactionForRefugee();


            if (faction == FactionColonies.getPlayerColonyFaction())
            {
                List <PawnKindDef> list = new List <PawnKindDef>();
                foreach (ThingDef def in Find.World.GetComponent <FactionFC>().raceFilter.AllowedThingDefs)
                {
                    list.Add(def.race.AnyPawnKind);
                }


                Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, DownedRefugeeQuestUtility.GetRandomFactionForRefugee(), PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 20f, false, true, true, true, false, false, false, false, 0f, null, 1f, null, null, null, null, null, null, null, null, null, null, null, null));
                outThings.Add(pawn);
                HealthUtility.DamageUntilDowned(pawn, true);



                return(false);
            }
            else
            {
                return(true);
            }
        }
        // Token: 0x06000012 RID: 18 RVA: 0x0000314C File Offset: 0x0000134C FindRandomPreSpacerPawnForSpawn
        private static void GenerateSlave(Building_XenomorphCryptosleepCasket pod)
        {
            PawnGenerationRequest pawnGenerationRequest;

            pawnGenerationRequest = new PawnGenerationRequest(Building_XenomorphCryptosleepCasket.FindRandomPreSpacerPawnForSpawn(), Faction.OfAncients, (PawnGenerationContext)2, (pod.Map != null ? pod.Map.Tile : pod.MapHeld.Tile), false, false, false, false, true, false, 1f, false, true, true, false, true, false, false);
            Pawn pawn = PawnGenerator.GeneratePawn(pawnGenerationRequest);

            HealthUtility.DamageUntilDowned(pawn, true);
            if (Rand.Chance(0.75f))
            {
                BodyPartRecord part = pawn.RaceProps.body.AllParts.Find(x => x.def == BodyPartDefOf.Head);
                pawn.health.AddHediff(XenomorphDefOf.RRY_FaceHuggerInfection, part);
            }
            Building_XenomorphCryptosleepCasket.GiveRandomLootInventoryForTombPawn(pawn);
            bool flag = Rand.Value < 0.5f;

            if (flag)
            {
                HealthUtility.DamageUntilDead(pawn);
            }
            bool flag2 = !pod.TryAcceptThing(pawn, false);

            if (flag2)
            {
                Find.WorldPawns.PassToWorld(pawn, (PawnDiscardDecideMode)2);
            }
        }
Exemplo n.º 3
0
        public override void LessonUpdate()
        {
            if (!AllColonistsInCover())
            {
                for (int i = 0; i < coverCells.Count; i++)
                {
                    Vector3 position = coverCells[i].ToVector3ShiftedWithAltitude(AltitudeLayer.MetaOverlays);
                    Graphics.DrawMesh(MeshPool.plane10, position, Quaternion.identity, GenDraw.InteractionCellMaterial, 0);
                }
            }
            IEnumerable <Pawn> source = base.Map.mapPawns.PawnsInFaction(Faction.OfPlayer);

            if (source.Any((Pawn p) => p.Downed))
            {
                foreach (Pawn allPawn in base.Map.mapPawns.AllPawns)
                {
                    if (allPawn.HostileTo(Faction.OfPlayer))
                    {
                        HealthUtility.DamageUntilDowned(allPawn);
                    }
                }
            }
            if ((from p in base.Map.mapPawns.AllPawnsSpawned
                 where p.HostileTo(Faction.OfPlayer) && !p.Downed
                 select p).Count() == 0)
            {
                Find.ActiveLesson.Deactivate();
            }
        }
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     if (this.innerContainer.Count > 0 && (mode == DestroyMode.Deconstruct || mode == DestroyMode.KillFinalize))
     {
         if (mode != DestroyMode.Deconstruct)
         {
             List <Pawn> list = new List <Pawn>();
             foreach (Thing current in ((IEnumerable <Thing>) this.innerContainer))
             {
                 Pawn pawn = current as Pawn;
                 if (pawn != null)
                 {
                     list.Add(pawn);
                 }
             }
             foreach (Pawn current2 in list)
             {
                 HealthUtility.DamageUntilDowned(current2);
             }
         }
         this.EjectContents();
     }
     this.innerContainer.ClearAndDestroyContents(DestroyMode.Vanish);
     base.Destroy(mode);
 }
        public override void PostMapGenerate(Map map)
        {
            base.PostMapGenerate(map);
            Faction     faction  = Find.FactionManager.RandomNonHostileFaction(false, false, true, TechLevel.Spacer);
            int         maxPawns = Find.World.worldObjects.MapParentAt(map.Tile).GetComponent <QuestComp_MedicalEmergency>().maxPawns;
            List <Pawn> list     = new List <Pawn>();
            IntVec3     baseCenter;

            if (RCellFinder.TryFindRandomCellNearTheCenterOfTheMapWith((IntVec3 x) => x.Standable(map) && x.Fogged(map) && GridsUtility.GetRoom(x, map, RegionType.Set_Passable).CellCount >= 2, map, out baseCenter))
            {
                for (int i = 0; i < maxPawns; i++)
                {
                    IntVec3 intVec;
                    if (RCellFinder.TryFindRandomCellNearTheCenterOfTheMapWith((IntVec3 x) => x.Standable(map) && x.Fogged(map) && GridsUtility.GetRoom(x, map, RegionType.Set_Passable).CellCount >= 2, map, out intVec))
                    {
                        PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, faction, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 20f, false, true, true, false, false);
                        Pawn pawn = PawnGenerator.GeneratePawn(request);
                        list.Add(pawn);
                        HealthUtility.DamageUntilDowned(pawn);
                        IntVec3 intVec2 = CellFinder.RandomSpawnCellForPawnNear(intVec, map, 18);
                        GenSpawn.Spawn(pawn, intVec2, map, Rot4.Random, WipeMode.Vanish, false);
                    }
                }
                LordJob_DefendBase lordJob = new LordJob_DefendBase(faction, baseCenter);
                LordMaker.MakeNewLord(faction, lordJob, map, list);
            }
        }
Exemplo n.º 6
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            if (innerContainer.Count > 0 && (mode == DestroyMode.Deconstruct || mode == DestroyMode.KillFinalize))
            {
                if (mode != DestroyMode.Deconstruct)
                {
                    var list = new List <Pawn>();
                    foreach (var current in innerContainer)
                    {
                        if (current is Pawn pawn)
                        {
                            list.Add(pawn);
                        }
                    }

                    foreach (var current2 in list)
                    {
                        HealthUtility.DamageUntilDowned(current2);
                    }
                }

                EjectContents();
            }

            innerContainer.ClearAndDestroyContents();
            base.Destroy(mode);
        }
        //public override float Apply(DamageInfo dinfo, Thing thing)
        public override DamageResult Apply(DamageInfo dinfo, Thing thing)
        {
            if (!(thing is Pawn pawn))
            {
                return(base.Apply(dinfo, thing));
            }

            //return base.Apply(dinfo, thing);
            var unused = pawn; //scuttlebug Pawn

            var result = base.Apply(dinfo, pawn);

            Log.Warning(pawn + "has been infected!");
            var torso = pawn.health.hediffSet.GetNotMissingParts().First(bpr => bpr.def == BodyPartDefOf.Torso);

            pawn.health.AddHediff(HediffDef.Named("ScuttlebugInfection"), torso);

            HealthUtility.DamageUntilDowned(pawn);

            if (dinfo.Instigator is ScuttleBugClass worm)
            {
                worm.shouldDie = true;
            }

            return(result);
        }
        // Token: 0x06000011 RID: 17 RVA: 0x000030B4 File Offset: 0x000012B4
        private static void GenerateIncappedSpacer(Building_XenomorphCryptosleepCasket pod)
        {
            PawnGenerationRequest pawnGenerationRequest;

            pawnGenerationRequest = new PawnGenerationRequest(Building_XenomorphCryptosleepCasket.FindRandomSpacerPawnForSpawn(), Faction.OfAncients, (PawnGenerationContext)2, -1, false, false, false, false, true, false, 1f, false, true, true, false, true, false, false, null, null, null, null, null, null, null, null);
            Pawn pawn = PawnGenerator.GeneratePawn(pawnGenerationRequest);

            HealthUtility.DamageUntilDowned(pawn, true);
            if (Rand.Chance(0.25f))
            {
                BodyPartRecord part = pawn.RaceProps.body.AllParts.Find(x => x.def == BodyPartDefOf.Head);
                pawn.health.AddHediff(XenomorphDefOf.RRY_FaceHuggerInfection, part);
            }
            else if (Rand.Chance(0.25f))
            {
                BodyPartRecord part   = pawn.RaceProps.body.AllParts.Find(x => x.def == BodyPartDefOf.Torso);
                HediffDef      hediff = Rand.Chance(0.75f) ? XenomorphDefOf.RRY_HiddenXenomorphImpregnation : XenomorphDefOf.RRY_HiddenNeomorphImpregnation;
                pawn.health.AddHediff(hediff, part);
            }
            Building_XenomorphCryptosleepCasket.GiveRandomLootInventoryForTombPawn(pawn);
            bool flag = !pod.TryAcceptThing(pawn, false);

            if (flag)
            {
                Find.WorldPawns.PassToWorld(pawn, (PawnDiscardDecideMode)2);
            }
        }
Exemplo n.º 9
0
        protected override void Generate(ThingSetMakerParams parms, List <Thing> outThings)
        {
            Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, DownedRefugeeQuestUtility.GetRandomFactionForRefugee(), PawnGenerationContext.NonPlayer, -1, forceGenerateNewPawn: false, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true, mustBeCapableOfViolence: false, 20f));

            outThings.Add(pawn);
            HealthUtility.DamageUntilDowned(pawn);
        }
 public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
 {
     if (innerContainer.Count > 0 && (mode == DestroyMode.Deconstruct || mode == DestroyMode.KillFinalize) && !this.active && this.curTicksToGrow == this.totalTicksToGrow)
     {
         if (mode != DestroyMode.Deconstruct)
         {
             List <Pawn> list = new List <Pawn>();
             foreach (Thing item in (IEnumerable <Thing>)innerContainer)
             {
                 Pawn pawn = item as Pawn;
                 if (pawn != null)
                 {
                     list.Add(pawn);
                 }
             }
             foreach (Pawn item2 in list)
             {
                 HealthUtility.DamageUntilDowned(item2);
             }
         }
         EjectContents();
     }
     innerContainer.ClearAndDestroyContents();
     base.Destroy(mode);
 }
        public override bool TryExecute(IncidentParms parms)
        {
            Map map = (Map)parms.target;

            if (map.Biome != Util_CaveBiome.CaveBiomeDef)
            {
                return(base.TryExecute(parms));
            }
            IntVec3 intVec = IntVec3.Invalid;

            TryFindRefugeePodSpot(map, out intVec);
            if (intVec.IsValid == false)
            {
                return(false);
            }
            Faction faction = Find.FactionManager.FirstFactionOfDef(FactionDefOf.Spacer);
            PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, faction, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 20f, false, true, true, false, false, null, null, null, null, null, null);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            HealthUtility.DamageUntilDowned(pawn);
            string label = "LetterLabelRefugeePodCrash".Translate();
            string text  = "RefugeePodCrash".Translate();

            PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref label, pawn);
            Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.BadNonUrgent, new GlobalTargetInfo(intVec, map, false), null);
            DropPodUtility.MakeDropPodAt(intVec, map, new ActiveDropPodInfo
            {
                SingleContainedThing = pawn,
                openDelay            = 180,
                leaveSlag            = true
            });
            return(true);
        }
        private void ExplosiveTransformation(ThingDef thingDef, PawnKindDef pawnKindDef)
        {
            TransformPawn(transformInto, transformIntoKind);
            var chicken = DoBirthSpawn();

            if (chicken != null && !pawn.Dead)
            {
                //blood mess

                pawn.filth.GainFilth(ThingDefOf.Filth_CorpseBile);
                pawn.filth.GainFilth(ThingDefOf.Filth_Blood);
                pawn.filth.GainFilth(ThingDefOf.Filth_Ash);

                FilthMaker.MakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_CorpseBile, 4);
                FilthMaker.MakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Blood, 20);
                FilthMaker.MakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Ash, 10);

                GenExplosion.DoExplosion(pawn.Position, pawn.Map, 4f, DamageDefOf.Smoke, chicken);

                HealthUtility.DamageUntilDowned(pawn, true);
            }


            didIt = true;
        }
        public static Pawn GenerateRefugee(int tile)
        {
            Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, GetRandomFactionForRefugee(), PawnGenerationContext.NonPlayer, tile, forceGenerateNewPawn: false, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true, mustBeCapableOfViolence: false, 20f, forceAddFreeWarmLayerIfNeeded: true, allowGay: true, allowFood: true, allowAddictions: true, inhabitant: false, certainlyBeenInCryptosleep: false, forceRedressWorldPawnIfFormerColonist: false, worldPawnFactionDoesntMatter: false, 0f, null, 1f, null, null, null, null, 0.2f));

            HealthUtility.DamageUntilDowned(pawn, allowBleedingWounds: false);
            HealthUtility.DamageLegsUntilIncapableOfMoving(pawn, allowBleedingWounds: false);
            return(pawn);
        }
Exemplo n.º 14
0
        private Pawn GenerateIncappedAncient()
        {
            Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(PawnKindDefOf.AncientSoldier, Faction.OfAncients, PawnGenerationContext.NonPlayer, -1, forceGenerateNewPawn: false, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true, mustBeCapableOfViolence: false, 1f, forceAddFreeWarmLayerIfNeeded: false, allowGay: true, allowFood: true, allowAddictions: true, inhabitant: false, certainlyBeenInCryptosleep: true));

            HealthUtility.DamageUntilDowned(pawn);
            GiveRandomLootInventoryForTombPawn(pawn);
            return(pawn);
        }
        protected override void Generate(ItemCollectionGeneratorParams parms, List <Thing> outThings)
        {
            PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, Faction.OfSpacer, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 20f, false, true, true, false, false, false, false, null, null, null, null, null, null, null);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            outThings.Add(pawn);
            HealthUtility.DamageUntilDowned(pawn);
        }
        protected override void Generate(ThingSetMakerParams parms, List <Thing> outThings)
        {
            PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, DownedRefugeeQuestUtility.GetRandomFactionForRefugee(), PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 20f, false, true, true, false, false, false, false, null, null, null, null, null, null, null, null);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            outThings.Add(pawn);
            HealthUtility.DamageUntilDowned(pawn);
        }
        private Pawn GenerateIncappedAncient()
        {
            PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.AncientSoldier, Faction.OfAncients, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 1f, false, true, true, false, true, false, false, null, null, null, null, null, null, null, null);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            HealthUtility.DamageUntilDowned(pawn);
            this.GiveRandomLootInventoryForTombPawn(pawn);
            return(pawn);
        }
Exemplo n.º 18
0
        public static Pawn GenerateT5(int tile)
        {
            PawnKindDef           AndroidT5Colonist = PawnKindDefOf.AndroidT5Colonist;
            Faction               ofplayer          = Faction.OfAncients;
            PawnGenerationRequest request           = new PawnGenerationRequest(AndroidT5Colonist, ofplayer, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, false, 20f, true, true, true, false, false, false, false, null, null, new float?(0.2f), null, null, null, null, null);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            HealthUtility.DamageUntilDowned(pawn);
            return(pawn);
        }
Exemplo n.º 19
0
        protected override void ScatterAt(IntVec3 loc, Map map, int count = 1)
        {
            DownedRefugeeComp component = map.Parent.GetComponent <DownedRefugeeComp>();
            Pawn pawn = (component == null || !component.pawn.Any) ? DownedRefugeeQuestUtility.GenerateRefugee(map.Tile) : component.pawn.Take(component.pawn[0]);

            HealthUtility.DamageUntilDowned(pawn, allowBleedingWounds: false);
            HealthUtility.DamageLegsUntilIncapableOfMoving(pawn, allowBleedingWounds: false);
            GenSpawn.Spawn(pawn, loc, map);
            pawn.mindState.WillJoinColonyIfRescued = true;
            MapGenerator.rootsToUnfog.Add(loc);
        }
Exemplo n.º 20
0
        public static Pawn GenerateRefugee(int tile)
        {
            PawnKindDef           spaceRefugee            = PawnKindDefOf.SpaceRefugee;
            Faction               randomFactionForRefugee = DownedRefugeeQuestUtility.GetRandomFactionForRefugee();
            PawnGenerationRequest request = new PawnGenerationRequest(spaceRefugee, randomFactionForRefugee, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, false, 20f, true, true, true, false, false, false, false, null, null, new float?(0.2f), null, null, null, null, null);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            HealthUtility.DamageUntilDowned(pawn, false);
            HealthUtility.DamageLegsUntilIncapableOfMoving(pawn, false);
            return(pawn);
        }
        public static Pawn GenerateRefugee(int tile)
        {
            PawnKindDef           spaceRefugee = PawnKindDefOf.SpaceRefugee;
            Faction               ofSpacer     = Faction.OfSpacer;
            PawnGenerationRequest request      = new PawnGenerationRequest(spaceRefugee, ofSpacer, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, false, 20f, false, true, true, false, false, false, false, null, 0.2f, null, null, null, null, null);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            HealthUtility.DamageUntilDowned(pawn);
            HealthUtility.DamageLegsUntilIncapableOfMoving(pawn);
            return(pawn);
        }
Exemplo n.º 22
0
 public static bool IncrementPostfix(Pawn downed, Pawn instigator)
 {
     if (instigator != null)
     {
         if (instigator.isXenomorph())
         {
             HealthUtility.DamageUntilDowned(downed, false);
             return(false);
         }
     }
     return(true);
 }
        private Pawn GenerateSlave()
        {
            PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.Slave, Faction.OfAncients, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 1f, false, true, true, false, true, false, false, null, null, null, null, null, null, null, null);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            HealthUtility.DamageUntilDowned(pawn);
            this.GiveRandomLootInventoryForTombPawn(pawn);
            if (Rand.Value < 0.5f)
            {
                HealthUtility.DamageUntilDead(pawn);
            }
            return(pawn);
        }
Exemplo n.º 24
0
        private Pawn GenerateSlave()
        {
            PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.Slave, Faction.OfAncients, PawnGenerationContext.NonPlayer, -1, forceGenerateNewPawn: false, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true, mustBeCapableOfViolence: false, 1f, forceAddFreeWarmLayerIfNeeded: false, allowGay: true, allowFood: true, inhabitant: false, certainlyBeenInCryptosleep: true);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            HealthUtility.DamageUntilDowned(pawn);
            GiveRandomLootInventoryForTombPawn(pawn);
            if (Rand.Value < 0.5f)
            {
                HealthUtility.DamageUntilDead(pawn);
            }
            return(pawn);
        }
Exemplo n.º 25
0
        private static void GenerateIncappedSpacer(Building_CryptosleepCasket pod)
        {
            PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.AncientSoldier, Faction.OfAncients, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 1f, false, true, true, false, false, true, false, false, 0f, 0f, null, 1, null, null, null, null, null);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            HealthUtility.DamageUntilDowned(pawn, true);
            GiveRandomLootInventoryForTombPawn(pawn);

            if (!pod.TryAcceptThing(pawn, false))
            {
                Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard);
            }
        }
Exemplo n.º 26
0
        private static void GenerateIncappedSpacer(Building_CryptosleepCasket pod)
        {
            Faction faction = Find.FactionManager.FirstFactionOfDef(FactionDefOf.Spacer);
            Pawn    pawn    = PawnGenerator.GeneratePawn(PawnKindDefOf.SpaceSoldier, faction);

            if (!pod.TryAcceptThing(pawn, false))
            {
                Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard);
                return;
            }
            HealthUtility.DamageUntilDowned(pawn);
            GiveRandomLootInventoryForTombPawn(pawn);
        }
Exemplo n.º 27
0
        public static Pawn GenerateT5(int tile)
        {
            PawnKindDef           AndroidT5Colonist = PawnKindDefOf.AndroidT5Colonist;
            Faction               ofplayer          = Faction.OfAncients;
            PawnGenerationRequest request           = new PawnGenerationRequest(AndroidT5Colonist, ofplayer, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, false, 20f, true, true, true, false, false, false, false, false, 0f, null, 0f, null, null, null, null);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            HealthUtility.DamageUntilDowned(pawn);
            Hediff hediff = HediffMaker.MakeHediff(AndroidTiers.HediffDefOf.RebootingSequenceAT, pawn, null);

            hediff.Severity = 1f;
            pawn.health.AddHediff(hediff, null, null);
            return(pawn);
        }
Exemplo n.º 28
0
        /*
         * Dying Survivor
         *
         *
         *
         */
        public void DyingSurvivor(IncidentParms parms, out string flavorDesc, out GlobalTargetInfo target)
        {
            Settings.DebugString("Dying Survivor");
            var map = (Map)parms.target;

            RCellFinder.TryFindRandomPawnEntryCell(out var loc, map, CellFinder.EdgeRoadChance_Animal);
            var newThing = PawnGenerator.GeneratePawn(PawnKindDefOf.Drifter,
                                                      Find.FactionManager.FirstFactionOfDef(FactionDef.Named("HPL_StrangersNeutral")));
            var survivor = (Pawn)GenSpawn.Spawn(newThing, loc, map);

            Utility.ApplySanityLoss(survivor);
            HealthUtility.DamageUntilDowned(survivor);
            flavorDesc = "ROM_OmenSurvivorDesc6".Translate();
            target     = new GlobalTargetInfo(survivor);
        }
 public override void Notify_QuestSignalReceived(Signal signal)
 {
     base.Notify_QuestSignalReceived(signal);
     if (!(signal.tag == inSignal))
     {
         return;
     }
     for (int i = 0; i < pawns.Count; i++)
     {
         if (!pawns[i].DestroyedOrNull())
         {
             HealthUtility.DamageUntilDowned(pawns[i], allowBleedingWounds);
         }
     }
 }
Exemplo n.º 30
0
        public void Crash()
        {
            if (!mustCrash || !parent.Spawned)
            {
                return;
            }

            mustCrash = false;
            IntVec3 loc = parent.Position;
            Map     map = parent.Map;

            parent.Destroy(DestroyMode.KillFinalize);

            if (Props.crashScatterChunk != null)
            {
                for (int i = 0; i < Props.crashScatterChunkCount.RandomInRange; i++)
                {
                    GenSpawn.Spawn(Props.crashScatterChunk, RandomNearby(loc), map);
                }
            }

            if (Props.crashPilotKind != null)
            {
                for (int i = 0; i < Props.crashPilotCount.RandomInRange; i++)
                {
                    Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(Props.crashPilotKind, tradeShip.Faction));
                    GenPlace.TryPlaceThing(pawn, RandomNearby(loc), map, ThingPlaceMode.Near);
                    pawn.TakeDamage(new DamageInfo(DamageDefOf.Bomb, 250, 0, -1, parent));
                    if (!pawn.Dead)
                    {
                        HealthUtility.DamageUntilDowned(pawn);
                    }
                }
            }

            foreach (Thing thing in tradeShip.Goods)
            {
                GenPlace.TryPlaceThing(thing, RandomNearby(loc), map, ThingPlaceMode.Near);

                Pawn pawn = thing as Pawn;
                if (pawn != null)
                {
                    pawn.TakeDamage(new DamageInfo(DamageDefOf.Bomb, 250, 0, -1, parent));
                }
            }

            Find.LetterStack.ReceiveLetter("TraderShipsCrashName".Translate(), "TraderShipsCrash".Translate(tradeShip.name, tradeShip.def.label), LetterDefOf.NeutralEvent, new LookTargets(loc, map), tradeShip.Faction);
        }