ACE3/addons/minedetector/functions/fnc_playDetectorSound.sqf

43 lines
973 B
Plaintext
Raw Normal View History

2016-05-03 20:37:02 +00:00
/*
* Author: Glowbal
* Play the detector sound
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Sound class name <STRING>
*
* Return Value:
* None
*
* Example:
2016-05-07 17:08:36 +00:00
* [player, "ace_buzz_1"] call ace_minedetector_fnc_playDetectorSound
2016-05-03 20:37:02 +00:00
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_detectorSound"];
2016-06-16 15:33:21 +00:00
if (isNull _unit) exitWith {
2016-05-07 17:08:36 +00:00
ACE_LOGERROR_1("unit does not exist [%1]",_unit);
};
2016-06-16 15:33:21 +00:00
if (!alive _unit) exitWith {
2016-05-07 17:08:36 +00:00
ACE_LOGERROR_1("unit is not alive [%1]",_unit);
2016-05-03 20:37:02 +00:00
};
2016-06-16 15:33:21 +00:00
private _helperObject = _unit getVariable [QGVAR(helperLogic), objNull];
2016-05-12 17:44:43 +00:00
if (!isNull _helperObject) then {
deleteVehicle _helperObject;
};
_helperObject = "ACE_LogicDummy" createVehicleLocal (getPos _unit);
2016-05-03 20:37:02 +00:00
if !(isNull _helperObject) then {
2016-06-16 15:33:21 +00:00
_helperObject attachTo [_unit,[0,0,-3],""];
_unit setVariable [QGVAR(helperLogic), _helperObject];
2016-05-03 20:37:02 +00:00
[_helperObject, _unit] say3D _detectorSound;
2016-05-07 17:08:36 +00:00
} else {
ACE_LOGERROR_1("helper does not exist [%1]",_helperObject);
2016-05-03 20:37:02 +00:00
};