ACE3/addons/laserpointer/functions/fnc_onDraw.sqf

42 lines
1.0 KiB
Plaintext
Raw Normal View History

2015-11-23 19:52:04 +00:00
/*
* Author: commy2
* Draw the visible laser beams of all cached units.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
2015-01-17 22:38:13 +00:00
#include "script_component.hpp"
2015-11-23 19:52:04 +00:00
private _isIR = currentVisionMode ACE_player;
2015-01-17 22:38:13 +00:00
if (_isIR == 2) exitWith {};
_isIR = _isIR == 1;
2015-11-23 19:52:04 +00:00
private _brightness = 2 - call EFUNC(common,ambientBrightness);
2015-06-13 08:41:19 +00:00
2015-01-17 22:38:13 +00:00
{
2015-11-23 19:52:04 +00:00
private _weapon = currentWeapon _x;
private _laser = (_x weaponAccessories _weapon) select 1;
2015-01-17 22:38:13 +00:00
if (_laser != "") then {
2015-11-23 19:52:04 +00:00
private _cacheName = format [QGVAR(laser_%1), _laser];
private _laserID = missionNamespace getVariable [_cacheName, -1];
if (missionNamespace getVariable [_cacheName, -1] == -1) then {
_laserID = getNumber (configFile >> "CfgWeapons" >> _laser >> "ACE_laserpointer");
missionNamespace setVariable [_cacheName, _laserID];
};
2015-01-17 22:38:13 +00:00
if (_laserID > 0 && {_x isFlashlightOn _weapon}) then {
[_x, 100, (_laserID == 2 || _isIR), _brightness] call FUNC(drawLaserpoint);
};
2015-01-17 22:38:13 +00:00
};
2015-11-23 19:52:04 +00:00
false
} count GVAR(nearUnits);