public override string GetInspectString()
        {
            if (DebugSettings.godMode)
            {
                string workString = base.GetInspectString();

                if (Position != null && Position != IntVec3.Invalid &&
                    rechargeStation != null && rechargeStation.Position != null && rechargeStation.Position != IntVec3.Invalid)
                {
                    if (!workString.NullOrEmpty())
                    {
                        workString += "\n";
                    }
                    workString += "Distance to base: " + AIRobot_Helper.GetDistance(Position, rechargeStation.Position).ToString("0") + " cells";
                    workString += " -- Remaining charge: " + needs.rest.CurLevel.ToStringPercent();
                }
                return(workString);
            }
            return(base.GetInspectString());
        }
        public override string GetInspectString()
        {
            string workString = base.GetInspectString();

            if (DebugSettings.godMode)
            {
                if (Position != null && Position != IntVec3.Invalid &&
                    rechargeStation != null && rechargeStation.Position != null && rechargeStation.Position != IntVec3.Invalid)
                {
                    if (!workString.NullOrEmpty())
                    {
                        workString += "\n";
                    }
                    workString += "Distance to base: " + AIRobot_Helper.GetDistance(Position, rechargeStation.Position).ToString("0") + " cells";
                    workString += " -- ";
                    workString += "AIRobot_Battery".Translate() + " " + needs.rest.CurLevel.ToStringPercent();
                }
            }
            else
            {
                if (!workString.NullOrEmpty())
                {
                    workString += "\n";
                }
                workString += "AIRobot_Battery".Translate() + " " + needs.rest.CurLevel.ToStringPercent();
            }

            if (isSleepModeActive)
            {
                if (!workString.NullOrEmpty())
                {
                    workString += "\n";
                }
                workString += "AIRobot_SleepMode".Translate();
            }
            return(workString.TrimEndNewlines());
        }
        public override float GetPriority(Pawn pawn)
        {
            if (pawn == null || pawn.needs == null)
            {
                return(0f);
            }

            Need_Rest needRest = pawn.needs.rest;

            if (needRest == null)
            {
                return(0f);
            }

            float             curLevel          = needRest.CurLevel;
            TimeAssignmentDef timeAssignmentDef = (pawn.timetable != null ? pawn.timetable.CurrentAssignment : TimeAssignmentDefOf.Anything);

            if (timeAssignmentDef == TimeAssignmentDefOf.Anything || timeAssignmentDef == TimeAssignmentDefOf.Work)
            {
                if ((pawn as X2_AIRobot) == null || (pawn as X2_AIRobot).rechargeStation == null || (pawn as X2_AIRobot).rechargeStation.Position == null)
                {
                    return(0f);
                }

                double distance = AIRobot_Helper.GetDistance(pawn.Position, (pawn as X2_AIRobot).rechargeStation.Position);

                // Own implementation: When level < 45% && dist > 25
                bool isOutsideMaxDistance = distance > 25f;
                if (curLevel < 0.40f && pawn as X2_AIRobot != null && isOutsideMaxDistance)
                {
                    return(8f);
                }

                //// Own implementation: When level < 70% && idle
                //bool isInsideCloseCallRange = distance < 15f && distance > 0f;
                //if (curLevel < 0.70f && pawn as X2_AIRobot != null && isInsideCloseCallRange &&
                //        (pawn.CurJobDef == null || pawn.CurJobDef == JobDefOf.Wait_Wander || pawn.CurJobDef == JobDefOf.GotoWander || pawn.CurJobDef == JobDefOf.Wait))
                //    return 8f;

                if (curLevel < 0.25f)
                {
                    return(8f);
                }

                return(0f);
            }
            if (timeAssignmentDef == TimeAssignmentDefOf.Joy)
            {
                if (curLevel < 0.3f)
                {
                    return(8f);
                }

                return(0f);
            }
            if (timeAssignmentDef == TimeAssignmentDefOf.Sleep)
            {
                if (curLevel < 0.75f)
                {
                    return(8f);
                }

                return(0f);
            }
            return(0f);
        }