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

            if (!floatMenuAcceptanceReport)
            {
                return(floatMenuAcceptanceReport);
            }
            if (this.mapParent != null && this.mapParent.Tile != destinationTile)
            {
                return(false);
            }
            return(SRTSArrivalActionBombRun.CanBombSpecificCell(pods, this.mapParent));
        }
Beispiel #2
0
        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);
        }