2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-02-04 00:16:47 +00:00
|
|
|
/*
|
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Dials the number passed and detonates the explosive.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit to do dialing <OBJECT>
|
|
|
|
* 1: Code to dial <STRING>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [ace_player,"2131"] call ACE_explosives_fnc_dialPhone;
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
2015-08-15 19:35:33 +00:00
|
|
|
|
|
|
|
params ["_unit", "_code"];
|
|
|
|
TRACE_2("params",_unit,_code);
|
|
|
|
|
2015-02-04 00:16:47 +00:00
|
|
|
if (_unit getVariable [QGVAR(Dialing),false]) exitWith {};
|
|
|
|
if !(alive _unit) exitWith {};
|
|
|
|
_unit setVariable [QGVAR(Dialing), true, true];
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _ran = (ceil(random 8)) + 1;
|
|
|
|
private _arr = [];
|
|
|
|
for "_i" from 1 to _ran do {
|
2015-04-06 16:22:43 +00:00
|
|
|
_arr = _arr + ['.','..','...',''];
|
2015-02-04 00:16:47 +00:00
|
|
|
};
|
|
|
|
if (_unit == ace_player) then {
|
2015-04-06 16:22:43 +00:00
|
|
|
ctrlSetText [1400,"Calling"];
|
|
|
|
[FUNC(dialingPhone), 0.25, [_unit,4,_arr,_code]] call CALLSTACK(CBA_fnc_addPerFrameHandler);
|
2015-02-04 00:16:47 +00:00
|
|
|
} else {
|
2017-10-10 14:39:59 +00:00
|
|
|
private _explosive = [_code] call FUNC(getSpeedDialExplosive);
|
2015-04-06 16:22:43 +00:00
|
|
|
if ((count _explosive) > 0) then {
|
|
|
|
[{
|
2022-09-10 18:02:53 +00:00
|
|
|
params ["_unit", "_item"];
|
|
|
|
|
|
|
|
if ([_unit, -1, (_item # 0), (_item # 2), "ACE_Cellphone"] call FUNC(checkDetonateHandlers)) then {
|
|
|
|
playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)), objNull, false, (getPosASL (_item # 0)), 3.16228, 1, 75];
|
|
|
|
};
|
|
|
|
|
|
|
|
_unit setVariable [QGVAR(Dialing), false, true];
|
|
|
|
}, [_unit, _explosive], 0.25 * (count _arr - 4)] call CBA_fnc_waitAndExecute;
|
|
|
|
|
2021-11-07 23:29:27 +00:00
|
|
|
[_explosive select 0,(0.25 * (count _arr - 1)) + (_explosive select 2), "ACE_Cellphone", _unit] call FUNC(startTimer);
|
2015-04-06 16:22:43 +00:00
|
|
|
};
|
2015-02-04 00:16:47 +00:00
|
|
|
};
|