Browse Source

remove continue, invert to use not equals and else

m3ales 3 years ago
parent
commit
d1e270afe7
1 changed files with 11 additions and 9 deletions
  1. 11 9
      addons - Copy/RD501_Main/functions/jammer/fnc_jammersClientPFH.sqf

+ 11 - 9
addons - Copy/RD501_Main/functions/jammer/fnc_jammersClientPFH.sqf

@@ -30,17 +30,19 @@ private _interference = 1;
 			private _d = _distance/_radius;
 			private _specificSignal =  1/(1 + ((_d/(1 -_d)) ^ -2.3));
 			private _specificInterference = _strength * (1 - _specificSignal) * _interferenceFactor;
-			if(_interference == 1) then {
+			if(_interference != 1) then {
+				_interference = _interference max _specificInterference;
+				if(_interference < 1) then {
+					_interference = 1; //prevent 0 from being final value
+				};
+				if(_interference > _strength) then {
+					_interference = _strength; // prevent tfar from being exposed to 1.6e^24 when distance is null
+				};
+			}
+			else
+			{
 				_interference = _specificInterference;
-				continue;
-			};
-			_interference = _interference max _specificInterference;
-			if(_interference < 1) then {
-				_interference = 1; //prevent 0 from being final value
 			};
-			if(_interference > _strength) then {
-				_interference = _strength; // prevent tfar from being exposed to 1.6e^24 when distance is null
-			}
 		};
 	};
 } forEach _jammers;