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); }
private void ShipsLeaving() { WorldShip worldShip = (WorldShip)WorldObjectMaker.MakeWorldObject(ShipNamespaceDefOfs.WorldShip); worldShip.SetFaction(this.containingShip.Faction); worldShip.Tile = this.Map.Tile; worldShip.AddShip(this.containingShip, true); Find.World.worldObjects.Add(worldShip); 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; worldShip.AddShip(dropPodLeaving.containingShip, true); dropPodLeaving.Destroy(DestroyMode.Vanish); } } worldShip.Launch(this.destinationTile, this.destinationCell, arrivalAction, pawnArriveMode); this.DeSpawn(); }