public override FloatMenuAcceptanceReport StillValid(IEnumerable <IThingHolder> pods, int destinationTile)
        {
            FloatMenuAcceptanceReport floatMenuAcceptanceReport = base.StillValid(pods, destinationTile);

            if (!floatMenuAcceptanceReport)
            {
                return(floatMenuAcceptanceReport);
            }
            if (this.caravan != null && !Find.WorldGrid.IsNeighborOrSame(this.caravan.Tile, destinationTile))
            {
                return(false);
            }
            return(ByakheeArrivalAction_GiveToCaravan.CanGiveTo(pods, this.caravan));
        }
Пример #2
0
        //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;
        }
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(CompLaunchablePawn representative, IEnumerable <IThingHolder> pods, Caravan caravan)
 {
     return(ByakheeArrivalActionUtility.GetFloatMenuOptions <ByakheeArrivalAction_GiveToCaravan>(() => ByakheeArrivalAction_GiveToCaravan.CanGiveTo(pods, caravan), () => new ByakheeArrivalAction_GiveToCaravan(caravan), "GiveToCaravan".Translate(caravan.Label), representative, caravan.Tile, null));
 }