From 455f65947a72f206599accc3b86f7fcd8c86d7ca Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 23 Jul 2016 23:08:40 -0500 Subject: [PATCH] Minor cleanup of fired EH listeners --- addons/frag/XEH_postInit.sqf | 2 -- addons/frag/functions/fnc_addPfhRound.sqf | 2 +- addons/scopes/functions/fnc_firedEH.sqf | 8 +++----- addons/scopes/functions/fnc_inventoryCheck.sqf | 6 ++---- addons/winddeflection/functions/fnc_handleFired.sqf | 4 ++-- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/addons/frag/XEH_postInit.sqf b/addons/frag/XEH_postInit.sqf index 02d27434dd..feb4be05b6 100644 --- a/addons/frag/XEH_postInit.sqf +++ b/addons/frag/XEH_postInit.sqf @@ -15,10 +15,8 @@ if(isServer) then { // Register fire event handler ["ace_firedPlayer", DFUNC(fired)] call CBA_fnc_addEventHandler; - ["ace_firedPlayerNonLocal", DFUNC(fired)] call CBA_fnc_addEventHandler; ["ace_firedNonPlayer", DFUNC(fired)] call CBA_fnc_addEventHandler; ["ace_firedPlayerVehicle", DFUNC(fired)] call CBA_fnc_addEventHandler; - ["ace_firedPlayerVehicleNonLocal", DFUNC(fired)] call CBA_fnc_addEventHandler; ["ace_firedNonPlayerVehicle", DFUNC(fired)] call CBA_fnc_addEventHandler; [FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/frag/functions/fnc_addPfhRound.sqf b/addons/frag/functions/fnc_addPfhRound.sqf index 14f1e2f3ad..eb61500843 100644 --- a/addons/frag/functions/fnc_addPfhRound.sqf +++ b/addons/frag/functions/fnc_addPfhRound.sqf @@ -51,7 +51,7 @@ if(GVAR(autoTrace)) then { // We should do an {!(_round in GVAR(objects))} // But we leave that out here for optimization. So this cannot be a framework function // Otherwise, it should only be added once and from the FiredEH -if(_doFragTrack && alive _round) then { +if(_doFragTrack && {alive _round}) then { _spallTrack = []; _spallTrackID = []; diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index 444b768eb5..5d3b975dbf 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -15,15 +15,13 @@ //IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); -private ["_adjustment", "_weaponIndex", "_zeroing", "_adjustment"]; - -_adjustment = _unit getVariable [QGVAR(Adjustment), []]; +private _adjustment = _unit getVariable [QGVAR(Adjustment), []]; if (_adjustment isEqualTo []) exitWith {}; -_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); +private _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); if (_weaponIndex < 0) exitWith {}; -_zeroing = _adjustment select _weaponIndex; +private _zeroing = _adjustment select _weaponIndex; TRACE_1("Adjusting With",_zeroing); if (_zeroing isEqualTo [0, 0, 0]) exitWith {}; diff --git a/addons/scopes/functions/fnc_inventoryCheck.sqf b/addons/scopes/functions/fnc_inventoryCheck.sqf index c40ca3f8b4..1a79ef0418 100644 --- a/addons/scopes/functions/fnc_inventoryCheck.sqf +++ b/addons/scopes/functions/fnc_inventoryCheck.sqf @@ -15,11 +15,9 @@ */ #include "script_component.hpp" -private ["_newOptics", "_adjustment"]; - params ["_player"]; -_adjustment = ACE_player getVariable QGVAR(Adjustment); +private _adjustment = ACE_player getVariable QGVAR(Adjustment); if (isNil "_adjustment") then { // [Windage, Elevation, Zero] _adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]; @@ -30,7 +28,7 @@ if (isNil "_adjustment") then { if (isNil QGVAR(Optics)) then { GVAR(Optics) = ["", "", ""]; }; -_newOptics = [_player] call FUNC(getOptics); +private _newOptics = [_player] call FUNC(getOptics); { if (_newOptics select _forEachIndex != _x) then { diff --git a/addons/winddeflection/functions/fnc_handleFired.sqf b/addons/winddeflection/functions/fnc_handleFired.sqf index e2bfca394f..e78620471d 100644 --- a/addons/winddeflection/functions/fnc_handleFired.sqf +++ b/addons/winddeflection/functions/fnc_handleFired.sqf @@ -18,9 +18,9 @@ //IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); -if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && (_projectile isKindOf "BulletBase") && (_unit isKindOf "Man")) exitWith {false}; +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && {_projectile isKindOf "BulletBase"} && {_unit isKindOf "Man"}) exitWith {false}; -if (!((_projectile isKindOf "BulletBase") || (_projectile isKindOf "GrenadeBase"))) exitWith {false}; +if (!((_projectile isKindOf "BulletBase") || {_projectile isKindOf "GrenadeBase"})) exitWith {false}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {false}; GVAR(trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")];