mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical Feedback - Set volume and radio usage based current unit (#7529)
This commit is contained in:
parent
e1f6db8a69
commit
1a2487d61f
@ -17,36 +17,38 @@
|
||||
* Note: Uses player
|
||||
*/
|
||||
|
||||
#define MUTED_LEVEL 0.2
|
||||
#define MUTED_LEVEL 0.2
|
||||
#define NORMAL_LEVEL 1
|
||||
#define NO_SOUND 0
|
||||
#define NO_SOUND 0
|
||||
|
||||
params [["_setVolume", false]];
|
||||
params [
|
||||
["_setVolume", false],
|
||||
["_unit", player]
|
||||
];
|
||||
|
||||
if (_setVolume) then {
|
||||
// Vanilla Game
|
||||
2 fadeSound NORMAL_LEVEL;
|
||||
|
||||
// TFAR
|
||||
player setVariable ["tf_voiceVolume", NORMAL_LEVEL, true];
|
||||
player setVariable ["tf_globalVolume", NORMAL_LEVEL];
|
||||
player setVariable ["tf_unable_to_use_radio", false];
|
||||
_unit setVariable ["tf_voiceVolume", NORMAL_LEVEL, true];
|
||||
_unit setVariable ["tf_globalVolume", NORMAL_LEVEL];
|
||||
_unit setVariable ["tf_unable_to_use_radio", false];
|
||||
|
||||
// ACRE2
|
||||
if (!isNil "acre_api_fnc_setGlobalVolume") then { [NORMAL_LEVEL^0.33] call acre_api_fnc_setGlobalVolume; };
|
||||
player setVariable ["acre_sys_core_isDisabled", false, true];
|
||||
_unit setVariable ["acre_sys_core_isDisabled", false, true];
|
||||
|
||||
} else {
|
||||
// Vanilla Game
|
||||
2 fadeSound MUTED_LEVEL;
|
||||
|
||||
// TFAR
|
||||
player setVariable ["tf_voiceVolume", NO_SOUND, true];
|
||||
player setVariable ["tf_globalVolume", MUTED_LEVEL];
|
||||
player setVariable ["tf_unable_to_use_radio", true];
|
||||
_unit setVariable ["tf_voiceVolume", NO_SOUND, true];
|
||||
_unit setVariable ["tf_globalVolume", MUTED_LEVEL];
|
||||
_unit setVariable ["tf_unable_to_use_radio", true];
|
||||
|
||||
// ACRE2
|
||||
if (!isNil "acre_api_fnc_setGlobalVolume") then { [MUTED_LEVEL^0.33] call acre_api_fnc_setGlobalVolume; };
|
||||
player setVariable ["acre_sys_core_isDisabled", true, true];
|
||||
|
||||
_unit setVariable ["acre_sys_core_isDisabled", true, true];
|
||||
};
|
||||
|
@ -43,14 +43,7 @@ GVAR(bloodTickCounter) = 0;
|
||||
ACE_player switchCamera "INTERNAL";
|
||||
};
|
||||
|
||||
// Toggle unconscious player's ability to talk in radio addons
|
||||
if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {
|
||||
_unit setVariable ["tf_voiceVolume", [1, 0] select _unconscious, true];
|
||||
_unit setVariable ["tf_unable_to_use_radio", _unconscious]; // Only used locally
|
||||
};
|
||||
if (["acre_main"] call EFUNC(common,isModLoaded)) then {
|
||||
_unit setVariable ["acre_sys_core_isDisabled", _unconscious, true];
|
||||
};
|
||||
[!_unconscious, _unit] call EFUNC(common,setVolume);
|
||||
|
||||
// Greatly reduce player's hearing ability while unconscious (affects radio addons)
|
||||
[QUOTE(ADDON), VOL_UNCONSCIOUS, _unconscious] call EFUNC(common,setHearingCapability);
|
||||
@ -64,13 +57,9 @@ GVAR(bloodTickCounter) = 0;
|
||||
params ["_unit"];
|
||||
|
||||
if (_unit != ACE_player) exitWith {};
|
||||
if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {
|
||||
_unit setVariable ["tf_voiceVolume", 1, true];
|
||||
_unit setVariable ["tf_unable_to_use_radio", false];
|
||||
};
|
||||
if (["acre_main"] call EFUNC(common,isModLoaded)) then {
|
||||
_unit setVariable ["acre_sys_core_isDisabled", false, true];
|
||||
};
|
||||
// Players always able to hear for any systems that might run while dead (e.g. spectator)
|
||||
[true, _unit] call EFUNC(common,setVolume);
|
||||
|
||||
[QUOTE(ADDON), 1, false] call EFUNC(common,setHearingCapability);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
@ -79,13 +68,8 @@ GVAR(bloodTickCounter) = 0;
|
||||
params ["_new"];
|
||||
private _status = IS_UNCONSCIOUS(_new);
|
||||
|
||||
if (["task_force_radio"] call EFUNC(common,isModLoaded)) then {
|
||||
_new setVariable ["tf_voiceVolume", [1, 0] select _status, true];
|
||||
_new setVariable ["tf_unable_to_use_radio", _status];
|
||||
};
|
||||
if (["acre_main"] call EFUNC(common,isModLoaded)) then {
|
||||
_new setVariable ["acre_sys_core_isDisabled", _status, true];
|
||||
};
|
||||
[!_status, _new] call EFUNC(common,setVolume);
|
||||
|
||||
[QUOTE(ADDON), VOL_UNCONSCIOUS, _status] call EFUNC(common,setHearingCapability);
|
||||
[true] call FUNC(handleEffects);
|
||||
["unconscious", _status] call EFUNC(common,setDisableUserInputStatus);
|
||||
|
Loading…
Reference in New Issue
Block a user