ACE3/addons/laserpointer/XEH_postInit.sqf
Glowbal b489750d5b Minor optimizations using private, params, and isEqualType (#4323)
* Optimizations with private, params, and isEqualType

* Fixed tab being used instead of space

* Fixed tabs inserted by notepad++

* More usage of new private syntax and params

- changed a few checks for an array being empty to `_arr isEqualTo []`
rather than `count _arr == 0`
- added more uses of `private` on the same line as the variable is
declared
- added more uses of params to assign variables passed as parameters
- removed unnecessary parentheses
- removed several unnecessary variable declarations with private array
syntax

* clean up and formatting
2016-09-04 16:44:22 +02:00

35 lines
1.1 KiB
Plaintext

// by commy2
#include "script_component.hpp"
// fixes laser when being captured. Needed, because the selectionPosition of the right hand is used
[QEGVAR(captives,setHandcuffed), {if (_this select 1) then {(_this select 0) action ["ace_gunLightOff", _this select 0]};}] call CBA_fnc_addEventHandler;
if (!hasInterface) exitWith {};
GVAR(nearUnits) = [];
#include "initKeybinds.sqf"
["ace_settingsInitialized", {
//If not enabled, dont't add draw eventhandler or PFEH (for performance)
if (!GVAR(enabled)) exitWith {};
// @todo. Maybe move to common?
[{
private _nearUnits = [];
{
_nearUnits append crew _x;
if (count _nearUnits > 10) exitWith {
_nearUnits resize 10;
};
} forEach nearestObjects [positionCameraToWorld [0,0,0], ["AllVehicles"], 50]; // when moving this, search also for units inside vehicles. currently breaks the laser in FFV
GVAR(nearUnits) = _nearUnits;
} , 5, []] call CBA_fnc_addPerFrameHandler;
addMissionEventHandler ["Draw3D", {
call FUNC(onDraw);
}];
}] call CBA_fnc_addEventHandler;