Esempio n. 1
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map map = (Map)parms.target;
            Building_LandingPad landingPad = Util_LandingPad.GetBestAvailableLandingPadReachingMapEdge(map);

            if (landingPad == null)
            {
                // Should not happen if CanFireNowSub returned true.
                return(false);
            }

            // Spawn landing dispatcher spaceship.
            FlyingSpaceshipLanding dispatcherSpaceship = Util_Spaceship.SpawnLandingSpaceship(landingPad, SpaceshipKind.DispatcherPick);

            // Spawn expedition team.
            List <Pawn> teamPawns = Expedition.GenerateExpeditionPawns(map);

            if (Rand.Value < 0.2f)
            {
                ApplyInjuriesOrIllnessToTeam(map, teamPawns);
            }
            return(SpawnTeamOnMapEdge(landingPad.Position, map, teamPawns));
        }
        public void SpawnSurvivingPawns()
        {
            List <Pawn> survivingPawns = new List <Pawn>();

            foreach (Pawn pawn in this.pawnsAboard)
            {
                GenSpawn.Spawn(pawn, this.OccupiedRect().Cells.RandomElement(), this.Map);
                Expedition.RandomlyDamagePawn(pawn, Rand.RangeInclusive(1, 4), Rand.RangeInclusive(4, 16));
                if (pawn.Dead == false)
                {
                    survivingPawns.Add(pawn);
                }
            }
            this.pawnsAboard.Clear();
            if (survivingPawns.Count > 0)
            {
                IntVec3 exitSpot        = IntVec3.Invalid;
                bool    exitSpotIsValid = RCellFinder.TryFindBestExitSpot(survivingPawns.First(), out exitSpot, TraverseMode.PassAllDestroyableThings);
                if (exitSpotIsValid)
                {
                    LordMaker.MakeNewLord(Util_Faction.MiningCoFaction, new LordJob_ExitMap(exitSpot), this.Map, survivingPawns);
                }
            }
        }