mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Hearing - Removed remoteExec
& added microoptimisations (#9853)
* Removed remoteExec. added microoptimisations * Update addons/hearing/XEH_preInit.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> * move EH to after !hasInterface --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
parent
b4eaa1e270
commit
50978efa46
@ -23,6 +23,8 @@ GVAR(lastPlayerVehicle) = objNull;
|
|||||||
// Spawn volume updating process
|
// Spawn volume updating process
|
||||||
[LINKFUNC(updateVolume), 1, [false]] call CBA_fnc_addPerFrameHandler;
|
[LINKFUNC(updateVolume), 1, [false]] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
|
[QGVAR(updateVolume), LINKFUNC(updateVolume)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// Update veh attunation when player veh changes
|
// Update veh attunation when player veh changes
|
||||||
["vehicle", {
|
["vehicle", {
|
||||||
params ["_player", "_vehicle"];
|
params ["_player", "_vehicle"];
|
||||||
|
@ -12,7 +12,8 @@ PREP_RECOMPILE_END;
|
|||||||
params ["_unit", "_loadout", "_extendedInfo"];
|
params ["_unit", "_loadout", "_extendedInfo"];
|
||||||
if (_extendedInfo getOrDefault ["ace_earplugs", false]) then {
|
if (_extendedInfo getOrDefault ["ace_earplugs", false]) then {
|
||||||
_unit setVariable ["ACE_hasEarPlugsIn", true, true];
|
_unit setVariable ["ACE_hasEarPlugsIn", true, true];
|
||||||
[[true]] remoteExec [QFUNC(updateVolume), _unit];
|
|
||||||
|
[QGVAR(updateVolume), [[true]], _unit] call CBA_fnc_targetEvent;
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_unit"];
|
|
||||||
TRACE_2("params",_unit,typeOf _unit);
|
|
||||||
|
|
||||||
// only run this after the settings are initialized
|
// only run this after the settings are initialized
|
||||||
if !(EGVAR(common,settingsInitFinished)) exitWith {
|
if !(EGVAR(common,settingsInitFinished)) exitWith {
|
||||||
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(addEarPlugs), _this];
|
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(addEarPlugs), _this];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
params ["_unit"];
|
||||||
|
TRACE_2("params",_unit,typeOf _unit);
|
||||||
|
|
||||||
// Exit if hearing is disabled OR autoAdd is disabled OR soldier has earplugs already in (persistence scenarios)
|
// Exit if hearing is disabled OR autoAdd is disabled OR soldier has earplugs already in (persistence scenarios)
|
||||||
if (!GVAR(enableCombatDeafness) || {!GVAR(autoAddEarplugsToUnits)} || {[_unit] call FUNC(hasEarPlugsIn)}) exitWith {};
|
if (!GVAR(enableCombatDeafness) || {!GVAR(autoAddEarplugsToUnits)} || {[_unit] call FUNC(hasEarPlugsIn)}) exitWith {};
|
||||||
|
|
||||||
@ -38,16 +38,20 @@ if ((primaryWeapon _unit) == "") exitWith {};
|
|||||||
(primaryWeaponMagazine _unit) params [["_magazine", ""]];
|
(primaryWeaponMagazine _unit) params [["_magazine", ""]];
|
||||||
if (_magazine == "") exitWith {};
|
if (_magazine == "") exitWith {};
|
||||||
|
|
||||||
private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
|
private _cfgMagazine = configFile >> "CfgMagazines" >> _magazine;
|
||||||
private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
|
||||||
private _count = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count");
|
|
||||||
|
|
||||||
private _caliber = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_caliber");
|
private _initSpeed = getNumber (_cfgMagazine >> "initSpeed");
|
||||||
|
private _ammo = getText (_cfgMagazine >> "ammo");
|
||||||
|
private _count = getNumber (_cfgMagazine >> "count");
|
||||||
|
|
||||||
|
private _cfgAmmo = configFile >> "CfgAmmo";
|
||||||
|
|
||||||
|
private _caliber = getNumber (_cfgAmmo >> _ammo >> "ACE_caliber");
|
||||||
_caliber = call {
|
_caliber = call {
|
||||||
if (_ammo isKindOf ["ShellBase", (configFile >> "CfgAmmo")]) exitWith { 80 };
|
if (_ammo isKindOf ["ShellBase", _cfgAmmo]) exitWith { 80 };
|
||||||
if (_ammo isKindOf ["RocketBase", (configFile >> "CfgAmmo")]) exitWith { 200 };
|
if (_ammo isKindOf ["RocketBase", _cfgAmmo]) exitWith { 200 };
|
||||||
if (_ammo isKindOf ["MissileBase", (configFile >> "CfgAmmo")]) exitWith { 600 };
|
if (_ammo isKindOf ["MissileBase", _cfgAmmo]) exitWith { 600 };
|
||||||
if (_ammo isKindOf ["SubmunitionBase", (configFile >> "CfgAmmo")]) exitWith { 80 };
|
if (_ammo isKindOf ["SubmunitionBase", _cfgAmmo]) exitWith { 80 };
|
||||||
[_caliber, 6.5] select (_caliber <= 0);
|
[_caliber, 6.5] select (_caliber <= 0);
|
||||||
};
|
};
|
||||||
private _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5;
|
private _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5;
|
||||||
|
Loading…
Reference in New Issue
Block a user