2015-01-12 09:48:26 +00:00
|
|
|
/*
|
|
|
|
Name: ACE_Explosives_fnc_StartDefuse
|
|
|
|
|
|
|
|
Author: Garth de Wet (LH)
|
|
|
|
|
|
|
|
Description:
|
|
|
|
Starts defusing an explosive
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
0: OBJECT - Unit to defuse explosive
|
|
|
|
1: OBJECT - Target explosive
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Nothing
|
|
|
|
|
|
|
|
Example:
|
|
|
|
[player, ACE_Interaction_Target] call ACE_Explosives_fnc_StartDefuse;
|
|
|
|
*/
|
2015-01-13 21:21:31 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-12 09:48:26 +00:00
|
|
|
private ["_unit","_target"];
|
|
|
|
_unit = _this select 0;
|
|
|
|
_target = _this select 1;
|
|
|
|
|
|
|
|
_fnc_DefuseTime = {
|
|
|
|
_target = _this select 1;
|
|
|
|
|
|
|
|
_defuseTime = 5;
|
|
|
|
if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime")) then {
|
|
|
|
_defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime");
|
|
|
|
};
|
|
|
|
if (!(_this select 0) && {GVAR(PunishNonSpecialists)}) then {
|
|
|
|
_defuseTime = _defuseTime * 1.5;
|
|
|
|
};
|
|
|
|
_defuseTime
|
|
|
|
};
|
|
|
|
_actionToPlay = "MedicOther";
|
|
|
|
if (STANCE _unit == "Prone") then {
|
|
|
|
_actionToPlay = "PutDown";
|
|
|
|
};
|
|
|
|
|
|
|
|
if (ACE_player != _unit) then {
|
|
|
|
// If the unit is a player, call the function on the player.
|
|
|
|
if (isPlayer _unit) then {
|
2015-01-14 13:13:04 +00:00
|
|
|
[[_unit, _target], QFUNC(startDefuse), _unit] call EFUNC(common,execRemoteFnc);
|
2015-01-12 09:48:26 +00:00
|
|
|
} else {
|
|
|
|
// TODO: use scheduled delay execution
|
2015-01-12 20:39:37 +00:00
|
|
|
[_unit, _target, [[_unit] call EFUNC(Common,isEOD), _target] call _fnc_DefuseTime] spawn {
|
2015-01-12 09:48:26 +00:00
|
|
|
(_this select 0) playActionNow _actionToPlay;
|
|
|
|
(_this select 0) disableAI "MOVE";
|
|
|
|
(_this select 0) disableAI "TARGET";
|
|
|
|
sleep (_this select 2);
|
2015-01-13 21:49:27 +00:00
|
|
|
[(_this select 0), (_this select 1)] call FUNC(defuseExplosive);
|
2015-01-12 09:48:26 +00:00
|
|
|
(_this select 0) enableAI "MOVE";
|
|
|
|
(_this select 0) enableAI "TARGET";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
_unit playActionNow _actionToPlay;
|
|
|
|
if (GVAR(RequireSpecialist)) then {
|
2015-01-12 20:39:37 +00:00
|
|
|
if ([_unit] call EFUNC(Common,isEOD)) then {
|
2015-01-12 09:48:26 +00:00
|
|
|
[[true, _target] call _fnc_DefuseTime, [_unit,_target],
|
2015-01-14 13:13:04 +00:00
|
|
|
QFUNC(defuseExplosive), localize "STR_ACE_Explosives_DefusingExplosive"] call EFUNC(common,progressBar);
|
2015-01-12 09:48:26 +00:00
|
|
|
};
|
|
|
|
} else {
|
2015-01-12 20:39:37 +00:00
|
|
|
[[([_unit] call EFUNC(Common,isEOD)), _target] call _fnc_DefuseTime, [_unit,_target],
|
2015-01-14 13:13:04 +00:00
|
|
|
QFUNC(defuseExplosive), localize "STR_ACE_Explosives_DefusingExplosive"] call EFUNC(common,progressBar);
|
2015-01-12 09:48:26 +00:00
|
|
|
};
|
|
|
|
};
|