public static void SaveSurvivors_Main()
        {
            List <Pawn> pawnsToSave;
            var         savedPawns = FNotAgain_Mod.Settings.GetHandle <CrashlandingHandle>("savedPawns");

            if (__instance.journeyDestinationTile >= 0)
            {
                CaravanJourneyDestinationUtility.PlayerCaravansAt(__instance.journeyDestinationTile, __instance.caravans);
                foreach (List <Pawn> p in __instance.caravans)
                {
                    pawnsToSave.addRange(p);
                }
            }
            else
            {
                List <Building> list = ShipUtility.ShipBuildingsAttachedTo(__instance.shipRoot).ToList <Building>();
                foreach (Building current in list)
                {
                    Building_CryptosleepCasket building_CryptosleepCasket = current as Building_CryptosleepCasket;
                    if (building_CryptosleepCasket != null && building_CryptosleepCasket.HasAnyContents && building_CryptosleepCasket.ContainedThing == typeof(Pawn))
                    {
                        pawnsToSave.add(building_CryptosleepCasket.ContainedThing);
                    }
                }
            }
        }
Beispiel #2
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            if (this.IsPlayerControlled)
            {
                Command_Action command_Action = new Command_Action();
                command_Action.defaultLabel = "CommandLaunchShip".Translate();
                command_Action.defaultDesc  = "CommandLaunchShipDesc".Translate();
                command_Action.icon         = DropShipUtility.LaunchSingleCommandTex;
                command_Action.action       = delegate
                {
                    SoundDef.Named("ShipTakeoff_SuborbitalLaunch").PlayOneShotOnCamera();
                    this.ships[0].StartChoosingDestination(this.ships[0], false);
                };
                yield return(command_Action);

                if (Find.WorldSelector.SingleSelectedObject == this)
                {
                    yield return(TravelingShipsUtility.ShipTouchdownCommand(this, true));

                    yield return(TravelingShipsUtility.ShipTouchdownCommand(this, false));
                }
                FactionBase factionBase = CaravanVisitUtility.FactionBaseVisitedNow(this);
                if (factionBase != null && factionBase.CanTradeNow)
                {
                    yield return(TravelingShipsUtility.TradeCommand(this));
                }
                if (CaravanJourneyDestinationUtility.AnyJurneyDestinationAt(base.Tile))
                {
                    yield return(CaravanJourneyDestinationUtility.TakeOffCommand(base.Tile));
                }
            }
        }
Beispiel #3
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            if (this.IsPlayerControlled)
            {
                Command_Action command_Action = new Command_Action();
                command_Action.defaultLabel = "CommandLaunchShip".Translate();
                command_Action.defaultDesc  = "CommandLaunchShipDesc".Translate();
                command_Action.icon         = DropShipUtility.LaunchSingleCommandTex;
                command_Action.action       = delegate
                {
                    SoundDef.Named("ShipTakeoff_SuborbitalLaunch").PlayOneShotOnCamera();
                    this.ships[0].StartChoosingDestination(this.ships[0], false);
                };
                yield return(command_Action);

                if (Find.WorldSelector.SingleSelectedObject == this)
                {
                    yield return(TravelingShipsUtility.ShipTouchdownCommand(this, true));

                    yield return(TravelingShipsUtility.ShipTouchdownCommand(this, false));
                }
                Settlement factionBase = CaravanVisitUtility.SettlementVisitedNow(this);
                if (factionBase != null && factionBase.CanTradeNow)
                {
                    yield return(TravelingShipsUtility.TradeCommand(this));
                }
                if (CaravanJourneyDestinationUtility.AnyJurneyDestinationAt(base.Tile))
                {
                    yield return(CaravanJourneyDestinationUtility.TakeOffCommand(base.Tile));
                }

                if (!this.ships.Any(x => x.ParkingMap == null))
                {
                    Command_Action command_Action4 = new Command_Action();
                    command_Action4.defaultLabel = "CommandTravelParkingPosition".Translate();
                    command_Action4.defaultDesc  = "CommandTravelParkingPositionDesc".Translate();
                    command_Action4.icon         = DropShipUtility.ReturnParkingFleet;
                    command_Action4.action       = delegate
                    {
                        foreach (ShipBase ship in this.ships)
                        {
                            ship.TryLaunch(new GlobalTargetInfo(ship.ParkingPosition, ship.ParkingMap), PawnsArriveMode.CenterDrop, TravelingShipArrivalAction.EnterMapFriendly, false);
                        }
                    };
                    yield return(command_Action4);
                }
            }
        }