ACE3/addons/map/functions/fnc_flashlightGlow.sqf

39 lines
936 B
Plaintext
Raw Permalink Normal View History

2015-08-11 17:49:39 +00:00
/*
* Author: voiper
* Add or remove global flashlight glow for when player is looking at map.
*
* Arguments:
* 0: Flashlight classname ("" for off) <STRING>
*
2016-06-18 09:50:41 +00:00
* Return Value:
2015-08-11 17:49:39 +00:00
* None
*
* Example:
* ["ACE_Flashlight_MX991"] call ace_map_fnc_flashlightGlow;
*
* Public: No
*/
#include "script_component.hpp"
2015-10-14 17:56:54 +00:00
private ["_light", "_color", "_class"];
2015-08-11 17:49:39 +00:00
params ["_flashlight"];
_light = GVAR(glow);
if (!isNull _light) then {
detach _light;
deleteVehicle _light;
};
2015-08-11 17:49:39 +00:00
if (_flashlight != "") then {
2015-10-14 17:56:54 +00:00
_color = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour");
if !(_color in ["white", "red", "green", "blue", "yellow"]) then {_color = "white"};
_class = format["ACE_FlashlightProxy_%1", _color];
2015-08-11 17:49:39 +00:00
_light = _class createVehicle [0,0,0];
_light attachTo [ACE_player, [0,0.1,-0.05], "neck"];
2015-08-11 17:49:39 +00:00
} else {
_light = objNull;
};
GVAR(glow) = _light;