2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-08-11 17:49:39 +00:00
|
|
|
/*
|
2018-10-25 16:39:27 +00:00
|
|
|
* Author: voiper
|
2016-06-12 22:31:11 +00:00
|
|
|
* Switch flashlight on/off.
|
2015-08-11 17:49:39 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2016-06-18 00:18:06 +00:00
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: New flashlight classname ("" for off) <STRING>
|
2015-08-11 17:49:39 +00:00
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2015-08-11 17:49:39 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2016-06-18 00:18:06 +00:00
|
|
|
* [ACE_player, "ACE_Flashlight_MX991"] call ace_map_fnc_switchFlashlight;
|
2015-08-11 17:49:39 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2016-06-18 00:18:06 +00:00
|
|
|
params ["_unit", "_newFlashlight"];
|
|
|
|
|
|
|
|
private _unitLight = _unit getVariable [QGVAR(flashlight), ["", objNull]];
|
|
|
|
_unitLight params ["_flashlight", "_glow"];
|
2015-08-11 17:49:39 +00:00
|
|
|
|
|
|
|
if (GVAR(mapGlow)) then {
|
2016-06-18 00:18:06 +00:00
|
|
|
// we don't want to set the PVAR twice in a row, so tell this func not to set it
|
|
|
|
_glow = [_unit, _newFlashlight, false] call FUNC(flashlightGlow);
|
2015-08-11 17:49:39 +00:00
|
|
|
};
|
2016-06-12 22:31:11 +00:00
|
|
|
|
2018-10-25 16:39:27 +00:00
|
|
|
if (-1 < [_newFlashlight, _flashlight] findIf {[_unit, _x] call FUNC(needPlaySound)}) then {
|
2016-06-12 22:31:11 +00:00
|
|
|
playSound QGVAR(flashlightClick);
|
|
|
|
};
|
|
|
|
|
2016-06-18 00:18:06 +00:00
|
|
|
_unit setVariable [QGVAR(flashlight), [_newFlashlight, _glow], true];
|