ACE3/addons/map/functions/fnc_getUnitFlashlights.sqf

39 lines
850 B
Plaintext
Raw Normal View History

#include "script_component.hpp"
2015-08-11 17:49:39 +00:00
/*
* Author: voiper
* Check a unit for any flashlights that can be used on map.
*
* Arguments:
* 0: Unit to check <OBJECT>
*
2016-06-18 09:50:41 +00:00
* Return Value:
2015-08-11 17:49:39 +00:00
* Flashlight classnames (empty for none) <ARRAY>
*
* Example:
* player call ace_map_fnc_getUnitFlashlights
2015-08-11 17:49:39 +00:00
*
* Public: No
*/
params ["_unit"];
2015-11-23 23:47:58 +00:00
private _flashlights = [];
private _cfgWeapons = configFile >> "CfgWeapons";
2015-08-11 17:49:39 +00:00
{
private _weaponConfig = _cfgWeapons >> _x;
if (
-1 < [
_weaponConfig >> "ItemInfo" >> "FlashLight",
_weaponConfig >> "FlashLight"
] findIf {
isText (_x >> "ACE_Flashlight_Colour")
|| {!(getArray (_x >> "ambient") in [[], [0,0,0]])}
}
) then {
_flashlights pushBack _x;
2015-08-11 17:49:39 +00:00
};
} forEach ([_unit, true] call CBA_fnc_uniqueUnitItems);
2015-08-11 17:49:39 +00:00
2015-10-14 17:56:54 +00:00
_flashlights