mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Settings Category, Minor Cleanup
This commit is contained in:
parent
698b934801
commit
749425dfb7
@ -1,19 +1,23 @@
|
||||
class ACE_Settings {
|
||||
class GVAR(EnableCombatDeafness) {
|
||||
category = CSTRING(Module_DisplayName);
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
displayName = CSTRING(EnableCombatDeafness_DisplayName);
|
||||
description = CSTRING(EnableCombatDeafness_Description);
|
||||
};
|
||||
class GVAR(EarplugsVolume) {
|
||||
category = CSTRING(Module_DisplayName);
|
||||
value = 0.5;
|
||||
typeName = "SCALAR";
|
||||
};
|
||||
class GVAR(UnconsciousnessVolume) {
|
||||
category = CSTRING(Module_DisplayName);
|
||||
value = 0.4;
|
||||
typeName = "SCALAR";
|
||||
};
|
||||
class GVAR(DisableEarRinging) {
|
||||
category = CSTRING(Module_DisplayName);
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
isClientSettable = 1;
|
||||
@ -21,12 +25,14 @@ class ACE_Settings {
|
||||
description = CSTRING(DisableEarRinging_Description);
|
||||
};
|
||||
class GVAR(enabledForZeusUnits) {
|
||||
category = CSTRING(Module_DisplayName);
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
displayName = CSTRING(enabledForZeusUnits_DisplayName);
|
||||
description = CSTRING(enabledForZeusUnits_Description);
|
||||
};
|
||||
class GVAR(autoAddEarplugsToUnits) {
|
||||
category = CSTRING(Module_DisplayName);
|
||||
value = 1;
|
||||
typeName = "BOOL";
|
||||
displayName = CSTRING(autoAddEarplugsToUnits_DisplayName);
|
||||
|
@ -12,6 +12,10 @@ GVAR(playerVehAttenuation) = 1;
|
||||
GVAR(time3) = 0;
|
||||
|
||||
["SettingsInitialized", {
|
||||
TRACE_1("settingInit",GVAR(EnableCombatDeafness));
|
||||
// Only run if combat deafness is enabled
|
||||
if (!GVAR(EnableCombatDeafness)) exitWith {};
|
||||
|
||||
// Spawn volume updating process
|
||||
[FUNC(updateVolume), 1, [false]] call CBA_fnc_addPerFrameHandler;
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -1,10 +1,9 @@
|
||||
/*
|
||||
* Author: KoffeinFlummi, commy2, Rocko, Rommel, Ruthberg
|
||||
* Ear ringing PFH
|
||||
* Handle new sound souce near player and apply hearing damage
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit <OBJECT>
|
||||
* 1: strength of ear ringing (Number between 0 and 1) <NUMBER>
|
||||
* 0: strength of ear ringing (Number between 0 and 1) <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -15,9 +14,8 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
params ["_unit", "_strength"];
|
||||
params ["_strength"];
|
||||
|
||||
if (_unit != ACE_player) exitWith {};
|
||||
if (_strength < 0.05) exitWith {};
|
||||
if (!isNull curatorCamera) exitWith {};
|
||||
if ((!GVAR(enabledForZeusUnits)) && {player != ACE_player}) exitWith {};
|
||||
@ -27,9 +25,9 @@ if (_unit getVariable ["ACE_hasEarPlugsin", false]) then {
|
||||
};
|
||||
|
||||
//headgear hearing protection
|
||||
if(headgear _unit != "") then {
|
||||
if (headgear _unit != "") then {
|
||||
private _protection = (getNumber (configFile >> "CfgWeapons" >> (headgear _unit) >> QGVAR(protection))) min 1;
|
||||
if(_protection > 0) then {
|
||||
if (_protection > 0) then {
|
||||
_strength = _strength * (1 - _protection);
|
||||
};
|
||||
};
|
||||
|
@ -30,4 +30,4 @@ _strength = (0 max _damage) * 30;
|
||||
if (_strength < 0.01) exitWith {};
|
||||
|
||||
// Call inmediately, as it will get pick up later anyway by the update thread
|
||||
[ACE_player, _strength] call FUNC(earRinging);
|
||||
[_strength] call FUNC(earRinging);
|
||||
|
@ -98,4 +98,4 @@ TRACE_1("result",_strength);
|
||||
if (_strength < 0.01) exitWith {};
|
||||
|
||||
// Call inmediately, as it will get pick up later anyway by the update thread
|
||||
[ACE_player, _strength] call FUNC(earRinging);
|
||||
[_strength] call FUNC(earRinging);
|
||||
|
@ -16,12 +16,8 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Only run if combat deafness is enabled
|
||||
if (!GVAR(EnableCombatDeafness)) exitWith {};
|
||||
|
||||
(_this select 0) params ["_justUpdateVolume"];
|
||||
|
||||
|
||||
GVAR(deafnessDV) = (GVAR(deafnessDV) min 20) max 0;
|
||||
GVAR(volume) = (1 - (GVAR(deafnessDV) / 20)) max 0.05;
|
||||
TRACE_3("",GVAR(volume),GVAR(deafnessDV),GVAR(deafnessDV) - GVAR(deafnessPrior));
|
||||
@ -46,7 +42,7 @@ if (!_justUpdateVolume) then {
|
||||
GVAR(deafnessDV) = (GVAR(deafnessDV) - (0.5 * (GVAR(volume) max 0.1))) max 0;
|
||||
};
|
||||
|
||||
if ((missionNameSpace getVariable [QGVAR(disableVolumeUpdate), false]) || {!GVAR(enableCombatDeafness)}) exitWith {};
|
||||
if (missionNameSpace getVariable [QGVAR(disableVolumeUpdate), false]) exitWith {};
|
||||
|
||||
private _volume = GVAR(volume);
|
||||
|
||||
@ -56,10 +52,9 @@ if ([ACE_player] call FUNC(hasEarPlugsIn)) then {
|
||||
};
|
||||
|
||||
// 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 {
|
||||
if (headgear ACE_player != "") then {
|
||||
private _lowerVolume = (getNumber (configFile >> "CfgWeapons" >> (headgear ACE_player) >> QGVAR(lowerVolume))) min 1;
|
||||
if (_lowerVolume > 0) then {
|
||||
_volume = _volume min (1 - _lowerVolume);
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user