From 5f22bfdbd360feb13406889cf0f8243d26f4dbe1 Mon Sep 17 00:00:00 2001 From: tuntematonjr Date: Wed, 7 Aug 2024 21:39:54 +0300 Subject: [PATCH 1/3] Additional parameters - added parameters to allow changing distances for sounds for each severity. - added parameter to allow unconscious units to do sounds. --- .../functions/fnc_playInjuredSound.sqf | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/medical_feedback/functions/fnc_playInjuredSound.sqf b/addons/medical_feedback/functions/fnc_playInjuredSound.sqf index c278e6e08ae..237315dbc71 100644 --- a/addons/medical_feedback/functions/fnc_playInjuredSound.sqf +++ b/addons/medical_feedback/functions/fnc_playInjuredSound.sqf @@ -8,6 +8,9 @@ * 0: Unit * 1: Type (optional) ["hit" (default) or "moan"] * 2: Severity (optional) [0 (default), 1, 2] + * 3: Hit sound distances (optional) [50, 60, 70] (default) + * 4: Moan sound distances (optional) [10, 15, 20] (default) + * 5: Allow unconscious units (optional) (default: false) * * Return Value: * None @@ -20,18 +23,18 @@ #define TIME_OUT_HIT 1 #define TIME_OUT_MOAN [12, 7.5, 5] -params [["_unit", objNull, [objNull]], ["_type", "hit", [""]], ["_severity", 0, [0]]]; +params [["_unit", objNull, [objNull]], ["_type", "hit", [""]], ["_severity", 0, [0]], ["_hitDistances", [50, 60, 70], [[]],[3]], ["_moanDistances", [10, 15, 20], [[]],[3]], ["_allowUnconscious", false, [true]]]; // TRACE_3("",_unit,_type,_severity); if (!local _unit) exitWith { ERROR_2("playInjuredSound: Unit not local or null [%1:%2]",_unit,typeOf _unit); }; -if !(_unit call EFUNC(common,isAwake)) exitWith {}; +if !(_unit call EFUNC(common,isAwake) && _allowUnconscious) exitWith {}; // Limit network traffic by only sending the event to players who can potentially hear it private _distance = if (_type == "hit") then { - [50, 60, 70] select _severity; + _hitDistances select _severity; } else { - [10, 15, 20] select _severity; + _moanDistances select _severity; }; private _targets = allPlayers inAreaArray [ASLToAGL getPosASL _unit, _distance, _distance, 0, false, _distance]; if (_targets isEqualTo []) exitWith {}; From 39b552cb00e8068bc4b25f4f2dde27eb625fc79e Mon Sep 17 00:00:00 2001 From: tuntematonjr Date: Thu, 8 Aug 2024 17:42:05 +0300 Subject: [PATCH 2/3] fix conditio --- addons/medical_feedback/functions/fnc_playInjuredSound.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_feedback/functions/fnc_playInjuredSound.sqf b/addons/medical_feedback/functions/fnc_playInjuredSound.sqf index 237315dbc71..ad41a71e73e 100644 --- a/addons/medical_feedback/functions/fnc_playInjuredSound.sqf +++ b/addons/medical_feedback/functions/fnc_playInjuredSound.sqf @@ -28,7 +28,7 @@ params [["_unit", objNull, [objNull]], ["_type", "hit", [""]], ["_severity", 0, if (!local _unit) exitWith { ERROR_2("playInjuredSound: Unit not local or null [%1:%2]",_unit,typeOf _unit); }; -if !(_unit call EFUNC(common,isAwake) && _allowUnconscious) exitWith {}; +if (!(_unit call EFUNC(common,isAwake)) && !_allowUnconscious) exitWith {}; // Limit network traffic by only sending the event to players who can potentially hear it private _distance = if (_type == "hit") then { From 7c732993fc3be5bf906925e23421d0e14a098b7e Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Fri, 9 Aug 2024 22:01:16 +0200 Subject: [PATCH 3/3] Updated header formatting + minor tweaks --- .../functions/fnc_playInjuredSound.sqf | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/medical_feedback/functions/fnc_playInjuredSound.sqf b/addons/medical_feedback/functions/fnc_playInjuredSound.sqf index ad41a71e73e..b33b533e25f 100644 --- a/addons/medical_feedback/functions/fnc_playInjuredSound.sqf +++ b/addons/medical_feedback/functions/fnc_playInjuredSound.sqf @@ -6,11 +6,11 @@ * * Arguments: * 0: Unit - * 1: Type (optional) ["hit" (default) or "moan"] - * 2: Severity (optional) [0 (default), 1, 2] - * 3: Hit sound distances (optional) [50, 60, 70] (default) - * 4: Moan sound distances (optional) [10, 15, 20] (default) - * 5: Allow unconscious units (optional) (default: false) + * 1: Type ["hit", "moan"] (default: "hit") + * 2: Severity [0, 1, 2] (default: 0) + * 3: Hit sound distances (default: [50, 60, 70]) + * 4: Moan sound distances (default: [10, 15, 20]) + * 5: Allow unconscious units (default: false) * * Return Value: * None @@ -23,18 +23,18 @@ #define TIME_OUT_HIT 1 #define TIME_OUT_MOAN [12, 7.5, 5] -params [["_unit", objNull, [objNull]], ["_type", "hit", [""]], ["_severity", 0, [0]], ["_hitDistances", [50, 60, 70], [[]],[3]], ["_moanDistances", [10, 15, 20], [[]],[3]], ["_allowUnconscious", false, [true]]]; +params [["_unit", objNull, [objNull]], ["_type", "hit", [""]], ["_severity", 0, [0]], ["_hitDistances", [50, 60, 70], [[]], [3]], ["_moanDistances", [10, 15, 20], [[]], [3]], ["_allowUnconscious", false, [true]]]; // TRACE_3("",_unit,_type,_severity); if (!local _unit) exitWith { ERROR_2("playInjuredSound: Unit not local or null [%1:%2]",_unit,typeOf _unit); }; -if (!(_unit call EFUNC(common,isAwake)) && !_allowUnconscious) exitWith {}; +if (!_allowUnconscious && {!(_unit call EFUNC(common,isAwake))}) exitWith {}; // Limit network traffic by only sending the event to players who can potentially hear it private _distance = if (_type == "hit") then { - _hitDistances select _severity; + _hitDistances select _severity } else { - _moanDistances select _severity; + _moanDistances select _severity }; private _targets = allPlayers inAreaArray [ASLToAGL getPosASL _unit, _distance, _distance, 0, false, _distance]; if (_targets isEqualTo []) exitWith {};