ACE3/addons/map/functions/fnc_flashlightGlow.sqf
voiperr 52ea640c4b ace_map: More realistic flashlight glow + minor fix (#3824)
* -Converted flashlight glow object to chemlight type (emits light without sprite)
-Fixed issue where glow object was being deleted without being first detached

* Cleanup of temp classes.

* Spaces before and after =

* Moved effects into Effects.hpp.
2016-05-27 19:16:15 +02:00

39 lines
936 B
Plaintext

/*
* Author: voiper
* Add or remove global flashlight glow for when player is looking at map.
*
* Arguments:
* 0: Flashlight classname ("" for off) <STRING>
*
* Return value:
* None
*
* Example:
* ["ACE_Flashlight_MX991"] call ace_map_fnc_flashlightGlow;
*
* Public: No
*/
#include "script_component.hpp"
private ["_light", "_color", "_class"];
params ["_flashlight"];
_light = GVAR(glow);
if (!isNull _light) then {
detach _light;
deleteVehicle _light;
};
if (_flashlight != "") then {
_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];
_light = _class createVehicle [0,0,0];
_light attachTo [ACE_player, [0,0.1,-0.05], "neck"];
} else {
_light = objNull;
};
GVAR(glow) = _light;