mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'hearingCleanup' of github.com:KoffeinFlummi/ACE3
Conflicts: addons/hearing/functions/fnc_updateVolume.sqf
This commit is contained in:
commit
eb4ccd9505
@ -4,8 +4,8 @@ class CfgVehicles {
|
|||||||
class ACE_SelfActions {
|
class ACE_SelfActions {
|
||||||
class ACE_Equipment {
|
class ACE_Equipment {
|
||||||
class ACE_PutInEarplugs {
|
class ACE_PutInEarplugs {
|
||||||
displayName = "$STR_ACE_Hearing_Earbuds_On";
|
displayName = "$STR_ACE_Hearing_EarPlugs_On";
|
||||||
condition = QUOTE( !([_player] call FUNC(hasEarPlugsIn)) && {'ACE_EarBuds' in items _player} );
|
condition = QUOTE( !([_player] call FUNC(hasEarPlugsIn)) && {'ACE_EarPlugs' in items _player} );
|
||||||
statement = QUOTE( [_player] call FUNC(putInEarPlugs) );
|
statement = QUOTE( [_player] call FUNC(putInEarPlugs) );
|
||||||
showDisabled = 0;
|
showDisabled = 0;
|
||||||
priority = 2.5;
|
priority = 2.5;
|
||||||
@ -14,7 +14,7 @@ class CfgVehicles {
|
|||||||
enableInside = 1;
|
enableInside = 1;
|
||||||
};
|
};
|
||||||
class ACE_RemoveEarplugs {
|
class ACE_RemoveEarplugs {
|
||||||
displayName = "$STR_ACE_Hearing_Earbuds_Off";
|
displayName = "$STR_ACE_Hearing_EarPlugs_Off";
|
||||||
condition = QUOTE( [_player] call FUNC(hasEarPlugsIn) );
|
condition = QUOTE( [_player] call FUNC(hasEarPlugsIn) );
|
||||||
statement = QUOTE( [_player] call FUNC(removeEarPlugs) );
|
statement = QUOTE( [_player] call FUNC(removeEarPlugs) );
|
||||||
showDisabled = 0;
|
showDisabled = 0;
|
||||||
@ -35,61 +35,61 @@ class CfgVehicles {
|
|||||||
|
|
||||||
class Box_NATO_Support_F: NATO_Box_Base {
|
class Box_NATO_Support_F: NATO_Box_Base {
|
||||||
class TransportItems {
|
class TransportItems {
|
||||||
MACRO_ADDITEM(ACE_EarBuds,12);
|
MACRO_ADDITEM(ACE_EarPlugs,12);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class B_supplyCrate_F: ReammoBox_F {
|
class B_supplyCrate_F: ReammoBox_F {
|
||||||
class TransportItems {
|
class TransportItems {
|
||||||
MACRO_ADDITEM(ACE_EarBuds,12);
|
MACRO_ADDITEM(ACE_EarPlugs,12);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Box_East_Support_F: EAST_Box_Base {
|
class Box_East_Support_F: EAST_Box_Base {
|
||||||
class TransportItems {
|
class TransportItems {
|
||||||
MACRO_ADDITEM(ACE_EarBuds,12);
|
MACRO_ADDITEM(ACE_EarPlugs,12);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class O_supplyCrate_F: B_supplyCrate_F {
|
class O_supplyCrate_F: B_supplyCrate_F {
|
||||||
class TransportItems {
|
class TransportItems {
|
||||||
MACRO_ADDITEM(ACE_EarBuds,12);
|
MACRO_ADDITEM(ACE_EarPlugs,12);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Box_IND_Support_F: IND_Box_Base {
|
class Box_IND_Support_F: IND_Box_Base {
|
||||||
class TransportItems {
|
class TransportItems {
|
||||||
MACRO_ADDITEM(ACE_EarBuds,12);
|
MACRO_ADDITEM(ACE_EarPlugs,12);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Box_FIA_Support_F: FIA_Box_Base_F {
|
class Box_FIA_Support_F: FIA_Box_Base_F {
|
||||||
class TransportItems {
|
class TransportItems {
|
||||||
MACRO_ADDITEM(ACE_EarBuds,12);
|
MACRO_ADDITEM(ACE_EarPlugs,12);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class I_supplyCrate_F: B_supplyCrate_F {
|
class I_supplyCrate_F: B_supplyCrate_F {
|
||||||
class TransportItems {
|
class TransportItems {
|
||||||
MACRO_ADDITEM(ACE_EarBuds,12);
|
MACRO_ADDITEM(ACE_EarPlugs,12);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class IG_supplyCrate_F: ReammoBox_F {
|
class IG_supplyCrate_F: ReammoBox_F {
|
||||||
class TransportItems {
|
class TransportItems {
|
||||||
MACRO_ADDITEM(ACE_EarBuds,12);
|
MACRO_ADDITEM(ACE_EarPlugs,12);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class C_supplyCrate_F: ReammoBox_F {
|
class C_supplyCrate_F: ReammoBox_F {
|
||||||
class TransportItems {
|
class TransportItems {
|
||||||
MACRO_ADDITEM(ACE_EarBuds,12);
|
MACRO_ADDITEM(ACE_EarPlugs,12);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_Box_Misc: Box_NATO_Support_F {
|
class ACE_Box_Misc: Box_NATO_Support_F {
|
||||||
class TransportItems {
|
class TransportItems {
|
||||||
MACRO_ADDITEM(ACE_EarBuds,12);
|
MACRO_ADDITEM(ACE_EarPlugs,12);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ class CfgWeapons {
|
|||||||
class ACE_ItemCore;
|
class ACE_ItemCore;
|
||||||
class InventoryItem_Base_F;
|
class InventoryItem_Base_F;
|
||||||
|
|
||||||
class ACE_EarBuds: ACE_ItemCore {
|
class ACE_EarPlugs: ACE_ItemCore {
|
||||||
displayName = "$STR_ACE_Hearing_Earbuds_Name";
|
displayName = "$STR_ACE_Hearing_EarPlugs_Name";
|
||||||
descriptionShort = "$STR_ACE_Hearing_Earbuds_Description";
|
descriptionShort = "$STR_ACE_Hearing_EarPlugs_Description";
|
||||||
model = PATHTOF(ACE_earplugs.p3d);
|
model = PATHTOF(ACE_earplugs.p3d);
|
||||||
picture = PATHTOF(UI\ACE_earplugs_x_ca.paa);
|
picture = PATHTOF(UI\ACE_earplugs_x_ca.paa);
|
||||||
scope = 2;
|
scope = 2;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
class CfgPatches {
|
class CfgPatches {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
units[] = {};
|
units[] = {};
|
||||||
weapons[] = {"ACE_EarBuds"};
|
weapons[] = {"ACE_EarPlugs"};
|
||||||
requiredVersion = REQUIRED_VERSION;
|
requiredVersion = REQUIRED_VERSION;
|
||||||
requiredAddons[] = {"ace_common", "ace_interaction"};
|
requiredAddons[] = {"ace_common", "ace_interaction"};
|
||||||
author[] = {"KoffeinFlummi", "CAA-Picard", "HopeJ", "commy2"};
|
author[] = {"KoffeinFlummi", "CAA-Picard", "HopeJ", "commy2"};
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Called on unit initialization. Adds earplugs if the unit is equipped with either a really loud primary weapon or a rocket launcher.
|
* Called on unit initialization. Adds earplugs if the unit is equipped with either a really loud primary weapon or a rocket launcher.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* 0: A Soldier (Object)
|
* 0: A Soldier <Object>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Nothing
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [guy] call ace_hearing_fnc_addEarPlugs
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
@ -19,7 +23,7 @@ _unit = _this select 0;
|
|||||||
_launcher = secondaryWeapon _unit;
|
_launcher = secondaryWeapon _unit;
|
||||||
|
|
||||||
if (_launcher != "") exitWith {
|
if (_launcher != "") exitWith {
|
||||||
_unit addItem "ACE_EarBuds";
|
_unit addItem "ACE_EarPlugs";
|
||||||
};
|
};
|
||||||
|
|
||||||
// otherwise add earplugs if the soldier has a big rifle
|
// otherwise add earplugs if the soldier has a big rifle
|
||||||
@ -32,5 +36,5 @@ if (isNil "_magazine") exitWith {};
|
|||||||
_ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
_ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
||||||
|
|
||||||
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "audiblefire") > 8) then {
|
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "audiblefire") > 8) then {
|
||||||
_unit addItem "ACE_EarBuds";
|
_unit addItem "ACE_EarPlugs";
|
||||||
};
|
};
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi, commy2
|
* Author: KoffeinFlummi, commy2
|
||||||
*
|
|
||||||
* Creates ear ringing effect with set strength.
|
* Creates ear ringing effect with set strength.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: strength of ear ringing (Number between 0 and 1)
|
* 0: Unit (player) <OBJECT>
|
||||||
|
* 1: strength of ear ringing (Number between 0 and 1) <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* none
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [clientExplosionEvent] call ace_hearing_fnc_earRinging
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
@ -17,7 +22,7 @@ _unit = _this select 0;
|
|||||||
_strength = _this select 1;
|
_strength = _this select 1;
|
||||||
|
|
||||||
if (_unit getVariable ["ACE_hasEarPlugsin", false]) then {
|
if (_unit getVariable ["ACE_hasEarPlugsin", false]) then {
|
||||||
_strength = _strength / 4;
|
_strength = _strength / 4;
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(newStrength) = GVAR(newStrength) max _strength;
|
GVAR(newStrength) = GVAR(newStrength) max _strength;
|
||||||
@ -28,24 +33,24 @@ if (missionNamespace getVariable [QGVAR(isEarRingingPlaying), false]) exitWith {
|
|||||||
if (GVAR(DisableEarRinging)) exitWith {};
|
if (GVAR(DisableEarRinging)) exitWith {};
|
||||||
|
|
||||||
if (_strength > 0.75) exitWith {
|
if (_strength > 0.75) exitWith {
|
||||||
playSound "ACE_EarRinging_Heavy";
|
playSound "ACE_EarRinging_Heavy";
|
||||||
GVAR(isEarRingingPlaying) = true;
|
GVAR(isEarRingingPlaying) = true;
|
||||||
[
|
[
|
||||||
{GVAR(isEarRingingPlaying) = false;}, [], 7.0, 0.25
|
{GVAR(isEarRingingPlaying) = false;}, [], 7.0, 0.25
|
||||||
] call EFUNC(common,waitAndExecute);
|
] call EFUNC(common,waitAndExecute);
|
||||||
};
|
};
|
||||||
if (_strength > 0.5) exitWith {
|
if (_strength > 0.5) exitWith {
|
||||||
playSound "ACE_EarRinging_Medium";
|
playSound "ACE_EarRinging_Medium";
|
||||||
GVAR(isEarRingingPlaying) = true;
|
GVAR(isEarRingingPlaying) = true;
|
||||||
[
|
[
|
||||||
{GVAR(isEarRingingPlaying) = false;}, [], 5.0, 0.25
|
{GVAR(isEarRingingPlaying) = false;}, [], 5.0, 0.25
|
||||||
] call EFUNC(common,waitAndExecute);
|
] call EFUNC(common,waitAndExecute);
|
||||||
};
|
};
|
||||||
if (_strength > 0.2) exitWith {
|
if (_strength > 0.2) exitWith {
|
||||||
playSound "ACE_EarRinging_Weak";
|
playSound "ACE_EarRinging_Weak";
|
||||||
GVAR(isEarRingingPlaying) = true;
|
|
||||||
GVAR(isEarRingingPlaying) = true;
|
GVAR(isEarRingingPlaying) = true;
|
||||||
[
|
GVAR(isEarRingingPlaying) = true;
|
||||||
|
[
|
||||||
{GVAR(isEarRingingPlaying) = false;}, [], 3.0, 0.25
|
{GVAR(isEarRingingPlaying) = false;}, [], 3.0, 0.25
|
||||||
] call EFUNC(common,waitAndExecute);
|
] call EFUNC(common,waitAndExecute);
|
||||||
};
|
};
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi, commy2
|
* Author: KoffeinFlummi, commy2
|
||||||
*
|
|
||||||
* Handles deafness due to explosions going off near the player.
|
* Handles deafness due to explosions going off near the player.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* -> Explosion Event Handler
|
* 0: vehicle - Object the event handler is assigned to (player) <OBJECT>
|
||||||
|
* 1: damage - Damage inflicted to the object <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* none
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [clientExplosionEvent] call ace_hearing_fnc_explosionNear
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
@ -19,7 +24,4 @@ _damage = _this select 1;
|
|||||||
_strength = (_damage * 2) min 1;
|
_strength = (_damage * 2) min 1;
|
||||||
if (_strength < 0.01) exitWith {};
|
if (_strength < 0.01) exitWith {};
|
||||||
|
|
||||||
[_unit, _strength] spawn {
|
[{_this call FUNC(earRinging)}, [_unit, _strength], 0.2, 0] call EFUNC(common,waitAndExecute);
|
||||||
sleep 0.2;
|
|
||||||
_this call FUNC(earRinging);
|
|
||||||
};
|
|
||||||
|
@ -1,13 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi, commy2
|
* Author: KoffeinFlummi, commy2
|
||||||
*
|
|
||||||
* Handles deafness due to large-caliber weapons going off near the player.
|
* Handles deafness due to large-caliber weapons going off near the player.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* -> FiredNear Event Handler
|
* 0: Unit - Object the event handler is assigned to <OBJECT>
|
||||||
|
* 1: Firer: Object - Object which fires a weapon near the unit <OBJECT>
|
||||||
|
* 2: Distance - Distance in meters between the unit and firer <NUMBER>
|
||||||
|
* 3: weapon - Fired weapon <STRING>
|
||||||
|
* 4: muzzle - Muzzle that was used <STRING>
|
||||||
|
* 5: mod - Current mode of the fired weapon <STRING>
|
||||||
|
* 6: ammo - Ammo used <STRING>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* none
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [clientFiredNearEvent] call ace_hearing_fnc_firedNear
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
@ -25,17 +35,17 @@ if (_weapon in ["Throw", "Put"]) exitWith {};
|
|||||||
if (_unit != vehicle _unit && {!([_unit] call EFUNC(common,isTurnedOut))}) exitWith {};
|
if (_unit != vehicle _unit && {!([_unit] call EFUNC(common,isTurnedOut))}) exitWith {};
|
||||||
|
|
||||||
_silencer = switch (_weapon) do {
|
_silencer = switch (_weapon) do {
|
||||||
case (primaryWeapon _unit) : {primaryWeaponItems _unit select 0};
|
case (primaryWeapon _firer) : {(primaryWeaponItems _firer) select 0};
|
||||||
case (secondaryWeapon _unit) : {secondaryWeaponItems _unit select 0};
|
case (secondaryWeapon _firer) : {(secondaryWeaponItems _firer) select 0};
|
||||||
case (handgunWeapon _unit) : {handgunItems _unit select 0};
|
case (handgunWeapon _firer) : {(handgunItems _firer) select 0};
|
||||||
default {""};
|
default {""};
|
||||||
};
|
};
|
||||||
|
|
||||||
_audibleFireCoef = 1;
|
_audibleFireCoef = 1;
|
||||||
//_audibleFireTimeCoef = 1;
|
//_audibleFireTimeCoef = 1;
|
||||||
if (_silencer != "") then {
|
if (_silencer != "") then {
|
||||||
_audibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire");
|
_audibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire");
|
||||||
//_audibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFireTime");
|
//_audibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFireTime");
|
||||||
};
|
};
|
||||||
|
|
||||||
_audibleFire = getNumber (configFile >> "CfgAmmo" >> _ammo >> "audibleFire");
|
_audibleFire = getNumber (configFile >> "CfgAmmo" >> _ammo >> "audibleFire");
|
||||||
@ -46,7 +56,4 @@ _strength = _loudness - (_loudness/50 * _distance); // linear drop off
|
|||||||
|
|
||||||
if (_strength < 0.01) exitWith {};
|
if (_strength < 0.01) exitWith {};
|
||||||
|
|
||||||
[_unit, _strength] spawn {
|
[{_this call FUNC(earRinging)}, [_unit, _strength], 0.2, 0] call EFUNC(common,waitAndExecute);
|
||||||
sleep 0.2;
|
|
||||||
_this call FUNC(earRinging);
|
|
||||||
};
|
|
||||||
|
@ -1,18 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Check if the unit has earplugs put in.
|
* Check if the unit has earplugs put in.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* A soldier (Object)
|
* 0:Unit (player) <OBJECT>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Boolean (Bool)
|
* Have Earplugs in <BOOL>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [ace_player] call ace_hearing_fnc_hasEarPlugsIn
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private "_unit";
|
PARAMS_1(_unit);
|
||||||
|
|
||||||
_unit = _this select 0;
|
|
||||||
|
|
||||||
_unit getVariable ["ACE_hasEarPlugsin", false]
|
_unit getVariable ["ACE_hasEarPlugsin", false]
|
||||||
|
@ -1,27 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Hope Johnson
|
* Author: Hope Johnson and commy2
|
||||||
* Edited by commy2
|
* Puts in earplugs.
|
||||||
*
|
|
||||||
* Puts in / takes out earplugs.
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* none
|
* 0:Unit (player) <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* none
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [ace_player] call ace_hearing_fnc_putInEarplugs
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private "_player";
|
PARAMS_1(_player);
|
||||||
|
|
||||||
_player = _this select 0;
|
// Plugs in inventory, putting them in
|
||||||
|
_player removeItem "ACE_EarPlugs";
|
||||||
// Buds in inventory, putting them in
|
|
||||||
_player removeItem "ACE_EarBuds";
|
|
||||||
|
|
||||||
_player setVariable ["ACE_hasEarPlugsIn", true, true];
|
_player setVariable ["ACE_hasEarPlugsIn", true, true];
|
||||||
|
|
||||||
[localize "STR_ACE_Hearing_Earbuds_Are_On"] call EFUNC(common,displayTextStructured);
|
[localize "STR_ACE_Hearing_EarPlugs_Are_On"] call EFUNC(common,displayTextStructured);
|
||||||
|
|
||||||
/*// No Ear Buds in inventory, telling user
|
/*// No Ear Plugs in inventory, telling user
|
||||||
[localize "STR_ACE_Hearing_NoBuds"] call EFUNC(common,displayTextStructured);*/
|
[localize "STR_ACE_Hearing_NoPlugs"] call EFUNC(common,displayTextStructured);*/
|
||||||
|
@ -1,28 +1,29 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Hope Johnson
|
* Author: Hope Johnson and commy2
|
||||||
* Edited by commy2
|
* Takes out earplugs.
|
||||||
*
|
|
||||||
* Puts in / takes out earplugs.
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* none
|
* 0:Unit (player) <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* none
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [ace_player] call ace_hearing_fnc_removeEarplugs
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private "_player";
|
PARAMS_1(_player);
|
||||||
|
|
||||||
_player = _this select 0;
|
if !(_player canAdd "ACE_EarPlugs") exitWith { // inventory full
|
||||||
|
[localize "STR_ACE_Hearing_Inventory_Full"] call EFUNC(common,displayTextStructured);
|
||||||
if !(_player canAdd "ACE_EarBuds") exitWith { // inventory full
|
|
||||||
[localize "STR_ACE_Hearing_Inventory_Full"] call EFUNC(common,displayTextStructured);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Buds already in and removing them.
|
// Plugs already in and removing them.
|
||||||
_player addItem "ACE_EarBuds";
|
_player addItem "ACE_EarPlugs";
|
||||||
|
|
||||||
_player setVariable ["ACE_hasEarPlugsIn", false, true];
|
_player setVariable ["ACE_hasEarPlugsIn", false, true];
|
||||||
|
|
||||||
[localize "STR_ACE_Hearing_Earbuds_Are_Off"] call EFUNC(common,displayTextStructured);
|
[localize "STR_ACE_Hearing_EarPlugs_Are_Off"] call EFUNC(common,displayTextStructured);
|
||||||
|
@ -1,4 +1,18 @@
|
|||||||
// by commy2 and CAA-Picard
|
/*
|
||||||
|
* Author: commy2 and CAA-Picard
|
||||||
|
* Updates and applys the current deafness. Called every 0.1 sec from a PFEH.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [] call ace_hearing_fnc_updateVolume
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
#define STRENGHTODEAFNESS 3
|
#define STRENGHTODEAFNESS 3
|
||||||
@ -9,17 +23,17 @@ if !(GVAR(enableCombatDeafness)) exitWith {};
|
|||||||
|
|
||||||
// Check if new noises increase deafness
|
// Check if new noises increase deafness
|
||||||
if (GVAR(newStrength) * STRENGHTODEAFNESS > GVAR(currentDeafness)) then {
|
if (GVAR(newStrength) * STRENGHTODEAFNESS > GVAR(currentDeafness)) then {
|
||||||
GVAR(currentDeafness) = GVAR(newStrength) * STRENGHTODEAFNESS min MAXDEAFNESS;
|
GVAR(currentDeafness) = GVAR(newStrength) * STRENGHTODEAFNESS min MAXDEAFNESS;
|
||||||
};
|
};
|
||||||
GVAR(newStrength) = 0;
|
GVAR(newStrength) = 0;
|
||||||
|
|
||||||
// Recover rate is slower if deafness is severe
|
// Recover rate is slower if deafness is severe
|
||||||
_recoverRate = 0.01;
|
_recoverRate = 0.01;
|
||||||
if (GVAR(currentDeafness) > 0.7) then {
|
if (GVAR(currentDeafness) > 0.7) then {
|
||||||
_recoverRate = 0.005;
|
_recoverRate = 0.005;
|
||||||
if (GVAR(currentDeafness) > 0.9) then {
|
if (GVAR(currentDeafness) > 0.9) then {
|
||||||
_recoverRate = 0.002;
|
_recoverRate = 0.002;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Deafness recovers with time
|
// Deafness recovers with time
|
||||||
@ -30,19 +44,19 @@ _volume = (1 - GVAR(currentDeafness) max 0)^2 max 0.04;
|
|||||||
|
|
||||||
// Earplugs reduce hearing 50%
|
// Earplugs reduce hearing 50%
|
||||||
if ([ACE_player] call FUNC(hasEarPlugsIn)) then {
|
if ([ACE_player] call FUNC(hasEarPlugsIn)) then {
|
||||||
_volume = _volume min GVAR(EarplugsVolume);
|
_volume = _volume min GVAR(EarplugsVolume);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Reduce volume if player is unconscious
|
// Reduce volume if player is unconscious
|
||||||
if (ACE_player getVariable ["ACE_isUnconscious", false]) then {
|
if (ACE_player getVariable ["ACE_isUnconscious", false]) then {
|
||||||
_volume = _volume min GVAR(UnconsciousnessVolume);
|
_volume = _volume min GVAR(UnconsciousnessVolume);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!(missionNameSpace getVariable [QGVAR(disableVolumeUpdate), false])) then {
|
if (!(missionNameSpace getVariable [QGVAR(disableVolumeUpdate), false])) then {
|
||||||
0.1 fadeSound _volume;
|
0.1 fadeSound _volume;
|
||||||
0.1 fadeSpeech _volume;
|
0.1 fadeSpeech _volume;
|
||||||
ACE_player setVariable ["tf_globalVolume", _volume];
|
ACE_player setVariable ["tf_globalVolume", _volume];
|
||||||
ACE_player setVariable ["acre_sys_core_globalVolume", _volume];
|
if (!isNil "acre_api_fnc_setGlobalVolume") then {[_volume] call acre_api_fnc_setGlobalVolume;};
|
||||||
};
|
};
|
||||||
|
|
||||||
//hintSilent format ["GVAR(currentDeafness), _Volume = %1, %2", GVAR(currentDeafness), _volume];
|
//hintSilent format ["GVAR(currentDeafness), _Volume = %1, %2", GVAR(currentDeafness), _volume];
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<!-- Edited with tabler - 2014-12-17 -->
|
<!-- Edited with tabler - 2014-12-17 -->
|
||||||
<Project name="ACE">
|
<Project name="ACE">
|
||||||
<Package name="Hearing">
|
<Package name="Hearing">
|
||||||
<Key ID="STR_ACE_Hearing_Earbuds_Name">
|
<Key ID="STR_ACE_Hearing_EarPlugs_Name">
|
||||||
<English>Ear Plugs</English>
|
<English>Ear Plugs</English>
|
||||||
<German>Ohrenstöpsel</German>
|
<German>Ohrenstöpsel</German>
|
||||||
<Spanish>Tapones para los oídos</Spanish>
|
<Spanish>Tapones para los oídos</Spanish>
|
||||||
@ -14,8 +14,8 @@
|
|||||||
<Portuguese>Protetor auricular</Portuguese>
|
<Portuguese>Protetor auricular</Portuguese>
|
||||||
<Italian>Tappi auricolari</Italian>
|
<Italian>Tappi auricolari</Italian>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Hearing_Earbuds_Description">
|
<Key ID="STR_ACE_Hearing_EarPlugs_Description">
|
||||||
<English>Protective Ear Buds allow the wearer to be near loud weaponry without damage to his hearing.</English>
|
<English>Protective Ear Plugs allow the wearer to be near loud weaponry without damage to his hearing.</English>
|
||||||
<German>Schützende Ohrenstöpsel, die es dem Träger ermöglichen, sich in der Nähe lauter Waffen aufzuhalten.</German>
|
<German>Schützende Ohrenstöpsel, die es dem Träger ermöglichen, sich in der Nähe lauter Waffen aufzuhalten.</German>
|
||||||
<Spanish>Los tapones para los oídos permiten al usuario operar armamento ruidoso sin sufrir pérdida de audición.</Spanish>
|
<Spanish>Los tapones para los oídos permiten al usuario operar armamento ruidoso sin sufrir pérdida de audición.</Spanish>
|
||||||
<Polish>Stopery do uszu umożliwiają użytkownikowi przebywać w pobliżu głośnej broni bez poniesienia konsekwencji jaką jest utrata słuchu.</Polish>
|
<Polish>Stopery do uszu umożliwiają użytkownikowi przebywać w pobliżu głośnej broni bez poniesienia konsekwencji jaką jest utrata słuchu.</Polish>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<Portuguese>Protetor para ouvidos permitem que o usuário esteja próximo a ruídos sem danificar sua audição.</Portuguese>
|
<Portuguese>Protetor para ouvidos permitem que o usuário esteja próximo a ruídos sem danificar sua audição.</Portuguese>
|
||||||
<Italian>Proteggono l'apparato uditivo, permettendo a chi li indossa di resistere ai suoni particolarmente forti senza alcun danno.</Italian>
|
<Italian>Proteggono l'apparato uditivo, permettendo a chi li indossa di resistere ai suoni particolarmente forti senza alcun danno.</Italian>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Hearing_Earbuds_On">
|
<Key ID="STR_ACE_Hearing_EarPlugs_On">
|
||||||
<English>Earplugs in</English>
|
<English>Earplugs in</English>
|
||||||
<German>Ohrenstöpsel drinnen</German>
|
<German>Ohrenstöpsel drinnen</German>
|
||||||
<Spanish>Poner tapones</Spanish>
|
<Spanish>Poner tapones</Spanish>
|
||||||
@ -38,7 +38,7 @@
|
|||||||
<Portuguese>Protetores colocados</Portuguese>
|
<Portuguese>Protetores colocados</Portuguese>
|
||||||
<Italian>Indossa i tappi auricolari</Italian>
|
<Italian>Indossa i tappi auricolari</Italian>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Hearing_Earbuds_Off">
|
<Key ID="STR_ACE_Hearing_EarPlugs_Off">
|
||||||
<English>Earplugs out</English>
|
<English>Earplugs out</English>
|
||||||
<German>Ohrenstöpsel raus</German>
|
<German>Ohrenstöpsel raus</German>
|
||||||
<Spanish>Quitar tapones</Spanish>
|
<Spanish>Quitar tapones</Spanish>
|
||||||
@ -50,7 +50,7 @@
|
|||||||
<Portuguese>Protetores retirados</Portuguese>
|
<Portuguese>Protetores retirados</Portuguese>
|
||||||
<Italian>Levati i tappi auricolari</Italian>
|
<Italian>Levati i tappi auricolari</Italian>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Hearing_Earbuds_Are_On">
|
<Key ID="STR_ACE_Hearing_EarPlugs_Are_On">
|
||||||
<English>Earplugs in</English>
|
<English>Earplugs in</English>
|
||||||
<German>Ohrenstöpsel drinnen</German>
|
<German>Ohrenstöpsel drinnen</German>
|
||||||
<Spanish>Tapones puestos</Spanish>
|
<Spanish>Tapones puestos</Spanish>
|
||||||
@ -62,7 +62,7 @@
|
|||||||
<Portuguese>Protetores colocados</Portuguese>
|
<Portuguese>Protetores colocados</Portuguese>
|
||||||
<Italian>Indossa i tappi auricolari</Italian>
|
<Italian>Indossa i tappi auricolari</Italian>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Hearing_Earbuds_Are_Off">
|
<Key ID="STR_ACE_Hearing_EarPlugs_Are_Off">
|
||||||
<English>Earplugs out</English>
|
<English>Earplugs out</English>
|
||||||
<German>Ohrenstöpsel raus</German>
|
<German>Ohrenstöpsel raus</German>
|
||||||
<Spanish>Tapones quitados</Spanish>
|
<Spanish>Tapones quitados</Spanish>
|
||||||
@ -74,7 +74,7 @@
|
|||||||
<Portuguese>Protetores retirados</Portuguese>
|
<Portuguese>Protetores retirados</Portuguese>
|
||||||
<Italian>Levati i tappi auricolari</Italian>
|
<Italian>Levati i tappi auricolari</Italian>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Hearing_NoBuds">
|
<Key ID="STR_ACE_Hearing_NoPlugs">
|
||||||
<English>You have no ear plugs</English>
|
<English>You have no ear plugs</English>
|
||||||
<German>Keine Ohrenstöpsel im Inventar</German>
|
<German>Keine Ohrenstöpsel im Inventar</German>
|
||||||
<Spanish>No tienes tapones para los oídos</Spanish>
|
<Spanish>No tienes tapones para los oídos</Spanish>
|
||||||
|
Loading…
Reference in New Issue
Block a user