internal void Arrive(IntVec3 targetCell, ShipArrivalAction arrivalAction, PawnsArrivalModeDef mapArrivalMode) { if (this.IsPlayerControlled && arrivalAction != ShipArrivalAction.BombingRun) { Messages.Message("MessageShipsArrived".Translate(), this, MessageTypeDefOf.NeutralEvent); } if (arrivalAction == ShipArrivalAction.EnterMapAssault || arrivalAction == ShipArrivalAction.EnterMapFriendly) { MapParent parent = Find.WorldObjects.MapParentAt(this.Tile); if (parent != null) { Map map = parent.Map; if (map == null) { LongEventHandler.QueueLongEvent(delegate { MapGeneratorDef def = WorldShipUtility.GetMapGeneratorDefForObject(parent); map = MapGenerator.GenerateMap(Find.World.info.initialMapSize, parent, MapGeneratorDefOf.Base_Faction); targetCell = IntVec3.Zero; }, "GeneratingMap", true, new Action <Exception>(GameAndMapInitExceptionHandlers.ErrorWhileGeneratingMap)); } LongEventHandler.QueueLongEvent(delegate { WorldShipUtility.EnterMapWithShip(this, map, targetCell, arrivalAction, mapArrivalMode); }, "SpawningColonists", true, new Action <Exception>(GameAndMapInitExceptionHandlers.ErrorWhileGeneratingMap)); } } else if (arrivalAction == ShipArrivalAction.BombingRun) { if (BombingUtility.TryBombWorldTarget(this.Tile, this)) { } } }
public static bool TryBombWorldTarget(int targetTile, WorldShip worldShip) { MapParent parent = Find.WorldObjects.WorldObjectAt <MapParent>(targetTile); if (parent != null) { if (parent.HasMap) { return(BombingUtility.BombingRunOnMapCenter(parent.Map)); } else { Find.World.worldObjects.Remove(parent); } foreach (var data in worldShip.WorldShipData) { ShipBase ship = data.Ship; ship.loadedBombs.ForEach(c => c.Discard(true)); } } return(false); }