public static float GetAdjustedSensorRange(AbstractActor source, ICombatant target)
        {
            EWState sourceState       = source.GetEWState();
            float   sourceSensorRange = SensorLockHelper.GetSensorsRange(source);
            float   targetSignature   = SensorLockHelper.GetTargetSignature(target, sourceState);
            //LowVisibility.Logger.Debug($"   source:{CombatantUtils.Label(source)} sensorRange:{sourceSensorRange}m vs targetSignature:x{targetSignature}");

            //if (target != null && source.VisibilityToTargetUnit(target) > VisibilityLevel.None) {
            //    // If is sensor lock, add the Hysterisis modifier
            //    signatureModifiedRange += ___Combat.Constants.Visibility.SensorHysteresisAdditive;
            //}

            float modifiedRange = sourceSensorRange * targetSignature;

            return(modifiedRange);
        }
Exemple #2
0
        public static int UpdateSensorCheck(AbstractActor actor, bool updateAuras)
        {
            int checkResult = ModState.GetCheckResult();

            actor.StatCollection.Set <int>(ModStats.CurrentRoundEWCheck, checkResult);
            Mod.Log.Debug?.Write($"Actor:{CombatantUtils.Label(actor)} has raw EW Check: {checkResult}");

            if (updateAuras && actor.StatCollection.ContainsStatistic(ModStats.CAESensorsRange))
            {
                float sensorsRange = SensorLockHelper.GetSensorsRange(actor);
                actor.StatCollection.Set <float>(ModStats.CAESensorsRange, sensorsRange);

                // TODO: Re-enable once KMission has researched
                actor.UpdateAuras(false);
            }

            return(checkResult);
        }