mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
A3 check if gunlight is turned on
This commit is contained in:
parent
97776c168b
commit
1b3dcfc07b
@ -6,6 +6,7 @@ LOG(MSG_INIT);
|
||||
|
||||
PREP(determineMapLight);
|
||||
PREP(determineZoom);
|
||||
PREP(isGunLightOn);
|
||||
PREP(updateMapFx);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -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);
|
||||
|
42
addons/mapfx/functions/fnc_isGunLightOn.sqf
Normal file
42
addons/mapfx/functions/fnc_isGunLightOn.sqf
Normal 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"])
|
Loading…
Reference in New Issue
Block a user