public static IEnumerable <FloatMenuOption> GetATKFloatMenuOptions( CompLaunchableSRTS representative, IEnumerable <IThingHolder> pods, SettlementBase settlement, Caravan car) { Func <FloatMenuAcceptanceReport> acceptanceReportGetter1 = (Func <FloatMenuAcceptanceReport>)(() => TransportPodsArrivalAction_AttackSettlement.CanAttack(pods, settlement)); Func <TransportPodsArrivalAction_AttackSettlement> arrivalActionGetter1 = (Func <TransportPodsArrivalAction_AttackSettlement>)(() => new TransportPodsArrivalAction_AttackSettlement(settlement, PawnsArrivalModeDefOf.EdgeDrop)); object[] objArray1 = new object[1] { (object)settlement.Label }; foreach (FloatMenuOption floatMenuOption in SRTSArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_AttackSettlement>(acceptanceReportGetter1, arrivalActionGetter1, "AttackAndDropAtEdge".Translate(objArray1), representative, settlement.Tile, car)) { FloatMenuOption f = floatMenuOption; yield return(f); f = (FloatMenuOption)null; } Func <FloatMenuAcceptanceReport> acceptanceReportGetter2 = (Func <FloatMenuAcceptanceReport>)(() => TransportPodsArrivalAction_AttackSettlement.CanAttack(pods, settlement)); Func <TransportPodsArrivalAction_AttackSettlement> arrivalActionGetter2 = (Func <TransportPodsArrivalAction_AttackSettlement>)(() => new TransportPodsArrivalAction_AttackSettlement(settlement, PawnsArrivalModeDefOf.CenterDrop)); object[] objArray2 = new object[1] { (object)settlement.Label }; foreach (FloatMenuOption floatMenuOption in SRTSArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_AttackSettlement>(acceptanceReportGetter2, arrivalActionGetter2, "AttackAndDropInCenter".Translate(objArray2), representative, settlement.Tile, car)) { FloatMenuOption f2 = floatMenuOption; yield return(f2); f2 = (FloatMenuOption)null; } }
public static IEnumerable <FloatMenuOption> GetGIFTFloatMenuOptions(CompLaunchableSRTS representative, IEnumerable <IThingHolder> pods, Settlement settlement, Caravan car) { if (settlement.Faction == Faction.OfPlayer) { return(Enumerable.Empty <FloatMenuOption>()); } return(SRTSArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_GiveGift>((Func <FloatMenuAcceptanceReport>)(() => TransportPodsArrivalAction_GiveGift.CanGiveGiftTo(pods, settlement)), (Func <TransportPodsArrivalAction_GiveGift>)(() => new TransportPodsArrivalAction_GiveGift(settlement)), "GiveGiftViaTransportPods".Translate(settlement.Faction.Name, FactionGiftUtility.GetGoodwillChange(pods, settlement).ToStringWithSign()), representative, settlement.Tile, car)); }
public static IEnumerable <FloatMenuOption> GetVisitFloatMenuOptions( CompLaunchableSRTS representative, IEnumerable <IThingHolder> pods, SettlementBase settlement, Caravan car) { return(SRTSArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_VisitSettlement>((Func <FloatMenuAcceptanceReport>)(() => TransportPodsArrivalAction_VisitSettlement.CanVisit(pods, settlement)), (Func <TransportPodsArrivalAction_VisitSettlement>)(() => new TransportPodsArrivalAction_VisitSettlement(settlement)), "VisitSettlement".Translate((object)settlement.Label), representative, settlement.Tile, car)); }
private bool ChoseWorldTargetToBomb(GlobalTargetInfo target) { if (!target.IsValid) { Messages.Message("MessageTransportPodsDestinationIsInvalid".Translate(), MessageTypeDefOf.RejectInput, false); return(false); } int num = Find.WorldGrid.TraversalDistanceBetween(this.parent.Map.Tile, target.Tile); if (num > CompLauncher.MaxLaunchDistance) { Messages.Message("MessageTransportPodsDestinationIsTooFar".Translate(CompLaunchableSRTS.FuelNeededToLaunchAtDist((float)num, this.parent.GetComp <CompLaunchableSRTS>().BaseFuelPerTile).ToString("0.#")), MessageTypeDefOf.RejectInput, false); return(false); } if (Find.WorldObjects.AnyMapParentAt(target.Tile)) { MapParent targetMapParent = Find.WorldObjects.MapParentAt(target.Tile); if (SRTSArrivalActionBombRun.CanBombSpecificCell(null, targetMapParent)) { Map targetMap = targetMapParent.Map; Current.Game.CurrentMap = targetMap; CameraJumper.TryHideWorld(); TargetingParameters bombingTargetingParams = new TargetingParameters(); bombingTargetingParams.canTargetLocations = true; bombingTargetingParams.canTargetSelf = false; bombingTargetingParams.canTargetPawns = false; bombingTargetingParams.canTargetFires = true; bombingTargetingParams.canTargetBuildings = true; bombingTargetingParams.canTargetItems = true; bombingTargetingParams.validator = ((TargetInfo x) => x.Cell.InBounds(targetMap) && (!x.Cell.GetRoof(targetMap)?.isThickRoof ?? true)); SRTSHelper.targeter.BeginTargeting(bombingTargetingParams, delegate(IEnumerable <IntVec3> cells, Pair <IntVec3, IntVec3> targetPoints) { TryLaunchBombRun(target.Tile, targetPoints, cells, targetMapParent); }, this.parent.def, bombType, targetMap, null, delegate() { if (Find.Maps.Contains(this.parent.Map)) { Current.Game.CurrentMap = this.parent.Map; } }, Tex2D.LauncherTargeting); return(true); } } Messages.Message("CannotBombMap".Translate(), MessageTypeDefOf.RejectInput, false); return(false); }
private bool ChoseWorldTarget(GlobalTargetInfo target) { if (this.carr == null && !this.LoadingInProgressOrReadyToLaunch) { return(true); } if (!target.IsValid) { Messages.Message("MessageTransportPodsDestinationIsInvalid".Translate(), MessageTypeDefOf.RejectInput, false); return(false); } int num = Find.WorldGrid.TraversalDistanceBetween(this.carr != null ? this.carr.Tile : this.parent.Map.Tile, target.Tile, true, int.MaxValue); if (num > this.MaxLaunchDistance) { Messages.Message("MessageTransportPodsDestinationIsTooFar".Translate(CompLaunchableSRTS.FuelNeededToLaunchAtDist((float)num).ToString("0.#")), MessageTypeDefOf.RejectInput, false); return(false); } if (Find.WorldGrid[target.Tile].biome.impassable || Find.World.Impassable(target.Tile)) { Messages.Message("MessageTransportPodsDestinationIsInvalid".Translate(), MessageTypeDefOf.RejectInput, false); return(false); } Find.WorldObjects.MapParentAt(target.Tile); IEnumerable <FloatMenuOption> floatMenuOptionsAt = this.GetTransportPodsFloatMenuOptionsAt(target.Tile, this.carr); if (!floatMenuOptionsAt.Any <FloatMenuOption>()) { if (Find.WorldGrid[target.Tile].biome.impassable || Find.World.Impassable(target.Tile)) { Messages.Message("MessageTransportPodsDestinationIsInvalid".Translate(), MessageTypeDefOf.RejectInput, false); return(false); } this.TryLaunch(target.Tile, (TransportPodsArrivalAction)null, (Caravan)null); return(true); } if (floatMenuOptionsAt.Count <FloatMenuOption>() == 1) { if (!floatMenuOptionsAt.First <FloatMenuOption>().Disabled) { floatMenuOptionsAt.First <FloatMenuOption>().action(); } return(false); } Find.WindowStack.Add((Window) new FloatMenu(floatMenuOptionsAt.ToList <FloatMenuOption>())); return(false); }
public static IEnumerable <FloatMenuOption> GetVisitSite( CompLaunchableSRTS representative, IEnumerable <IThingHolder> pods, Site site, Caravan car) { foreach (FloatMenuOption floatMenuOption in SRTSArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_VisitSite>((Func <FloatMenuAcceptanceReport>)(() => TransportPodsArrivalAction_VisitSite.CanVisit(pods, site)), (Func <TransportPodsArrivalAction_VisitSite>)(() => new TransportPodsArrivalAction_VisitSite(site, PawnsArrivalModeDefOf.EdgeDrop)), "DropAtEdge".Translate(), representative, site.Tile, car)) { FloatMenuOption f = floatMenuOption; yield return(f); f = (FloatMenuOption)null; } foreach (FloatMenuOption floatMenuOption in SRTSArrivalActionUtility.GetFloatMenuOptions <TransportPodsArrivalAction_VisitSite>((Func <FloatMenuAcceptanceReport>)(() => TransportPodsArrivalAction_VisitSite.CanVisit(pods, site)), (Func <TransportPodsArrivalAction_VisitSite>)(() => new TransportPodsArrivalAction_VisitSite(site, PawnsArrivalModeDefOf.CenterDrop)), "DropInCenter".Translate(), representative, site.Tile, car)) { FloatMenuOption f2 = floatMenuOption; yield return(f2); f2 = (FloatMenuOption)null; } }
public static IEnumerable <FloatMenuOption> GetSite( Site site, IEnumerable <IThingHolder> pods, CompLaunchableSRTS representative, Caravan car) { foreach (FloatMenuOption floatMenuOption in SRTSStatic.GetMapParent((MapParent)site, pods, representative, car)) { FloatMenuOption o = floatMenuOption; yield return(o); o = (FloatMenuOption)null; } foreach (FloatMenuOption floatMenuOption in SRTSStatic.GetVisitSite(representative, pods, site, car)) { FloatMenuOption o2 = floatMenuOption; yield return(o2); o2 = (FloatMenuOption)null; } }
public static IEnumerable <FloatMenuOption> GetFloatMenuOptions <T>( Func <FloatMenuAcceptanceReport> acceptanceReportGetter, Func <T> arrivalActionGetter, string label, CompLaunchableSRTS representative, int destinationTile, Caravan car) where T : TransportPodsArrivalAction { FloatMenuAcceptanceReport rep = acceptanceReportGetter(); if (rep.Accepted || !rep.FailReason.NullOrEmpty() || !rep.FailMessage.NullOrEmpty()) { if (!rep.FailReason.NullOrEmpty()) { yield return(new FloatMenuOption(label + " (" + rep.FailReason + ")", (Action)null, MenuOptionPriority.Default, (Action)null, (Thing)null, 0.0f, (Func <Rect, bool>)null, (WorldObject)null)); } else { yield return(new FloatMenuOption(label, (Action)(() => { FloatMenuAcceptanceReport acceptanceReport = acceptanceReportGetter(); if (acceptanceReport.Accepted) { representative.TryLaunch(destinationTile, (TransportPodsArrivalAction)arrivalActionGetter(), car); } else { if (acceptanceReport.FailMessage.NullOrEmpty()) { return; } Messages.Message(acceptanceReport.FailMessage, (LookTargets) new GlobalTargetInfo(destinationTile), MessageTypeDefOf.RejectInput, false); } }), MenuOptionPriority.Default, (Action)null, (Thing)null, 0.0f, (Func <Rect, bool>)null, (WorldObject)null)); } } }
public static IEnumerable <FloatMenuOption> GetMapParent( MapParent mapparent, IEnumerable <IThingHolder> pods, CompLaunchableSRTS representative, Caravan car) { if (TransportPodsArrivalAction_LandInSpecificCell.CanLandInSpecificCell(pods, mapparent)) { yield return(new FloatMenuOption("LandInExistingMap".Translate(mapparent.Label), (Action)(() => { Map myMap = car != null ? (Map)null : representative.parent.Map; Current.Game.CurrentMap = mapparent.Map; CameraJumper.TryHideWorld(); Find.Targeter.BeginTargeting(TargetingParameters.ForDropPodsDestination(), (Action <LocalTargetInfo>)(x => representative.TryLaunch(mapparent.Tile, (TransportPodsArrivalAction) new TransportPodsArrivalAction_LandInSpecificCell(mapparent, x.Cell), car)), (Pawn)null, (Action)(() => { if (myMap == null || !Find.Maps.Contains(myMap)) { return; } Current.Game.CurrentMap = myMap; }), CompLaunchable.TargeterMouseAttachment); }), MenuOptionPriority.Default, (Action)null, (Thing)null, 0.0f, (Func <Rect, bool>)null, (WorldObject)null)); } }
public static IEnumerable <FloatMenuOption> getFM( WorldObject wobj, IEnumerable <IThingHolder> ih, CompLaunchableSRTS comp, Caravan car) { if (wobj is Caravan) { return(Enumerable.Empty <FloatMenuOption>()); } if (wobj is Site) { return(SRTSStatic.GetSite(wobj as Site, ih, comp, car)); } if (wobj is Settlement) { return(SRTSStatic.GetSettle(wobj as Settlement, ih, comp, car)); } if (wobj is MapParent) { return(SRTSStatic.GetMapParent(wobj as MapParent, ih, comp, car)); } return(Enumerable.Empty <FloatMenuOption>()); }
public static IEnumerable <FloatMenuOption> GetSettle( Settlement bs, IEnumerable <IThingHolder> pods, CompLaunchableSRTS representative, Caravan car) { foreach (FloatMenuOption floatMenuOption in SRTSStatic.GetMapParent((MapParent)bs, pods, representative, car)) { FloatMenuOption o = floatMenuOption; yield return(o); o = (FloatMenuOption)null; } foreach (FloatMenuOption visitFloatMenuOption in SRTSArrivalActionUtility.GetVisitFloatMenuOptions(representative, pods, bs, car)) { FloatMenuOption f = visitFloatMenuOption; yield return(f); f = (FloatMenuOption)null; } /*Uncomment to allow gifting of Ship and contents to faction -SmashPhil*/ /*foreach (FloatMenuOption giftFloatMenuOption in SRTSArrivalActionUtility.GetGIFTFloatMenuOptions(representative, pods, bs, car)) * { * FloatMenuOption f2 = giftFloatMenuOption; * yield return f2; * f2 = (FloatMenuOption) null; * }*/ foreach (FloatMenuOption atkFloatMenuOption in SRTSArrivalActionUtility.GetATKFloatMenuOptions(representative, pods, bs, car)) { FloatMenuOption f3 = atkFloatMenuOption; yield return(f3); f3 = (FloatMenuOption)null; } }
public void TryLaunch(int destinationTile, TransportPodsArrivalAction arrivalAction, Caravan cafr = null) { if (cafr == null && !this.parent.Spawned) { Log.Error("Tried to launch " + (object)this.parent + ", but it's unspawned.", false); } else { if (this.parent.Spawned && !this.LoadingInProgressOrReadyToLaunch || (!this.AllInGroupConnectedToFuelingPort || !this.AllFuelingPortSourcesInGroupHaveAnyFuel)) { return; } if (cafr == null) { Map map = this.parent.Map; int num = Find.WorldGrid.TraversalDistanceBetween(map.Tile, destinationTile, true, int.MaxValue); if (num > this.MaxLaunchDistance) { return; } this.Transporter.TryRemoveLord(map); int groupId = this.Transporter.groupID; float amount = Mathf.Max(CompLaunchableSRTS.FuelNeededToLaunchAtDist((float)num), 1f); CompTransporter comp1 = this.FuelingPortSource.TryGetComp <CompTransporter>(); Building fuelingPortSource = this.FuelingPortSource; if (fuelingPortSource != null) { fuelingPortSource.TryGetComp <CompRefuelable>().ConsumeFuel(amount); } ThingOwner directlyHeldThings = comp1.GetDirectlyHeldThings(); // Neceros Edit Thing thing = ThingMaker.MakeThing(ThingDef.Named(parent.def.defName), (ThingDef)null); thing.SetFactionDirect(Faction.OfPlayer); thing.Rotation = this.FuelingPortSource.Rotation; CompRefuelable comp2 = thing.TryGetComp <CompRefuelable>(); comp2.GetType().GetField("fuel", BindingFlags.Instance | BindingFlags.NonPublic).SetValue((object)comp2, (object)fuelingPortSource.TryGetComp <CompRefuelable>().Fuel); comp2.TargetFuelLevel = fuelingPortSource.TryGetComp <CompRefuelable>().TargetFuelLevel; thing.stackCount = 1; directlyHeldThings.TryAddOrTransfer(thing, true); // Neceros Edit ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDef.Named(parent.def.defName + "_Active"), null); activeDropPod.Contents = new ActiveDropPodInfo(); activeDropPod.Contents.innerContainer.TryAddRangeOrTransfer((IEnumerable <Thing>)directlyHeldThings, true, true); // Neceros Edit SRTSLeaving srtsLeaving = (SRTSLeaving)SkyfallerMaker.MakeSkyfaller(ThingDef.Named(parent.def.defName + "_Leaving"), (Thing)activeDropPod); srtsLeaving.rotation = this.FuelingPortSource.Rotation; srtsLeaving.groupID = groupId; srtsLeaving.destinationTile = destinationTile; srtsLeaving.arrivalAction = arrivalAction; comp1.CleanUpLoadingVars(map); IntVec3 position = fuelingPortSource.Position; SRTSStatic.SRTSDestroy((Thing)fuelingPortSource, DestroyMode.Vanish); GenSpawn.Spawn((Thing)srtsLeaving, position, map, WipeMode.Vanish); CameraJumper.TryHideWorld(); } else { int num = Find.WorldGrid.TraversalDistanceBetween(this.carr.Tile, destinationTile, true, int.MaxValue); if (num > this.MaxLaunchDistance) { return; } float amount = Mathf.Max(CompLaunchableSRTS.FuelNeededToLaunchAtDist((float)num), 1f); if (this.FuelingPortSource != null) { this.FuelingPortSource.TryGetComp <CompRefuelable>().ConsumeFuel(amount); } ThingOwner <Pawn> directlyHeldThings = (ThingOwner <Pawn>)cafr.GetDirectlyHeldThings(); Thing thing = null; foreach (Pawn pawn in directlyHeldThings.InnerListForReading) { Pawn_InventoryTracker inventory = pawn.inventory; for (int index = 0; index < inventory.innerContainer.Count; ++index) { // Neceros Edit if (inventory.innerContainer[index].TryGetComp <CompLaunchableSRTS>() != null) { thing = inventory.innerContainer[index]; inventory.innerContainer[index].holdingOwner.Remove(inventory.innerContainer[index]); break; } } } /*Add caravan items to SRTS - SmashPhil */ foreach (Pawn p in directlyHeldThings.InnerListForReading) { p.inventory.innerContainer.InnerListForReading.ForEach(x => AddThingsToSRTS(x)); p.inventory.innerContainer.Clear(); } ThingOwner <Thing> thingOwner = new ThingOwner <Thing>(); foreach (Pawn pawn in directlyHeldThings.AsEnumerable <Pawn>().ToList <Pawn>()) { thingOwner.TryAddOrTransfer((Thing)pawn, true); } if (thing != null && thing.holdingOwner == null) { thingOwner.TryAddOrTransfer(thing, false); } // Neceros Edit ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDef.Named(parent.def.defName + "_Active"), (ThingDef)null); activeDropPod.Contents = new ActiveDropPodInfo(); activeDropPod.Contents.innerContainer.TryAddRangeOrTransfer((IEnumerable <Thing>)thingOwner, true, true); activeDropPod.Contents.innerContainer.TryAddRangeOrTransfer((IEnumerable <Thing>)thingsInsideShip, true, true); thingsInsideShip.Clear(); cafr.RemoveAllPawns(); if (cafr.Spawned) { Find.WorldObjects.Remove((WorldObject)cafr); } TravelingTransportPods travelingTransportPods = (TravelingTransportPods)WorldObjectMaker.MakeWorldObject(DefDatabase <WorldObjectDef> .GetNamed("TravelingSRTS", true)); travelingTransportPods.Tile = cafr.Tile; travelingTransportPods.SetFaction(Faction.OfPlayer); travelingTransportPods.destinationTile = destinationTile; travelingTransportPods.arrivalAction = arrivalAction; Find.WorldObjects.Add((WorldObject)travelingTransportPods); travelingTransportPods.AddPod(activeDropPod.Contents, true); activeDropPod.Contents = (ActiveDropPodInfo)null; activeDropPod.Destroy(DestroyMode.Vanish); Find.WorldTargeter.StopTargeting(); } } }
private void TryLaunchBombRun(int destTile, Pair <IntVec3, IntVec3> targetPoints, IEnumerable <IntVec3> bombCells, MapParent mapParent) { if (!this.parent.Spawned) { Log.Error("Tried to launch " + this.parent + ", but it's unspawned."); return; } if (!CompLauncher.LoadingInProgressOrReadyToLaunch || !CompLauncher.AllInGroupConnectedToFuelingPort || !CompLauncher.AllFuelingPortSourcesInGroupHaveAnyFuel) { return; } Map map = this.parent.Map; int num = Find.WorldGrid.TraversalDistanceBetween(map.Tile, destTile); if (num > CompLauncher.MaxLaunchDistance) { return; } CompLauncher.Transporter.TryRemoveLord(map); int groupID = CompLauncher.Transporter.groupID; float amount = Mathf.Max(CompLaunchableSRTS.FuelNeededToLaunchAtDist((float)num, this.parent.GetComp <CompLaunchableSRTS>().BaseFuelPerTile), 1f); CompTransporter comp1 = CompLauncher.FuelingPortSource.TryGetComp <CompTransporter>(); Building fuelPortSource = CompLauncher.FuelingPortSource; if (fuelPortSource != null) { fuelPortSource.TryGetComp <CompRefuelable>().ConsumeFuel(amount); } ThingOwner directlyHeldThings = comp1.GetDirectlyHeldThings(); Thing thing = ThingMaker.MakeThing(ThingDef.Named(parent.def.defName), null); thing.SetFactionDirect(Faction.OfPlayer); thing.Rotation = CompLauncher.FuelingPortSource.Rotation; CompRefuelable comp2 = thing.TryGetComp <CompRefuelable>(); comp2.GetType().GetField("fuel", BindingFlags.Instance | BindingFlags.NonPublic).SetValue((object)comp2, (object)fuelPortSource.TryGetComp <CompRefuelable>().Fuel); comp2.TargetFuelLevel = fuelPortSource.TryGetComp <CompRefuelable>().TargetFuelLevel; thing.stackCount = 1; directlyHeldThings.TryAddOrTransfer(thing, true); ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDef.Named(parent.def.defName + "_Active"), null); activeDropPod.Contents = new ActiveDropPodInfo(); activeDropPod.Contents.innerContainer.TryAddRangeOrTransfer((IEnumerable <Thing>)directlyHeldThings, true, true); SRTSLeaving srtsLeaving = (SRTSLeaving)SkyfallerMaker.MakeSkyfaller(ThingDef.Named(parent.def.defName + "_Leaving"), (Thing)activeDropPod); srtsLeaving.rotation = CompLauncher.FuelingPortSource.Rotation; srtsLeaving.groupID = groupID; srtsLeaving.destinationTile = destTile; srtsLeaving.arrivalAction = new SRTSArrivalActionBombRun(mapParent, targetPoints, bombCells, this.bombType, map, CompLauncher.FuelingPortSource.Position); comp1.CleanUpLoadingVars(map); IntVec3 position = fuelPortSource.Position; SRTSStatic.SRTSDestroy((Thing)fuelPortSource, DestroyMode.Vanish); GenSpawn.Spawn((Thing)srtsLeaving, position, map, WipeMode.Vanish); CameraJumper.TryHideWorld(); }
private bool ChoseWorldTarget(GlobalTargetInfo target) { if (this.carr == null && !this.LoadingInProgressOrReadyToLaunch) { return(true); } if (!target.IsValid) { Messages.Message("MessageTransportPodsDestinationIsInvalid".Translate(), MessageTypeDefOf.RejectInput, false); return(false); } int num = Find.WorldGrid.TraversalDistanceBetween(this.carr != null ? this.carr.Tile : this.parent.Map.Tile, target.Tile, true, int.MaxValue); if (num > this.MaxLaunchDistance) { Messages.Message("MessageTransportPodsDestinationIsTooFar".Translate(CompLaunchableSRTS.FuelNeededToLaunchAtDist((float)num, this.BaseFuelPerTile).ToString("0.#")), MessageTypeDefOf.RejectInput, false); return(false); } if ((Find.WorldGrid[target.Tile].biome.impassable || Find.World.Impassable(target.Tile)) && (!SRTSHelper.SOS2ModLoaded || target.WorldObject?.def?.defName != "ShipOrbiting")) { Messages.Message("MessageTransportPodsDestinationIsInvalid".Translate(), MessageTypeDefOf.RejectInput, false); return(false); } if (SRTSHelper.SOS2ModLoaded && target.WorldObject?.def?.defName == "ShipOrbiting") { if (!SRTSMod.GetStatFor <bool>(this.parent.def.defName, StatName.spaceFaring)) { Messages.Message("NonSpaceFaringSRTS".Translate(parent.def.defName), MessageTypeDefOf.RejectInput, false); return(false); } if (SRTSMod.GetStatFor <bool>(parent.def.defName, StatName.shuttleBayLanding)) { IntVec3 shuttleBayPos = (IntVec3)AccessTools.Method(type: SRTSHelper.SOS2LaunchableType, "FirstShuttleBayOpen").Invoke(null, new object[] { (target.WorldObject as MapParent).Map }); if (shuttleBayPos == IntVec3.Zero) { Messages.Message("NeedOpenShuttleBay".Translate(), MessageTypeDefOf.RejectInput); return(false); } this.TryLaunch(target.Tile, new TransportPodsArrivalAction_LandInSpecificCell((target.WorldObject as MapParent).Map.Parent, shuttleBayPos)); return(true); } } Find.WorldObjects.MapParentAt(target.Tile); IEnumerable <FloatMenuOption> floatMenuOptionsAt = this.GetTransportPodsFloatMenuOptionsAt(target.Tile, this.carr); if (!floatMenuOptionsAt.Any <FloatMenuOption>()) { if (Find.WorldGrid[target.Tile].biome.impassable || Find.World.Impassable(target.Tile)) { Messages.Message("MessageTransportPodsDestinationIsInvalid".Translate(), MessageTypeDefOf.RejectInput, false); return(false); } this.TryLaunch(target.Tile, (TransportPodsArrivalAction)null, (Caravan)null); return(true); } if (floatMenuOptionsAt.Count <FloatMenuOption>() == 1) { if (!floatMenuOptionsAt.First <FloatMenuOption>().Disabled) { floatMenuOptionsAt.First <FloatMenuOption>().action(); } return(false); } Find.WindowStack.Add((Window) new FloatMenu(floatMenuOptionsAt.ToList <FloatMenuOption>())); return(false); }