A3 check if gunlight is turned on

This commit is contained in:
commy2 2015-03-14 11:26:52 +01:00
parent 97776c168b
commit 1b3dcfc07b
3 changed files with 44 additions and 2 deletions

View File

@ -6,6 +6,7 @@ LOG(MSG_INIT);
PREP(determineMapLight);
PREP(determineZoom);
PREP(isGunLightOn);
PREP(updateMapFx);
ADDON = true;

View File

@ -2,8 +2,7 @@
private ["_darkenMap","_darkenColor","_createLight","_gunlight","_nearObjects","_light"];
// @todo: Update the way to check for flashlights
_gunlight = isArray(configFile>> "CfgWeapons" >> currentWeapon player >>"ace_gunlight_classes") || {"ACE_MugLite" in weapons player};
_gunlight = [ACE_player] call FUNC(isGunLightOn);
_fnc_blendColor = {
EXPLODE_3_PVT(_this,_c1,_c2,_alpha);

View File

@ -0,0 +1,42 @@
/*
* Author: commy2
*
* Check if the given unit has it's flashlight attachment turned on.
*
* Argument:
* 0: A unit with gunlight (Object)
*
* Return value:
* Unit has flashlight turned on? (Bool).
*/
#include "script_component.hpp"
private "_unit";
_unit = _this select 0;
private "_weapon";
_weapon = currentWeapon _unit;
// exit if flashlight is turned off
if !(_unit isFlashlightOn _weapon) exitWith {false};
// get type of attachment
private "_gunLight";
_gunLight = switch (_weapon) do {
case (""): {""};
case (primaryWeapon _unit): {
primaryWeaponItems _unit select 1;
};
case (secondaryWeapon _unit): {
secondaryWeaponItems _unit select 1;
};
case (handgunWeapon _unit): {
handgunItems _unit select 1;
};
default {""};
};
// return false if the gunlight is a day laser
!(toLower _gunLight in ["ace_acc_pointer_red", "ace_acc_pointer_green"])