mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2146 from jokoho48/codeCleanupHearing
Code cleanup of Hearing module
This commit is contained in:
commit
2f54cfadbc
@ -14,8 +14,7 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
params ["_unit"];
|
||||||
PARAMS_1(_unit);
|
|
||||||
|
|
||||||
// Exit if hearing is disabled or soldier has earplugs already in (persistence scenarios)
|
// Exit if hearing is disabled or soldier has earplugs already in (persistence scenarios)
|
||||||
if (!GVAR(enableCombatDeafness) || {[_unit] call FUNC(hasEarPlugsIn)}) exitWith {};
|
if (!GVAR(enableCombatDeafness) || {[_unit] call FUNC(hasEarPlugsIn)}) exitWith {};
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
params ["_unit", "_strength"];
|
||||||
PARAMS_2(_unit,_strength);
|
|
||||||
|
|
||||||
if (_unit != ACE_player) exitWith {};
|
if (_unit != ACE_player) exitWith {};
|
||||||
if (_strength < 0.05) exitWith {};
|
if (_strength < 0.05) exitWith {};
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
//Only run if deafness or ear ringing is enabled:
|
//Only run if deafness or ear ringing is enabled:
|
||||||
if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
|
if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
|
||||||
|
|
||||||
PARAMS_2(_unit,_damage);
|
params ["_unit", "_damage"];
|
||||||
|
|
||||||
private ["_strength"];
|
private ["_strength"];
|
||||||
_strength = 0 max _damage;
|
_strength = 0 max _damage;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
//Only run if deafness or ear ringing is enabled:
|
//Only run if deafness or ear ringing is enabled:
|
||||||
if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
|
if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
|
||||||
|
|
||||||
PARAMS_7(_object,_firer,_distance,_weapon,_muzzle,_mode,_ammo);
|
params ["_object", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo"];
|
||||||
|
|
||||||
//Only run if firedNear object is player or player's vehicle:
|
//Only run if firedNear object is player or player's vehicle:
|
||||||
if ((ACE_player != _object) && {(vehicle ACE_player) != _object}) exitWith {};
|
if ((ACE_player != _object) && {(vehicle ACE_player) != _object}) exitWith {};
|
||||||
@ -58,7 +58,7 @@ if (count _weaponMagazines == 0) then {
|
|||||||
_muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines");
|
_muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines");
|
||||||
_weaponMagazines append _muzzleMagazines;
|
_weaponMagazines append _muzzleMagazines;
|
||||||
};
|
};
|
||||||
} forEach _muzzles;
|
} count _muzzles;
|
||||||
{
|
{
|
||||||
_ammoType = getText(configFile >> "CfgMagazines" >> _x >> "ammo");
|
_ammoType = getText(configFile >> "CfgMagazines" >> _x >> "ammo");
|
||||||
_weaponMagazines set [_forEachIndex, [_x, _ammoType]];
|
_weaponMagazines set [_forEachIndex, [_x, _ammoType]];
|
||||||
@ -68,11 +68,11 @@ if (count _weaponMagazines == 0) then {
|
|||||||
|
|
||||||
_magazine = "";
|
_magazine = "";
|
||||||
{
|
{
|
||||||
EXPLODE_2_PVT(_x,_magazineType,_ammoType);
|
_x params ["_magazineType", "_ammoType"];
|
||||||
if (_ammoType == _ammo) exitWith {
|
if (_ammoType == _ammo) exitWith {
|
||||||
_magazine = _magazineType;
|
_magazine = _magazineType;
|
||||||
};
|
};
|
||||||
} forEach _weaponMagazines;
|
} count _weaponMagazines;
|
||||||
|
|
||||||
if (_magazine == "") exitWith {};
|
if (_magazine == "") exitWith {};
|
||||||
|
|
||||||
@ -80,15 +80,13 @@ _initSpeed = getNumber(configFile >> "CfgMagazines" >> _magazine >> "initSpeed")
|
|||||||
_ammoConfig = (configFile >> "CfgAmmo" >> _ammo);
|
_ammoConfig = (configFile >> "CfgAmmo" >> _ammo);
|
||||||
_parentClasses = [_ammoConfig, true] call BIS_fnc_returnParents;
|
_parentClasses = [_ammoConfig, true] call BIS_fnc_returnParents;
|
||||||
_caliber = getNumber(_ammoConfig >> "ACE_caliber");
|
_caliber = getNumber(_ammoConfig >> "ACE_caliber");
|
||||||
_caliber = switch (true) do {
|
_caliber = call {
|
||||||
case ("ShellBase" in _parentClasses): { 80 };
|
if ("ShellBase" in _parentClasses) exitWith { 80 };
|
||||||
case ("RocketBase" in _parentClasses): { 200 };
|
if ("RocketBase" in _parentClasses) exitWith { 200 };
|
||||||
case ("MissileBase" in _parentClasses): { 600 };
|
if ("MissileBase" in _parentClasses) exitWith { 600 };
|
||||||
case ("SubmunitionBase" in _parentClasses): { 80 };
|
if ("SubmunitionBase" in _parentClasses) exitWith { 80 };
|
||||||
default {
|
|
||||||
if (_caliber <= 0) then { 6.5 } else { _caliber };
|
if (_caliber <= 0) then { 6.5 } else { _caliber };
|
||||||
};
|
};
|
||||||
};
|
|
||||||
_loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) * _audibleFireCoef / 5;
|
_loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) * _audibleFireCoef / 5;
|
||||||
_strength = _vehAttenuation * (_loudness - (_loudness / 50 * _distance)); // linear drop off
|
_strength = _vehAttenuation * (_loudness - (_loudness / 50 * _distance)); // linear drop off
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
params ["_unit"];
|
||||||
PARAMS_1(_unit);
|
|
||||||
|
|
||||||
_unit getVariable ["ACE_hasEarPlugsin", false]
|
_unit getVariable ["ACE_hasEarPlugsin", false]
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
* None
|
* None
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
params ["_logic", "_units", "_activated"];
|
||||||
PARAMS_3(_logic,_units,_activated);
|
|
||||||
|
|
||||||
if !(_activated) exitWith {};
|
if !(_activated) exitWith {};
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_1(_player);
|
params ["_player"];
|
||||||
|
|
||||||
// Plugs in inventory, putting them in
|
// Plugs in inventory, putting them in
|
||||||
_player removeItem "ACE_EarPlugs";
|
_player removeItem "ACE_EarPlugs";
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_1(_player);
|
params ["_player"];
|
||||||
|
|
||||||
if !(_player canAdd "ACE_EarPlugs") exitWith { // inventory full
|
if !(_player canAdd "ACE_EarPlugs") exitWith { // inventory full
|
||||||
[localize LSTRING(Inventory_Full)] call EFUNC(common,displayTextStructured);
|
[localize LSTRING(Inventory_Full)] call EFUNC(common,displayTextStructured);
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
//Only run if deafness or ear ringing is enabled:
|
//Only run if deafness or ear ringing is enabled:
|
||||||
if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
|
if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {};
|
||||||
|
|
||||||
EXPLODE_1_PVT((_this select 0),_justUpdateVolume);
|
|
||||||
|
|
||||||
private["_volume", "_soundTransitionTime"];
|
private["_volume", "_soundTransitionTime"];
|
||||||
|
(_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;
|
||||||
|
Loading…
Reference in New Issue
Block a user