mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'flashlight_housekeeping' of https://github.com/voiperr/ACE3 into voiperr-flashlight_housekeeping
This commit is contained in:
@ -1,25 +1,39 @@
|
||||
/*
|
||||
* Author: voioper
|
||||
* Switch flashlight.
|
||||
* Switch flashlight on/off.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Flashlight classname ("" for off) <STRING>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: New flashlight classname ("" for off) <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* ["ACE_Flashlight_MX991"] call ace_map_fnc_switchFlashlight;
|
||||
* [ACE_player, "ACE_Flashlight_MX991"] call ace_map_fnc_switchFlashlight;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_flashlight"];
|
||||
params ["_unit", "_newFlashlight"];
|
||||
|
||||
private _unitLight = _unit getVariable [QGVAR(flashlight), ["", objNull]];
|
||||
_unitLight params ["_flashlight", "_glow"];
|
||||
|
||||
GVAR(flashlightInUse) = _flashlight;
|
||||
if (GVAR(mapGlow)) then {
|
||||
[GVAR(flashlightInUse)] call FUNC(flashlightGlow);
|
||||
// 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);
|
||||
};
|
||||
playSound QGVAR(flashlightClick);
|
||||
|
||||
private _config = (configFile >> "CfgWeapons");
|
||||
|
||||
if (
|
||||
(getNumber (_config >> _newFlashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Sound") > 0) ||
|
||||
{getNumber (_config >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Sound") > 0}
|
||||
) then {
|
||||
playSound QGVAR(flashlightClick);
|
||||
};
|
||||
|
||||
_unit setVariable [QGVAR(flashlight), [_newFlashlight, _glow], true];
|
||||
|
Reference in New Issue
Block a user