From d9722db15ef66ea001816e64bf894a40dbf63c81 Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 13 Jun 2015 18:42:09 +0200 Subject: [PATCH] Abort if distance > 50m --- addons/hearing/functions/fnc_firedNear.sqf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/hearing/functions/fnc_firedNear.sqf b/addons/hearing/functions/fnc_firedNear.sqf index fc8bee97e5..889b04d24d 100644 --- a/addons/hearing/functions/fnc_firedNear.sqf +++ b/addons/hearing/functions/fnc_firedNear.sqf @@ -30,10 +30,11 @@ if (!GVAR(enableCombatDeafness)) exitWith {}; //Only run if firedNear object is player or player's vehicle: if ((ACE_player != _object) && {(vehicle ACE_player) != _object}) exitWith {}; if (_weapon in ["Throw", "Put"]) exitWith {}; +if (_distance > 50) exitWith {}; _vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)}; -if (_distance < 1) then {_distance = 1;}; +_distance = 1 max _distance; _silencer = switch (_weapon) do { case (primaryWeapon _firer) : {(primaryWeaponItems _firer) select 0}; @@ -81,7 +82,7 @@ _caliber = switch (true) do { _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) * _audibleFireCoef / 5; _strength = _vehAttenuation * (_loudness - (_loudness / 50 * _distance)); // linear drop off -//systemChat format["%1 : %2 : %3", _strength, _initSpeed, _parentClasses]; +systemChat format["%1 : %2 : %3", _strength, _initSpeed, _parentClasses]; //systemChat format["%1 : %2 : %3", _weapon, _magazine, _initSpeed]; if (_strength < 0.01) exitWith {};