示例#1
0
        private static FloatMenuOption GotoLocationOption(IntVec3 clickCell, Pawn pawn)
        {
            int     num = GenRadial.NumCellsInRadius(2.9f);
            IntVec3 curLoc;

            for (int i = 0; i < num; i++)
            {
                curLoc = GenRadial.RadialPattern[i] + clickCell;
                if (curLoc.Standable(pawn.Map))
                {
                    if (curLoc != pawn.Position)
                    {
                        if (!pawn.CanReach(curLoc, PathEndMode.OnCell, Danger.Deadly, false, TraverseMode.ByPawn))
                        {
                            return(new FloatMenuOption("CannotGoNoPath".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null));
                        }
                        Action action = delegate
                        {
                            IntVec3 intVec = RCellFinder.BestOrderedGotoDestNear(curLoc, pawn);
                            Job     job    = new Job(JobDefOf.Goto, intVec);
                            if (pawn.Map.exitMapGrid.IsExitCell(UI.MouseCell()))
                            {
                                job.exitMapOnArrival = true;
                            }
                            if (pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc))
                            {
                                MoteMaker.MakeStaticMote(intVec, pawn.Map, ThingDefOf.Mote_FeedbackGoto, 1f);
                            }
                        };
                        FloatMenuOption floatMenuOption = new FloatMenuOption("GoHere".Translate(), action, MenuOptionPriority.GoHere, null, null, 0f, null, null);
                        floatMenuOption.autoTakeable = true;
                        return(floatMenuOption);
                    }
                    return(null);
                }
            }
            return(null);
        }