Skip to content

Commit

Permalink
Copy remaining functionality and docs from earplugs
Browse files Browse the repository at this point in the history
  • Loading branch information
BaerMitUmlaut committed Nov 3, 2024
1 parent a9d7d4b commit abb6926
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 1 deletion.
8 changes: 8 additions & 0 deletions addons/fieldmanual/CfgHints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ class CfgHints {
description = CSTRING(Items_EarPlugs_Description);
tip = "<a href='https://ace3.acemod.org/wiki/feature/hearing'>Hearing Wiki</a>";
};
class ACE_EHP: ACE_FieldManual_Base {
logicalOrder = 10;
arguments[] = {BASE_ARGUMENTS, QUOTE('ACE_EHP' call FUNC(getItemName))};
displayName = "%14";
displayNameShort = CSTRING(Items_EHP_ShortName);
description = CSTRING(Items_EHP_Description);
tip = "<a href='https://ace3.acemod.org/wiki/feature/hearing'>Hearing Wiki</a>";
};
class ACE_EntrenchingTool: ACE_FieldManual_Base {
logicalOrder = 11;
arguments[] = {BASE_ARGUMENTS, QUOTE('ACE_EntrenchingTool' call FUNC(getItemName))};
Expand Down
10 changes: 10 additions & 0 deletions addons/hearing/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,60 +48,70 @@ class CfgVehicles {
class Box_NATO_Support_F: NATO_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_EarPlugs,12);
MACRO_ADDITEM(ACE_EHP,12);
};
};

class B_supplyCrate_F: ReammoBox_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarPlugs,12);
MACRO_ADDITEM(ACE_EHP,12);
};
};

class Box_East_Support_F: EAST_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_EarPlugs,12);
MACRO_ADDITEM(ACE_EHP,12);
};
};

class O_supplyCrate_F: B_supplyCrate_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarPlugs,12);
MACRO_ADDITEM(ACE_EHP,12);
};
};

class Box_IND_Support_F: IND_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_EarPlugs,12);
MACRO_ADDITEM(ACE_EHP,12);
};
};

class Box_FIA_Support_F: FIA_Box_Base_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarPlugs,12);
MACRO_ADDITEM(ACE_EHP,12);
};
};

class I_supplyCrate_F: B_supplyCrate_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarPlugs,12);
MACRO_ADDITEM(ACE_EHP,12);
};
};

class IG_supplyCrate_F: ReammoBox_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarPlugs,12);
MACRO_ADDITEM(ACE_EHP,12);
};
};

class C_supplyCrate_F: ReammoBox_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarPlugs,12);
MACRO_ADDITEM(ACE_EHP,12);
};
};

class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarPlugs,12);
MACRO_ADDITEM(ACE_EHP,12);
};
};

Expand Down
13 changes: 13 additions & 0 deletions addons/hearing/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ PREP_RECOMPILE_END;
[QGVAR(updateVolume), true, _unit] call CBA_fnc_targetEvent;
};
};

if (_extendedInfo getOrDefault ["ace_ehp", false]) then {
_unit setVariable ["ACE_hasEHP", true, true];

// Only force update volume if unit is a player (including remote controlled)
if (_unit call EFUNC(common,isPlayer)) then {
[QGVAR(updateVolume), true, _unit] call CBA_fnc_targetEvent;
};
};
}] call CBA_fnc_addEventHandler;

["CBA_loadoutGet", {
Expand All @@ -27,6 +36,10 @@ PREP_RECOMPILE_END;
if (_unit getVariable ["ACE_hasEarPlugsIn", false]) then {
_extendedInfo set ["ace_earplugs", true]
};

if (_unit getVariable ["ACE_hasEHP", false]) then {
_extendedInfo set ["ace_ehp", true]
};
}] call CBA_fnc_addEventHandler;

ADDON = true;
2 changes: 1 addition & 1 deletion addons/hearing/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {"ACE_EarPlugs"};
weapons[] = {"ACE_EarPlugs", "ACE_EHP"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"};
author = ECSTRING(common,ACETeam);
Expand Down
19 changes: 19 additions & 0 deletions addons/hearing/initKeybinds.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,22 @@

false // return
}] call CBA_fnc_addKeybind; // UNBOUND

["ACE3 Equipment", QGVAR(putOrRemoveEHP), LLSTRING(PutOrRemoveEHP), {
// Conditions: specific
if !([ACE_player, objNull, ["isNotSwimming", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false};

if ([ACE_player] call FUNC(canPutOnEHP)) exitWith {
[ACE_player, true] call FUNC(putOnEHP);

true // return
};

if (GVAR(enableCombatDeafness) && {ACE_player getVariable ["ACE_hasEHP", false]}) exitWith {
[ACE_player, true] call FUNC(removeEHP);

true // return
};

false // return
}] call CBA_fnc_addKeybind; // UNBOUND
4 changes: 4 additions & 0 deletions addons/hearing/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@
<English>Electronic Hearing Protection taken off</English>
<German>Elektronischer Gehörschutz abgesetzt</German>
</Key>
<Key ID="STR_ACE_Hearing_PutOrRemoveEHP">
<English>Put on/take off Electronic Hearing Protection</English>
<German>Elektronischer Gehörschutz aufsetzen/absetzen</German>
</Key>
<Key ID="STR_ACE_Hearing_unconsciousnessVolume_DisplayName">
<English>Unconscious Volume</English>
<German>Lautstärke Bewusstlosigkeit</German>
Expand Down
1 change: 1 addition & 0 deletions docs/wiki/class-names.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ ACE_gunbag_Tan | Gunbag | Backpack |
Class Name | In-Game Name | Type |
---------- | --------- | ---------
ACE_EarPlugs | Earplugs | ACE_ItemCore |
ACE_EHP | Electronic Hearing Protection | ACE_ItemCore |

### HuntIR
`Added in 3.1.1`
Expand Down

0 comments on commit abb6926

Please sign in to comment.