headgear influence on hearing

This commit is contained in:
SzwedzikPL 2015-07-01 21:21:09 +02:00
parent 319e50a9cc
commit 6b4eeedbad
6 changed files with 66 additions and 8 deletions

View File

@ -12,4 +12,39 @@ class CfgWeapons {
mass = 1;
};
};
class H_HelmetB;
class H_HelmetCrew_B: H_HelmetB {
GVAR(protection) = 1;
GVAR(lowerVolume) = 0.80;
};
class H_HelmetCrew_0: H_HelmetCrew_B {};
class H_HelmetCrew_I: H_HelmetCrew_B {};
class H_CrewHelmetHeli_B: H_HelmetB {
GVAR(protection) = 0.75;
GVAR(lowerVolume) = 0.70;
};
class H_CrewHelmetHeli_O: H_CrewHelmetHeli_B {};
class H_CrewHelmetHeli_I: H_CrewHelmetHeli_B {};
class H_PilotHelmetHeli_B: H_HelmetB {
GVAR(protection) = 0.75;
GVAR(lowerVolume) = 0.70;
};
class H_PilotHelmetHeli_O: H_PilotHelmetHeli_B {};
class H_PilotHelmetHeli_I: H_PilotHelmetHeli_B {};
class H_PilotHelmetFighter_B: H_HelmetB {
GVAR(protection) = 1;
GVAR(lowerVolume) = 0.80;
};
class H_PilotHelmetFighter_O: H_PilotHelmetFighter_B {};
class H_PilotHelmetFighter_I: H_PilotHelmetFighter_B {};
class H_Cap_headphones: H_HelmetB {
GVAR(protection) = 0.5;
GVAR(lowerVolume) = 0.60;
};
class H_Cap_marshal: H_Cap_headphones {};
};

View File

@ -5,7 +5,7 @@ class CfgPatches {
units[] = {};
weapons[] = {"ACE_EarPlugs"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"};
requiredAddons[] = {"ace_interaction", "A3_Characters_F", "A3_Characters_F_Kart"};
author[] = {"KoffeinFlummi", "esteldunedain", "HopeJ", "commy2", "Rocko", "Rommel", "Ruthberg"};
authorUrl = "https://github.com/KoffeinFlummi/";
VERSION_CONFIG;

View File

@ -27,6 +27,15 @@ if (_unit getVariable ["ACE_hasEarPlugsin", false]) then {
_strength = _strength / 4;
};
//headgear hearing protection
if(headgear _unit != "") then {
private ["_protection"];
_protection = (getNumber (configFile >> "CfgWeapons" >> (headgear _unit) >> QGVAR(protection))) min 1;
if(_protection > 0) then {
_strength = _strength * (1 - _protection);
};
};
_unit setVariable [QGVAR(dv), (_unit getVariable [QGVAR(dv), 0]) + _strength];
if (GVAR(earRingingPFH) != -1) exitWith {};

View File

@ -46,6 +46,15 @@ if ([ACE_player] call FUNC(hasEarPlugsIn)) then {
_volume = _volume min GVAR(EarplugsVolume);
};
// Headgear can reduce hearing
if(headgear ACE_player != "") then {
private ["_lowerVolume"];
_lowerVolume = (getNumber (configFile >> "CfgWeapons" >> (headgear ACE_player) >> QGVAR(lowerVolume))) min 1;
if(_lowerVolume > 0) then {
_volume = _volume min (1 - _lowerVolume);
};
};
// Reduce volume if player is unconscious
if (ACE_player getVariable ["ACE_isUnconscious", false]) then {
_volume = _volume min GVAR(UnconsciousnessVolume);

View File

@ -63,6 +63,8 @@ ace_barrelLength
ace_laserpointer
ace_nextmodeclass
ace_modedescription
ace_hearing_protection
ace_hearing_lowerVolume
```

View File

@ -15,6 +15,9 @@ Introduces hearing damage caused by nearby explosions and large-caliber weapons.
Adds earplugs to mitigate that effect. Soldiers with high caliber weapons or
missile launchers will be equipped with those, but remember to put them in.
### 1.3 Helmets
Some types of helmets can mitigate hearing damage also (ie. crewman helmet, pilot helmet etc.).
## 2. Usage
### 2.1 Equipping earplugs