ACE3/addons/minedetector/functions/fnc_enableDetector.sqf

36 lines
836 B
Plaintext
Raw Normal View History

2016-05-03 20:37:02 +00:00
/*
* Author: Glowbal
* Enables the mine detector
*
* Arguments:
* 0: Unit <OBJECT>
* 1: detecter type <STRING>
*
* Return Value:
* None
*
* Example:
* [UNIT, DETECTOR_CLASS_NAME] call ace_minedetector_fnc_enableDetector
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_detectorType"];
2016-07-07 15:38:53 +00:00
if !(local _unit) then {
[QGVAR(enableDetector), [_unit, _detectorType], _unit] call CBA_fnc_targetEvent;
};
_unit setVariable [format[QGVAR(enable_%1), _detectorType], true, true];
2016-05-03 20:37:02 +00:00
if (_unit == ACE_player) then {
playSound "ACE_Sound_Click";
};
2016-06-11 19:57:04 +00:00
[QGVAR(detectorEnabled), [_unit, _detectorType]] call CBA_fnc_localEvent;
2016-07-07 15:38:53 +00:00
private _config = [_detectorType] call FUNC(getDetectorConfig);
[FUNC(detectorLoop), 0.05, [_unit, _detectorType, _config, CBA_missionTime - 0.25]] call CBA_fnc_addPerFrameHandler;