2015-01-12 09:48:26 +00:00
|
|
|
/*
|
2015-02-02 08:35:17 +00:00
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Starts defusing an explosive
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Target explosive <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, ACE_Interaction_Target] call ACE_Explosives_fnc_StartDefuse;
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
2015-01-13 21:21:31 +00:00
|
|
|
#include "script_component.hpp"
|
2015-04-01 18:43:18 +00:00
|
|
|
EXPLODE_2_PVT(_this,_unit,_target);
|
|
|
|
_target = attachedTo (_target);
|
2015-01-12 09:48:26 +00:00
|
|
|
|
|
|
|
_fnc_DefuseTime = {
|
2015-04-06 20:20:11 +00:00
|
|
|
EXPLODE_2_PVT(_this,_specialist,_target);
|
2015-01-12 09:48:26 +00:00
|
|
|
|
2015-04-06 20:20:11 +00:00
|
|
|
_defuseTime = 5;
|
|
|
|
if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime")) then {
|
|
|
|
_defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime");
|
|
|
|
};
|
|
|
|
if (!_specialist && {GVAR(PunishNonSpecialists)}) then {
|
|
|
|
_defuseTime = _defuseTime * 1.5;
|
|
|
|
};
|
|
|
|
_defuseTime
|
2015-01-12 09:48:26 +00:00
|
|
|
};
|
|
|
|
_actionToPlay = "MedicOther";
|
|
|
|
if (STANCE _unit == "Prone") then {
|
2015-04-06 20:20:11 +00:00
|
|
|
_actionToPlay = "PutDown";
|
2015-01-12 09:48:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (ACE_player != _unit) then {
|
2015-04-06 20:20:11 +00:00
|
|
|
// If the unit is a player, call the function on the player.
|
|
|
|
if (isPlayer _unit) then {
|
|
|
|
[[_unit, _target], QFUNC(startDefuse), _unit] call EFUNC(common,execRemoteFnc);
|
|
|
|
} else {
|
|
|
|
// TODO: use scheduled delay execution
|
|
|
|
[_unit, _target, [[_unit] call EFUNC(Common,isEOD), _target] call _fnc_DefuseTime] spawn {
|
|
|
|
(_this select 0) playActionNow _actionToPlay;
|
|
|
|
(_this select 0) disableAI "MOVE";
|
|
|
|
(_this select 0) disableAI "TARGET";
|
|
|
|
sleep (_this select 2);
|
|
|
|
[(_this select 0), (_this select 1)] call FUNC(defuseExplosive);
|
|
|
|
(_this select 0) enableAI "MOVE";
|
|
|
|
(_this select 0) enableAI "TARGET";
|
|
|
|
};
|
|
|
|
};
|
2015-01-12 09:48:26 +00:00
|
|
|
} else {
|
2015-04-06 20:20:11 +00:00
|
|
|
_unit playActionNow _actionToPlay;
|
|
|
|
private ["_defuseSeconds", "_isEOD"];
|
|
|
|
_isEOD = [_unit] call EFUNC(Common,isEOD);
|
|
|
|
_defuseSeconds = [_isEOD, _target] call _fnc_DefuseTime;
|
|
|
|
if (_isEOD || {!GVAR(RequireSpecialist)}) then {
|
|
|
|
[_defuseSeconds, [_unit,_target], {(_this select 0) call FUNC(defuseExplosive)}, {}, (localize "STR_ACE_Explosives_DefusingExplosive")] call EFUNC(common,progressBar);
|
|
|
|
};
|
2015-01-12 09:48:26 +00:00
|
|
|
};
|