Esempio n. 1
0
        private void GroupLeftMap()
        {
            if (this.destinationTile < 0)
            {
                Log.Error("Drop pod left the map, but its destination tile is " + this.destinationTile);
                this.Destroy(DestroyMode.Vanish);
                return;
            }
            TravelingShips travelingShips = (TravelingShips)WorldObjectMaker.MakeWorldObject(ShipNamespaceDefOfs.TravelingSuborbitalShip);

            travelingShips.Tile = base.Map.Tile;
            travelingShips.SetFaction(this.Faction);
            travelingShips.destinationTile = this.destinationTile;
            travelingShips.destinationCell = this.destinationCell;
            travelingShips.arriveMode      = this.pawnArriveMode;
            travelingShips.arrivalAction   = this.arrivalAction;
            Find.WorldObjects.Add(travelingShips);
            Predicate <Thing> predicate = delegate(Thing t)
            {
                if (t != this)
                {
                    if (t is ShipBase_Traveling)
                    {
                        ShipBase_Traveling ship = (ShipBase_Traveling)t;
                        if (ship.containingShip.shipState == ShipState.Outgoing)
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            };
            List <Thing> tmpleavingShips = base.Map.listerThings.AllThings.FindAll(x => predicate(x));

            for (int i = 0; i < tmpleavingShips.Count; i++)
            {
                ShipBase_Traveling dropPodLeaving = tmpleavingShips[i] as ShipBase_Traveling;
                if (dropPodLeaving != null && dropPodLeaving.fleetID == this.fleetID)
                {
                    dropPodLeaving.alreadyLeft = true;
                    travelingShips.AddShip(dropPodLeaving.containingShip, true);
                    dropPodLeaving.Destroy(DestroyMode.Vanish);
                }
            }
            travelingShips.AddShip(this.containingShip, true);
            travelingShips.SetFaction(this.containingShip.Faction);

            this.Destroy(DestroyMode.Vanish);
        }
Esempio n. 2
0
        public static void LaunchLandedFleet(LandedShip landedShip, int destinationTile, IntVec3 destinationCell, PawnsArriveMode pawnArriveMode, TravelingShipArrivalAction arrivalAction)
        {
            if (destinationTile < 0)
            {
                Log.Error("Tried launching landed ship, but its destination tile is " + destinationTile);
                return;
            }

            TravelingShips travelingShips = (TravelingShips)WorldObjectMaker.MakeWorldObject(ShipNamespaceDefOfs.TravelingSuborbitalShip);

            travelingShips.Tile = landedShip.Tile;
            travelingShips.SetFaction(landedShip.Faction);
            travelingShips.destinationTile = destinationTile;
            travelingShips.destinationCell = destinationCell;
            //        travelingShips.destinationCell = this.destinationCell;
            travelingShips.arriveMode    = pawnArriveMode;
            travelingShips.arrivalAction = arrivalAction;
            Find.WorldObjects.Add(travelingShips);
            foreach (ShipBase current in landedShip.ships)
            {
                travelingShips.AddShip(current, true);
                //            current.SavePotentialWorldPawns();
                DropShipUtility.ReimbarkWorldPawnsForLandedShip(current);
            }
            travelingShips.SetFaction(landedShip.Faction);
            TravelingShipsUtility.AddAllLandedPawnsToWorld(landedShip);
            if (Find.World.worldObjects.Contains(landedShip))
            {
                Find.World.worldObjects.Remove(landedShip);
            }
        }