private bool ChoseWorldTarget(GlobalTargetInfo target) { if (this.parentLandedShip != null) { this.parentLandedShip.isTargeting = true; } this.isTargeting = true; int tile; if (this.parentLandedShip != null) { tile = this.parentLandedShip.Tile; } else { tile = this.Map.Tile; } bool canBomb = true; if (!target.IsValid) { Messages.Message("MessageTransportPodsDestinationIsInvalid".Translate(), MessageSound.RejectInput); return(false); } if (this.LaunchAsFleet) { List <int> distances = new List <int>(); for (int i = 0; i < DropShipUtility.currentShipTracker.ShipsInFleet(this.fleetID).Count; i++) { ShipBase ship = DropShipUtility.currentShipTracker.ShipsInFleet(this.fleetID)[i]; if (ship.compShip.cargoLoadingActive) { Messages.Message("MessageFleetLaunchImpossible".Translate(), MessageSound.RejectInput); return(false); } int num = (Find.WorldGrid.TraversalDistanceBetween(tile, target.Tile)); if (num > ship.MaxLaunchDistanceEverPossible(true)) { Messages.Message("MessageFleetLaunchImpossible".Translate(), MessageSound.RejectInput); return(false); } if (!(2 * num > ship.MaxLaunchDistanceEverPossible(true))) { canBomb = false; } } } else { int num = Find.WorldGrid.TraversalDistanceBetween(tile, target.Tile); if (num > this.MaxLaunchDistanceEverPossible(this.LaunchAsFleet)) { Messages.Message("MessageTransportPodsDestinationIsTooFar".Translate(new object[] { CompLaunchable.FuelNeededToLaunchAtDist((float)num).ToString("0.#") }), MessageSound.RejectInput); return(false); } if (!(2 * num > this.MaxLaunchDistanceEverPossible(true))) { canBomb = false; } } MapParent mapParent = target.WorldObject as MapParent; if (mapParent != null && mapParent.HasMap) { Map myMap = this.Map; Map map = mapParent.Map; Current.Game.VisibleMap = map; Targeter targeter = Find.Targeter; Action actionWhenFinished = delegate { if (Find.Maps.Contains(myMap)) { Current.Game.VisibleMap = myMap; } }; targeter.BeginTargeting(TargetingParameters.ForDropPodsDestination(), delegate(LocalTargetInfo x) { if (!this.ReadyForTakeoff || this.LaunchAsFleet && DropShipUtility.currentShipTracker.ShipsInFleet(this.fleetID).Any(s => !s.ReadyForTakeoff)) { return; } this.TryLaunch(x.ToGlobalTargetInfo(map), PawnsArriveMode.Undecided, TravelingShipArrivalAction.EnterMapFriendly); }, null, actionWhenFinished, DropShipUtility.TargeterShipAttachment); return(true); } if (target.WorldObject is Settlement || target.WorldObject is Site) { Find.WorldTargeter.closeWorldTabWhenFinished = false; MapParent localMapParent = target.WorldObject as MapParent; List <FloatMenuOption> list = new List <FloatMenuOption>(); if (!target.WorldObject.Faction.HostileTo(Faction.OfPlayer)) { list.Add(new FloatMenuOption("VisitSettlement".Translate(new object[] { target.WorldObject.Label }), delegate { if (!this.ReadyForTakeoff || this.LaunchAsFleet && DropShipUtility.currentShipTracker.ShipsInFleet(this.fleetID).Any(s => !s.ReadyForTakeoff)) { return; } this.TryLaunch(target, PawnsArriveMode.Undecided, TravelingShipArrivalAction.StayOnWorldMap); CameraJumper.TryHideWorld(); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } list.Add(new FloatMenuOption("DropAtEdge".Translate(), delegate { if (!this.ReadyForTakeoff || this.LaunchAsFleet && DropShipUtility.currentShipTracker.ShipsInFleet(this.fleetID).Any(s => !s.ReadyForTakeoff)) { return; } this.TryLaunch(target, PawnsArriveMode.EdgeDrop, TravelingShipArrivalAction.EnterMapFriendly); CameraJumper.TryHideWorld(); }, MenuOptionPriority.Default, null, null, 0f, null, null)); //list.Add(new FloatMenuOption("DropInCenter".Translate(), delegate //{ // if (!this.ReadyForTakeoff || this.LaunchAsFleet && DropShipUtility.currentShipTracker.ShipsInFleet(this.fleetID).Any(s => !s.ReadyForTakeoff)) // { // return; // } // this.TryLaunch(target, PawnsArriveMode.CenterDrop, TravelingShipArrivalAction.EnterMapFriendly); // CameraJumper.TryHideWorld(); //}, MenuOptionPriority.Default, null, null, 0f, null, null)); list.Add(new FloatMenuOption("AttackFactionBaseAerial".Translate(), delegate { if (!this.ReadyForTakeoff || this.LaunchAsFleet && DropShipUtility.currentShipTracker.ShipsInFleet(this.fleetID).Any(s => !s.ReadyForTakeoff)) { return; } this.TryLaunch(target, PawnsArriveMode.CenterDrop, TravelingShipArrivalAction.EnterMapAssault); CameraJumper.TryHideWorld(); }, MenuOptionPriority.Default, null, null, 0f, null, null)); if (canBomb && (DropShipUtility.currentShipTracker.ShipsInFleet(this.fleetID).Any(x => x.installedTurrets.Any(y => y.Key.slotType == WeaponSystemType.Bombing && y.Value != null))) || this.loadedBombs.Any()) { list.Add(new FloatMenuOption("BombFactionBase".Translate(), delegate { if (!this.ReadyForTakeoff || this.LaunchAsFleet && DropShipUtility.currentShipTracker.ShipsInFleet(this.fleetID).Any(s => !s.ReadyForTakeoff)) { return; } this.performBombingRun = true; this.TryLaunch(target, PawnsArriveMode.CenterDrop, TravelingShipArrivalAction.BombingRun); CameraJumper.TryHideWorld(); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list)); return(true); } if (Find.World.Impassable(target.Tile)) { Messages.Message("MessageTransportPodsDestinationIsInvalid".Translate(), MessageSound.RejectInput); return(false); } this.TryLaunch(target, PawnsArriveMode.Undecided, TravelingShipArrivalAction.StayOnWorldMap); return(true); }