mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Overhaul ACE_Hearing and change default settings.
This commit is contained in:
parent
d69af47030
commit
2f1e96ae4f
@ -2,8 +2,8 @@ class ACE_Settings {
|
|||||||
class GVAR(EnableCombatDeafness) {
|
class GVAR(EnableCombatDeafness) {
|
||||||
value = 1;
|
value = 1;
|
||||||
typeName = "BOOL";
|
typeName = "BOOL";
|
||||||
displayName = CSTRING(CombatDeafness_DisplayName);
|
displayName = CSTRING(EnableCombatDeafness_DisplayName);
|
||||||
description = CSTRING(CombatDeafness_Description);
|
description = CSTRING(EnableCombatDeafness_Description);
|
||||||
};
|
};
|
||||||
class GVAR(EarplugsVolume) {
|
class GVAR(EarplugsVolume) {
|
||||||
value = 0.5;
|
value = 0.5;
|
||||||
@ -17,7 +17,8 @@ class ACE_Settings {
|
|||||||
value = 0;
|
value = 0;
|
||||||
typeName = "BOOL";
|
typeName = "BOOL";
|
||||||
isClientSettable = 1;
|
isClientSettable = 1;
|
||||||
displayName = CSTRING(DisableEarRinging);
|
displayName = CSTRING(DisableEarRinging_DisplayName);
|
||||||
|
description = CSTRING(DisableEarRinging_Description);
|
||||||
};
|
};
|
||||||
class GVAR(enabledForZeusUnits) {
|
class GVAR(enabledForZeusUnits) {
|
||||||
value = 1;
|
value = 1;
|
||||||
|
@ -11,9 +11,21 @@ class CfgSounds {
|
|||||||
sound[] = {QUOTE(PATHTOF(sounds\ACE_earringing_heavy.wav)),8,1.7};
|
sound[] = {QUOTE(PATHTOF(sounds\ACE_earringing_heavy.wav)),8,1.7};
|
||||||
titles[] = {};
|
titles[] = {};
|
||||||
};
|
};
|
||||||
class ACE_Combat_Deafness {
|
class ACE_Combat_Deafness_Heavy {
|
||||||
|
sound[] = {QUOTE(PATHTOF(sounds\deafness.ogg)),8,1};
|
||||||
|
titles[] = {};
|
||||||
|
};
|
||||||
|
class ACE_Combat_Deafness_Medium {
|
||||||
sound[] = {QUOTE(PATHTOF(sounds\deafness.ogg)),3,1};
|
sound[] = {QUOTE(PATHTOF(sounds\deafness.ogg)),3,1};
|
||||||
titles[] = {};
|
titles[] = {};
|
||||||
|
};
|
||||||
|
class ACE_Combat_Deafness_Heavy_NoRing {
|
||||||
|
sound[] = {QUOTE(PATHTOF(sounds\deafness_noring.ogg)),8,1};
|
||||||
|
titles[] = {};
|
||||||
|
};
|
||||||
|
class ACE_Combat_Deafness_Medium_NoRing {
|
||||||
|
sound[] = {QUOTE(PATHTOF(sounds\deafness_noring.ogg)),3,1};
|
||||||
|
titles[] = {};
|
||||||
};
|
};
|
||||||
class ACE_Ring_Backblast {
|
class ACE_Ring_Backblast {
|
||||||
sound[] = {QUOTE(PATHTOF(sounds\backblast_ring.ogg)),1,1};
|
sound[] = {QUOTE(PATHTOF(sounds\backblast_ring.ogg)),1,1};
|
||||||
|
@ -103,13 +103,14 @@ class CfgVehicles {
|
|||||||
icon = PATHTOF(UI\Icon_Module_Hearing_ca.paa);
|
icon = PATHTOF(UI\Icon_Module_Hearing_ca.paa);
|
||||||
class Arguments {
|
class Arguments {
|
||||||
class EnableCombatDeafness {
|
class EnableCombatDeafness {
|
||||||
displayName = CSTRING(CombatDeafness_DisplayName);
|
displayName = CSTRING(EnableCombatDeafness_DisplayName);
|
||||||
description = CSTRING(CombatDeafness_Description);
|
description = CSTRING(EnableCombatDeafness_Description);
|
||||||
typeName = "BOOL";
|
typeName = "BOOL";
|
||||||
defaultValue = 1;
|
defaultValue = 1;
|
||||||
};
|
};
|
||||||
class DisableEarRinging {
|
class DisableEarRinging {
|
||||||
displayName = CSTRING(DisableEarRinging);
|
displayName = CSTRING(DisableEarRinging_DisplayName);
|
||||||
|
description = CSTRING(DisableEarRinging_Description);
|
||||||
typeName = "NUMBER";
|
typeName = "NUMBER";
|
||||||
class values {
|
class values {
|
||||||
class DoNotForce {
|
class DoNotForce {
|
||||||
|
@ -9,12 +9,7 @@ GVAR(deafnessDV) = 0;
|
|||||||
GVAR(deafnessPrior) = 0;
|
GVAR(deafnessPrior) = 0;
|
||||||
GVAR(volume) = 1;
|
GVAR(volume) = 1;
|
||||||
GVAR(playerVehAttenuation) = 1;
|
GVAR(playerVehAttenuation) = 1;
|
||||||
|
|
||||||
GVAR(beep) = false;
|
|
||||||
GVAR(beep2) = false;
|
|
||||||
GVAR(time2) = 0;
|
|
||||||
GVAR(time3) = 0;
|
GVAR(time3) = 0;
|
||||||
GVAR(time4) = 0;
|
|
||||||
|
|
||||||
["SettingsInitialized", {
|
["SettingsInitialized", {
|
||||||
// Spawn volume updating process
|
// Spawn volume updating process
|
||||||
@ -30,10 +25,5 @@ GVAR(time4) = 0;
|
|||||||
GVAR(deafnessDV) = 0;
|
GVAR(deafnessDV) = 0;
|
||||||
GVAR(deafnessPrior) = 0;
|
GVAR(deafnessPrior) = 0;
|
||||||
ACE_player setVariable [QGVAR(deaf), false];
|
ACE_player setVariable [QGVAR(deaf), false];
|
||||||
|
|
||||||
GVAR(beep) = false;
|
|
||||||
GVAR(beep2) = false;
|
|
||||||
GVAR(time2) = 0;
|
|
||||||
GVAR(time3) = 0;
|
GVAR(time3) = 0;
|
||||||
GVAR(time4) = 0;
|
|
||||||
}] call EFUNC(common,addEventhandler);
|
}] call EFUNC(common,addEventhandler);
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
//Only run if deafness or ear ringing is enabled:
|
// Only run if combat deafness is enabled
|
||||||
if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
|
if (!GVAR(EnableCombatDeafness)) exitWith {};
|
||||||
|
|
||||||
params ["_unit", "_damage"];
|
params ["_unit", "_damage"];
|
||||||
|
|
||||||
@ -29,4 +29,5 @@ private ["_strength"];
|
|||||||
_strength = (0 max _damage) * 30;
|
_strength = (0 max _damage) * 30;
|
||||||
if (_strength < 0.01) exitWith {};
|
if (_strength < 0.01) exitWith {};
|
||||||
|
|
||||||
[{_this call FUNC(earRinging)}, [_unit, _strength], 0.2] call EFUNC(common,waitAndExecute);
|
// Call inmediately, as it will get pick up later anyway by the update thread
|
||||||
|
[ACE_player, _strength] call FUNC(earRinging);
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
//Only run if deafness or ear ringing is enabled:
|
// Only run if combat deafness is enabled
|
||||||
if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
|
if (!GVAR(EnableCombatDeafness)) exitWith {};
|
||||||
|
|
||||||
params ["_object", "_firer", "_distance", "_weapon", "", "", "_ammo"];
|
params ["_object", "_firer", "_distance", "_weapon", "", "", "_ammo"];
|
||||||
|
|
||||||
@ -97,4 +97,5 @@ TRACE_1("result",_strength);
|
|||||||
|
|
||||||
if (_strength < 0.01) exitWith {};
|
if (_strength < 0.01) exitWith {};
|
||||||
|
|
||||||
[{_this call FUNC(earRinging)}, [ACE_player, _strength], 0.2] call EFUNC(common,waitAndExecute);
|
// Call inmediately, as it will get pick up later anyway by the update thread
|
||||||
|
[ACE_player, _strength] call FUNC(earRinging);
|
||||||
|
@ -12,13 +12,12 @@
|
|||||||
|
|
||||||
params ["_logic"];
|
params ["_logic"];
|
||||||
|
|
||||||
[_logic, QGVAR(enableCombatDeafness), "EnableCombatDeafness"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(EnableCombatDeafness), "EnableCombatDeafness"] call EFUNC(common,readSettingFromModule);
|
||||||
|
|
||||||
// Do Not Force - read module setting only non-default is set due to using SCALAR
|
// Do Not Force - read module setting only non-default is set due to using SCALAR
|
||||||
if ((_logic getVariable "DisableEarRinging") != -1) then {
|
if ((_logic getVariable "DisableEarRinging") != -1) then {
|
||||||
[_logic, QGVAR(DisableEarRinging), "DisableEarRinging"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(DisableEarRinging), "DisableEarRinging"] call EFUNC(common,readSettingFromModule);
|
||||||
};
|
};
|
||||||
|
|
||||||
[_logic, QGVAR(enabledForZeusUnits), "enabledForZeusUnits"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(enabledForZeusUnits), "enabledForZeusUnits"] call EFUNC(common,readSettingFromModule);
|
||||||
[_logic, QGVAR(autoAddEarplugsToUnits), "autoAddEarplugsToUnits"] call EFUNC(common,readSettingFromModule);
|
[_logic, QGVAR(autoAddEarplugsToUnits), "autoAddEarplugsToUnits"] call EFUNC(common,readSettingFromModule);
|
||||||
ACE_LOGINFO("Hearing Module Initialized.");
|
ACE_LOGINFO("Hearing Module Initialized.");
|
||||||
|
@ -16,54 +16,32 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
//Only run if deafness or ear ringing is enabled:
|
// Only run if combat deafness is enabled
|
||||||
if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
|
if (!GVAR(EnableCombatDeafness)) exitWith {};
|
||||||
|
|
||||||
(_this select 0) params ["_justUpdateVolume"];
|
(_this select 0) params ["_justUpdateVolume"];
|
||||||
|
|
||||||
|
|
||||||
GVAR(deafnessDV) = (GVAR(deafnessDV) min 20) max 0;
|
GVAR(deafnessDV) = (GVAR(deafnessDV) min 20) max 0;
|
||||||
GVAR(volume) = (1 - (GVAR(deafnessDV) / 20)) max 0;
|
GVAR(volume) = (1 - (GVAR(deafnessDV) / 20)) max 0.05;
|
||||||
|
player sideChat format ["Vol: %1, Def: %2, DeltaDef: %3", GVAR(volume), GVAR(deafnessDV), GVAR(deafnessDV) - GVAR(deafnessPrior)];
|
||||||
|
|
||||||
if (!_justUpdateVolume) then {
|
if (!_justUpdateVolume) then {
|
||||||
//If we got a big increase in the last second:
|
// Ring if we got a big increase in the last second or enough accumulated damage
|
||||||
if ((GVAR(deafnessDV) - GVAR(deafnessPrior)) > 2) then {
|
if (GVAR(deafnessDV) - GVAR(deafnessPrior) > 1 ||
|
||||||
if (ACE_time > GVAR(time3)) then {
|
GVAR(deafnessDV) > 10) then {
|
||||||
GVAR(beep2) = false;
|
|
||||||
};
|
if (ACE_time - GVAR(time3) < 3) exitWith {};
|
||||||
if ((!GVAR(DisableEarRinging)) && {!GVAR(beep2)}) then {
|
GVAR(time3) = ACE_time;
|
||||||
playSound "ACE_Combat_Deafness";
|
|
||||||
GVAR(beep2) = true;
|
if (GVAR(deafnessDV) > 19.75) then {
|
||||||
GVAR(time3) = ACE_time + 5;
|
playSound (["ACE_Combat_Deafness_Heavy", "ACE_Combat_Deafness_Heavy_NoRing"] select GVAR(DisableEarRinging));
|
||||||
|
} else {
|
||||||
|
playSound (["ACE_Combat_Deafness_Medium", "ACE_Combat_Deafness_Medium_NoRing"] select GVAR(DisableEarRinging));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(deafnessPrior) = GVAR(deafnessDV);
|
GVAR(deafnessPrior) = GVAR(deafnessDV);
|
||||||
|
|
||||||
if (GVAR(deafnessDV) > 19.75) then {
|
|
||||||
ACE_player setVariable [QGVAR(deaf), true];
|
|
||||||
if ((!GVAR(DisableEarRinging)) && {ACE_time > GVAR(time4)}) then {
|
|
||||||
playSound "ACE_Combat_Deafness";
|
|
||||||
GVAR(beep2) = true;
|
|
||||||
GVAR(time3) = ACE_time + 10;
|
|
||||||
GVAR(time4) = ACE_time + 30;
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
ACE_player setVariable [QGVAR(deaf), false];
|
|
||||||
};
|
|
||||||
|
|
||||||
if (GVAR(deafnessDV) > 10) then {
|
|
||||||
//check if the ringing is already being played
|
|
||||||
if (ACE_time > GVAR(time2)) then {
|
|
||||||
GVAR(beep) = false;
|
|
||||||
};
|
|
||||||
if ((!GVAR(DisableEarRinging)) && {!GVAR(beep)}) then {
|
|
||||||
playSound "ACE_Ring_Backblast";
|
|
||||||
GVAR(time2) = ACE_time + 22;
|
|
||||||
GVAR(beep) = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Hearing takes longer to return to normal after it hits rock bottom
|
// Hearing takes longer to return to normal after it hits rock bottom
|
||||||
GVAR(deafnessDV) = (GVAR(deafnessDV) - (0.5 * (GVAR(volume) max 0.1))) max 0;
|
GVAR(deafnessDV) = (GVAR(deafnessDV) - (0.5 * (GVAR(volume) max 0.1))) max 0;
|
||||||
};
|
};
|
||||||
|
BIN
addons/hearing/sounds/deafness_noring.ogg
Normal file
BIN
addons/hearing/sounds/deafness_noring.ogg
Normal file
Binary file not shown.
@ -97,7 +97,7 @@
|
|||||||
<Hungarian>Nincs több hely</Hungarian>
|
<Hungarian>Nincs több hely</Hungarian>
|
||||||
<Russian>Нет места в инвентаре</Russian>
|
<Russian>Нет места в инвентаре</Russian>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Hearing_DisableEarRinging">
|
<Key ID="STR_ACE_Hearing_DisableEarRinging_DisplayName">
|
||||||
<English>Disable ear ringing</English>
|
<English>Disable ear ringing</English>
|
||||||
<French>Désactiver le bourdonnement</French>
|
<French>Désactiver le bourdonnement</French>
|
||||||
<Spanish>Desactivar zumbido de oídos</Spanish>
|
<Spanish>Desactivar zumbido de oídos</Spanish>
|
||||||
@ -108,6 +108,8 @@
|
|||||||
<Hungarian>Fülcsengés letiltása</Hungarian>
|
<Hungarian>Fülcsengés letiltása</Hungarian>
|
||||||
<Italian>Disabilita i fischi nelle orecchie</Italian>
|
<Italian>Disabilita i fischi nelle orecchie</Italian>
|
||||||
<Portuguese>Desabilitar zumbido de ouvidos</Portuguese>
|
<Portuguese>Desabilitar zumbido de ouvidos</Portuguese>
|
||||||
|
<Key ID="STR_ACE_Hearing_DisableEarRinging_Description">
|
||||||
|
<English>Remove tinnitus effect when the player takes hearing damage</English>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Hearing_Module_DisplayName">
|
<Key ID="STR_ACE_Hearing_Module_DisplayName">
|
||||||
<English>Hearing</English>
|
<English>Hearing</English>
|
||||||
@ -120,10 +122,10 @@
|
|||||||
<Hungarian>Hallás</Hungarian>
|
<Hungarian>Hallás</Hungarian>
|
||||||
<Russian>Слух</Russian>
|
<Russian>Слух</Russian>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Hearing_CombatDeafness_DisplayName">
|
<Key ID="STR_ACE_Hearing_EnableCombatDeafness_DisplayName">
|
||||||
<English>Combat Deafness</English>
|
<English>Enable Combat Deafness</English>
|
||||||
<Polish>Wł. głuchotę bojową</Polish>
|
<Polish>Wł. głuchotę bojową</Polish>
|
||||||
<Spanish>¿Habilitar sordera de combate?</Spanish>
|
<Spanish>Habilitar sordera de combate</Spanish>
|
||||||
<German>Aktiviere Taubheit im Gefecht?</German>
|
<German>Aktiviere Taubheit im Gefecht?</German>
|
||||||
<Czech>Povolit ztrátu sluchu?</Czech>
|
<Czech>Povolit ztrátu sluchu?</Czech>
|
||||||
<Portuguese>Ativar surdez em combate?</Portuguese>
|
<Portuguese>Ativar surdez em combate?</Portuguese>
|
||||||
@ -131,7 +133,7 @@
|
|||||||
<Hungarian>Harci süketség engedélyezése?</Hungarian>
|
<Hungarian>Harci süketség engedélyezése?</Hungarian>
|
||||||
<Russian>Оглушение</Russian>
|
<Russian>Оглушение</Russian>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Hearing_CombatDeafness_Description">
|
<Key ID="STR_ACE_Hearing_EnableCombatDeafness_Description">
|
||||||
<English>Reduces the hearing ability as the player takes hearing damage</English>
|
<English>Reduces the hearing ability as the player takes hearing damage</English>
|
||||||
<Polish>Możliwość chwilowej utraty słuchu przy głośnych wystrzałach i jednoczesnym braku włożonych stoperów</Polish>
|
<Polish>Możliwość chwilowej utraty słuchu przy głośnych wystrzałach i jednoczesnym braku włożonych stoperów</Polish>
|
||||||
<Spanish>Habilita la sordera de combate</Spanish>
|
<Spanish>Habilita la sordera de combate</Spanish>
|
||||||
|
Loading…
Reference in New Issue
Block a user