Ejemplo n.º 1
0
        /// <summary>
        /// Returns the distance from which the grid can be spotted by Radar via active detection.
        /// </summary>
        public static float GetBaseDetectionDistance(this IMyCubeGrid Grid)
        {
            try
            {
                float Distance = RadarCore.VisibilityDistanceByDefaultRule(Grid);
                if (Distance == 0)
                {
                    return(0);
                }

                List <IMyDecoy> Decoys = new List <IMyDecoy>();
                Grid.GetTerminalSystem().GetBlocksOfType(Decoys, x => x.IsWorking);
                if (Decoys.Count == 0)
                {
                    return(Distance);
                }

                return(Distance / (float)Math.Pow(RadarCore.DecoyStealthCoefficient, Decoys.Count));
            }
            catch (Exception Scrap)
            {
                Grid.LogError("GetBaseDetectionDistance", Scrap);
                return(0);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns overall distance from which the entity can be spotted by Radar.
 /// </summary>
 public static float GetDetectionRate(this IMyEntity Entity)
 {
     return(RadarCore.VisibilityDistanceByDefaultRule(Entity));
 }