public static IEnumerable <FloatMenuOption> GetOptionsForTile(int tile, IEnumerable <IThingHolder> pods, Action <int, TransportPodsArrivalAction> launchAction) { bool anything = false; if (TransportPodsArrivalAction_FormCaravan.CanFormCaravanAt(pods, tile) && !Find.WorldObjects.AnySettlementBaseAt(tile) && !Find.WorldObjects.AnySiteAt(tile)) { anything = true; yield return(new FloatMenuOption("FormCaravanHere".Translate(), delegate { launchAction(tile, new TransportPodsArrivalAction_FormCaravan("MessageShuttleArrived")); })); } List <WorldObject> worldObjects = Find.WorldObjects.AllWorldObjects; for (int i = 0; i < worldObjects.Count; i++) { if (worldObjects[i].Tile != tile) { continue; } foreach (FloatMenuOption shuttleFloatMenuOption in worldObjects[i].GetShuttleFloatMenuOptions(pods, launchAction)) { anything = true; yield return(shuttleFloatMenuOption); } } if (!anything && !Find.World.Impassable(tile)) { yield return(new FloatMenuOption("TransportPodsContentsWillBeLost".Translate(), delegate { launchAction(tile, null); })); } }
public IEnumerable <FloatMenuOption> GetTransportPodsFloatMenuOptionsAt(int tile) { bool anything = false; if (TransportPodsArrivalAction_FormCaravan.CanFormCaravanAt(this.TransportersInGroup.Cast <IThingHolder>(), tile) && !Find.WorldObjects.AnySettlementBaseAt(tile) && !Find.WorldObjects.AnySiteAt(tile)) { anything = true; yield return(new FloatMenuOption("FormCaravanHere".Translate(), delegate() { this.TryLaunch(tile, new TransportPodsArrivalAction_FormCaravan()); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } List <WorldObject> worldObjects = Find.WorldObjects.AllWorldObjects; for (int i = 0; i < worldObjects.Count; i++) { if (worldObjects[i].Tile == tile) { foreach (FloatMenuOption o in worldObjects[i].GetTransportPodsFloatMenuOptions(this.TransportersInGroup.Cast <IThingHolder>(), this)) { anything = true; yield return(o); } } } if (!anything && !Find.World.Impassable(tile)) { yield return(new FloatMenuOption("TransportPodsContentsWillBeLost".Translate(), delegate() { this.TryLaunch(tile, null); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } yield break; }
public IEnumerable <FloatMenuOption> GetTransportPodsFloatMenuOptionsAt( int tile, Caravan car = null) { bool anything = false; IEnumerable <IThingHolder> pods = this.TransportersInGroup.Cast <IThingHolder>(); if (car != null) { List <Caravan> rliss = new List <Caravan>(); rliss.Add(car); pods = rliss.Cast <IThingHolder>(); rliss = (List <Caravan>)null; } if (car == null) { if (TransportPodsArrivalAction_FormCaravan.CanFormCaravanAt(pods, tile) && !Find.WorldObjects.AnySettlementBaseAt(tile) && !Find.WorldObjects.AnySiteAt(tile)) { anything = true; yield return(new FloatMenuOption("FormCaravanHere".Translate(), (Action)(() => this.TryLaunch(tile, (TransportPodsArrivalAction) new TransportPodsArrivalAction_FormCaravan(), car)), MenuOptionPriority.Default, (Action)null, (Thing)null, 0.0f, (Func <Rect, bool>)null, (WorldObject)null)); } } else if (!Find.WorldObjects.AnySettlementBaseAt(tile) && !Find.WorldObjects.AnySiteAt(tile) && !Find.World.Impassable(tile)) { anything = true; yield return(new FloatMenuOption("FormCaravanHere".Translate(), (Action)(() => this.TryLaunch(tile, (TransportPodsArrivalAction) new TransportPodsArrivalAction_FormCaravan(), car)), MenuOptionPriority.Default, (Action)null, (Thing)null, 0.0f, (Func <Rect, bool>)null, (WorldObject)null)); } List <WorldObject> worldObjects = Find.WorldObjects.AllWorldObjects; for (int i = 0; i < worldObjects.Count; ++i) { if (worldObjects[i].Tile == tile) { IEnumerable <FloatMenuOption> nowre = SRTSStatic.getFM(worldObjects[i], pods, this, car); if (nowre.ToList <FloatMenuOption>().Count < 1) { yield return(new FloatMenuOption("FormCaravanHere".Translate(), (Action)(() => this.TryLaunch(tile, (TransportPodsArrivalAction) new TransportPodsArrivalAction_FormCaravan(), car)), MenuOptionPriority.Default, (Action)null, (Thing)null, 0.0f, (Func <Rect, bool>)null, (WorldObject)null)); } else { foreach (FloatMenuOption floatMenuOption in nowre) { FloatMenuOption o = floatMenuOption; anything = true; yield return(o); o = (FloatMenuOption)null; } } nowre = (IEnumerable <FloatMenuOption>)null; } } if (!anything && !Find.World.Impassable(tile)) { yield return(new FloatMenuOption("TransportPodsContentsWillBeLost".Translate(), (Action)(() => this.TryLaunch(tile, (TransportPodsArrivalAction)null, (Caravan)null)), MenuOptionPriority.Default, (Action)null, (Thing)null, 0.0f, (Func <Rect, bool>)null, (WorldObject)null)); } }
private void Arrived() { if (!arrived) { arrived = true; if (arrivalAction == null || !(bool)arrivalAction.StillValid(pods.Cast <IThingHolder>(), destinationTile)) { arrivalAction = null; List <Map> maps = Find.Maps; for (int i = 0; i < maps.Count; i++) { if (maps[i].Tile == destinationTile) { if (destinationCell != default(IntVec3)) { arrivalAction = new WorldTransport.TM_TransportPodsArrivalAction_LandAtExactCell(maps[i].Parent, destinationCell, draftFlag); break; } arrivalAction = new TransportPodsArrivalAction_LandInSpecificCell(maps[i].Parent, DropCellFinder.RandomDropSpot(maps[i])); break; } } if (arrivalAction == null) { if (TransportPodsArrivalAction_FormCaravan.CanFormCaravanAt(pods.Cast <IThingHolder>(), destinationTile)) { arrivalAction = new TransportPodsArrivalAction_FormCaravan(); } else { List <Caravan> caravans = Find.WorldObjects.Caravans; for (int j = 0; j < caravans.Count; j++) { if (caravans[j].Tile == destinationTile && (bool)TransportPodsArrivalAction_GiveToCaravan.CanGiveTo(pods.Cast <IThingHolder>(), caravans[j])) { arrivalAction = new TransportPodsArrivalAction_GiveToCaravan(caravans[j]); break; } } } } } if (arrivalAction != null && arrivalAction.ShouldUseLongEvent(pods, destinationTile)) { LongEventHandler.QueueLongEvent(delegate { DoArrivalAction(); }, "GeneratingMapForNewEncounter", false, null); } else { DoArrivalAction(); } } }
public IEnumerable <FloatMenuOption> GetTransportPodsFloatMenuOptionsAt(int tile) { _003CGetTransportPodsFloatMenuOptionsAt_003Ec__Iterator1 _003CGetTransportPodsFloatMenuOptionsAt_003Ec__Iterator = (_003CGetTransportPodsFloatMenuOptionsAt_003Ec__Iterator1) /*Error near IL_003c: stateMachine*/; bool anything = false; if (TransportPodsArrivalAction_FormCaravan.CanFormCaravanAt(TransportersInGroup.Cast <IThingHolder>(), tile) && !Find.WorldObjects.AnySettlementBaseAt(tile) && !Find.WorldObjects.AnySiteAt(tile)) { yield return(new FloatMenuOption("FormCaravanHere".Translate(), delegate { _003CGetTransportPodsFloatMenuOptionsAt_003Ec__Iterator._0024this.TryLaunch(tile, new TransportPodsArrivalAction_FormCaravan()); })); /*Error: Unable to find new state assignment for yield return*/; } List <WorldObject> worldObjects = Find.WorldObjects.AllWorldObjects; for (int i = 0; i < worldObjects.Count; i++) { if (worldObjects[i].Tile == tile) { using (IEnumerator <FloatMenuOption> enumerator = worldObjects[i].GetTransportPodsFloatMenuOptions(TransportersInGroup.Cast <IThingHolder>(), this).GetEnumerator()) { if (enumerator.MoveNext()) { FloatMenuOption o = enumerator.Current; anything = true; yield return(o); /*Error: Unable to find new state assignment for yield return*/; } } } } if (!anything && !Find.World.Impassable(tile)) { yield return(new FloatMenuOption("TransportPodsContentsWillBeLost".Translate(), delegate { _003CGetTransportPodsFloatMenuOptionsAt_003Ec__Iterator._0024this.TryLaunch(tile, null); })); /*Error: Unable to find new state assignment for yield return*/; } yield break; IL_0290: /*Error near IL_0291: Unexpected return in MoveNext()*/; }
private IEnumerable <FloatMenuOption> GetTransportPodsFloatMenuOptionsAt(int tile) { if (parent.TryGetComp <CompShuttle>() != null) { IEnumerable <FloatMenuOption> optionsForTile = GetOptionsForTile(tile, TransportersInGroup.Cast <IThingHolder>(), TryLaunch); foreach (FloatMenuOption item in optionsForTile) { yield return(item); } yield break; } bool anything = false; if (TransportPodsArrivalAction_FormCaravan.CanFormCaravanAt(TransportersInGroup.Cast <IThingHolder>(), tile) && !Find.WorldObjects.AnySettlementBaseAt(tile) && !Find.WorldObjects.AnySiteAt(tile)) { anything = true; yield return(new FloatMenuOption("FormCaravanHere".Translate(), delegate { TryLaunch(tile, new TransportPodsArrivalAction_FormCaravan()); })); } List <WorldObject> worldObjects = Find.WorldObjects.AllWorldObjects; for (int i = 0; i < worldObjects.Count; i++) { if (worldObjects[i].Tile != tile) { continue; } foreach (FloatMenuOption transportPodsFloatMenuOption in worldObjects[i].GetTransportPodsFloatMenuOptions(TransportersInGroup.Cast <IThingHolder>(), this)) { anything = true; yield return(transportPodsFloatMenuOption); } } if (!anything && !Find.World.Impassable(tile)) { yield return(new FloatMenuOption("TransportPodsContentsWillBeLost".Translate(), delegate { TryLaunch(tile, null); })); } }
//RimWorld 1.0 //public void StartChoosingDestination() //{ // CameraJumper.TryJump(CameraJumper.GetWorldTarget(parent)); // Find.WorldSelector.ClearSelection(); // var tile = parent.Map.Tile; // Find.WorldTargeter.BeginTargeting(ChoseWorldTarget, true, TargeterMouseAttachment, true, // delegate { GenDraw.DrawWorldRadiusRing(tile, MaxLaunchDistance); }, delegate(GlobalTargetInfo target) // { // if (!target.IsValid) // { // return null; // } // var num = Find.WorldGrid.TraversalDistanceBetween(tile, target.Tile); // if (num <= MaxLaunchDistance) // { // return null; // } // return num > maxTileDistance // ? (string) "TransportPodDestinationBeyondMaximumRange".Translate() // : (string) "TransportPodNotEnoughFuel".Translate(); // }); //} private IEnumerable <FloatMenuOption> GetTransportPodsFloatMenuOptionsAt(int tile) { bool anything = false; if (TransportPodsArrivalAction_FormCaravan.CanFormCaravanAt(this.TransportersInGroup.Cast <IThingHolder>(), tile) && !Find.WorldObjects.AnySettlementBaseAt(tile) && !Find.WorldObjects.AnySiteAt(tile)) { anything = true; yield return(new FloatMenuOption("FormCaravanHere".Translate(), delegate() { this.TryLaunch(tile, new TransportPodsArrivalAction_FormCaravan()); }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0)); } List <WorldObject> worldObjects = Find.WorldObjects.AllWorldObjects; int num; for (int i = 0; i < worldObjects.Count; i = num + 1) { if (worldObjects[i].Tile == tile) { if (worldObjects[i] is Caravan caravan) { foreach (FloatMenuOption floatMenuOption in ByakheeArrivalAction_GiveToCaravan.GetFloatMenuOptions(this, this.TransportersInGroup.Cast <IThingHolder>(), caravan)) { yield return(floatMenuOption); } } if (worldObjects[i] is Site site) { yield return(new FloatMenuOption("DropAtEdge".Translate(site.Label), delegate { this.TryLaunch(tile, new ByakheeArrivalAction_VisitSite(site, PawnsArrivalModeDefOf.EdgeDrop)); }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0)); yield return(new FloatMenuOption("DropInCenter".Translate(site.Label), delegate { this.TryLaunch(tile, new ByakheeArrivalAction_VisitSite(site, PawnsArrivalModeDefOf.CenterDrop)); }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0)); } if (worldObjects[i] is Settlement settlement) { if (!settlement.Faction.IsPlayer) { yield return(new FloatMenuOption("AttackAndDropAtEdge".Translate(settlement.Label), delegate { this.TryLaunch(tile, new ByakheeArrivalAction_AttackSettlement(settlement, PawnsArrivalModeDefOf.EdgeDrop)); }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0)); yield return(new FloatMenuOption("AttackAndDropInCenter".Translate(settlement.Label), delegate { this.TryLaunch(tile, new ByakheeArrivalAction_AttackSettlement(settlement, PawnsArrivalModeDefOf.CenterDrop)); }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0)); } foreach (FloatMenuOption floatMenuOption in ByakheeArrivalAction_VisitSettlement.GetFloatMenuOptions(this, this.TransportersInGroup.Cast <IThingHolder>(), settlement)) { yield return(floatMenuOption); } //foreach (FloatMenuOption floatMenuOption in ByakheeArrivalAction_AttackSettlement.GetFloatMenuOptions(this, this.TransportersInGroup.Cast<IThingHolder>(), settlement)) //{ // yield return floatMenuOption; //} foreach (FloatMenuOption floatMenuOption in ByakheeArrivalAction_GiveGift.GetFloatMenuOptions(this, this.TransportersInGroup.Cast <IThingHolder>(), settlement)) { yield return(floatMenuOption); } } } num = i; } if (!anything && !Find.World.Impassable(tile)) { yield return(new FloatMenuOption("TransportPodsContentsWillBeLost".Translate(), delegate() { this.TryLaunch(tile, null); }, MenuOptionPriority.Default, null, null, 0f, null, null, true, 0)); } yield break; }
// Token: 0x060028DE RID: 10462 RVA: 0x001354FC File Offset: 0x001338FC public IEnumerable <FloatMenuOption> GetTransportPodsFloatMenuOptionsAt(int tile, Caravan car = null) { bool anything = false; IEnumerable <IThingHolder> pods = this.TransportersInGroup.Cast <IThingHolder>(); if (car != null) { List <Caravan> rliss = new List <Caravan>(); rliss.Add(car); pods = rliss.Cast <IThingHolder>(); } if (car == null) { if (TransportPodsArrivalAction_FormCaravan.CanFormCaravanAt(pods, tile) && !Find.WorldObjects.AnySettlementBaseAt(tile) && !Find.WorldObjects.AnySiteAt(tile)) { anything = true; yield return(new FloatMenuOption("FormCaravanHere".Translate(), delegate { this.TryLaunch(tile, new TransportPodsArrivalAction_FormCaravan(), car); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } else { if (!Find.WorldObjects.AnySettlementBaseAt(tile) && !Find.WorldObjects.AnySiteAt(tile) && !Find.World.Impassable(tile)) { anything = true; yield return(new FloatMenuOption("FormCaravanHere".Translate(), delegate { this.TryLaunch(tile, new TransportPodsArrivalAction_FormCaravan(), car); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } List <WorldObject> worldObjects = Find.WorldObjects.AllWorldObjects; for (int i = 0; i < worldObjects.Count; i++) { if (worldObjects[i].Tile == tile) { IEnumerable <FloatMenuOption> nowre = HelicopterStatic.getFM(worldObjects[i], pods, this, car); if (nowre.ToList().Count < 1) { yield return(new FloatMenuOption("FormCaravanHere".Translate(), delegate { this.TryLaunch(tile, new TransportPodsArrivalAction_FormCaravan(), car); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } else { foreach (FloatMenuOption o in nowre)//worldObjects[i].GetTransportPodsFloatMenuOptions(this.TransportersInGroup.Cast<IThingHolder>(), this)) { anything = true; yield return(o); } } } } if (!anything && !Find.World.Impassable(tile)) { yield return(new FloatMenuOption("TransportPodsContentsWillBeLost".Translate(), delegate { this.TryLaunch(tile, null); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } yield break; }