From 0c479859af4b07bf2dca50eb1ee8e02b2a573536 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 16 Feb 2017 10:16:46 -0600 Subject: [PATCH] Hide earplug actions if setting disabled (#4913) * Hide earplug actions if setting disabled * Add lines that are new --- addons/hearing/CfgVehicles.hpp | 4 ++-- addons/hearing/functions/fnc_putInEarplugs.sqf | 2 ++ addons/hearing/functions/fnc_removeEarplugs.sqf | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/hearing/CfgVehicles.hpp b/addons/hearing/CfgVehicles.hpp index 760ed95a03e..f44e50e6d03 100644 --- a/addons/hearing/CfgVehicles.hpp +++ b/addons/hearing/CfgVehicles.hpp @@ -5,7 +5,7 @@ class CfgVehicles { class ACE_Equipment { class ACE_PutInEarplugs { displayName = CSTRING(EarPlugs_On); - condition = QUOTE( !([_player] call FUNC(hasEarPlugsIn)) && {'ACE_EarPlugs' in items _player} ); + condition = QUOTE(GVAR(EnableCombatDeafness) && {!([_player] call FUNC(hasEarPlugsIn)) && {'ACE_EarPlugs' in items _player}}); exceptions[] = {"isNotInside", "isNotSitting"}; statement = QUOTE( [_player] call FUNC(putInEarPlugs) ); showDisabled = 0; @@ -14,7 +14,7 @@ class CfgVehicles { }; class ACE_RemoveEarplugs { displayName = CSTRING(EarPlugs_Off); - condition = QUOTE( [_player] call FUNC(hasEarPlugsIn) ); + condition = QUOTE( GVAR(EnableCombatDeafness) && {[_player] call FUNC(hasEarPlugsIn)}); exceptions[] = {"isNotInside", "isNotSitting"}; statement = QUOTE( [_player] call FUNC(removeEarPlugs) ); showDisabled = 0; diff --git a/addons/hearing/functions/fnc_putInEarplugs.sqf b/addons/hearing/functions/fnc_putInEarplugs.sqf index 90fe8d62ace..4075a982db8 100644 --- a/addons/hearing/functions/fnc_putInEarplugs.sqf +++ b/addons/hearing/functions/fnc_putInEarplugs.sqf @@ -17,6 +17,8 @@ params ["_player"]; +if (!GVAR(EnableCombatDeafness)) exitWith {}; + // Plugs in inventory, putting them in _player removeItem "ACE_EarPlugs"; diff --git a/addons/hearing/functions/fnc_removeEarplugs.sqf b/addons/hearing/functions/fnc_removeEarplugs.sqf index 3154230ecf4..20bc7b8dcc1 100644 --- a/addons/hearing/functions/fnc_removeEarplugs.sqf +++ b/addons/hearing/functions/fnc_removeEarplugs.sqf @@ -17,6 +17,8 @@ params ["_player"]; +if (!GVAR(EnableCombatDeafness)) exitWith {}; + if !(_player canAdd "ACE_EarPlugs") exitWith { // inventory full [localize LSTRING(Inventory_Full)] call EFUNC(common,displayTextStructured); };