2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-02 08:35:17 +00:00
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Whether a unit can perform the defuse action
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Able to defuse <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* if ([player] call ACE_Explosives_fnc_canDefuse) then {hint "Can Defuse";};
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
2015-01-13 21:21:31 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
private "_unit";
|
|
|
|
_unit = _this select 0;
|
2015-01-12 09:48:26 +00:00
|
|
|
if (vehicle _unit != _unit || {!("ACE_DefusalKit" in (items _unit))}) exitWith {false};
|
2015-01-12 20:39:37 +00:00
|
|
|
_isSpecialist = [_unit] call EFUNC(Common,isEOD);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-12 09:48:26 +00:00
|
|
|
if (GVAR(RequireSpecialist) && {!_isSpecialist}) exitWith {false};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_timeBombCore = nearestObject [_unit, "TimeBombCore"];
|
2015-02-01 18:38:15 +00:00
|
|
|
_mineBase = nearestObject [_unit, "MineBase"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_distCore = _unit distance _timeBombCore;
|
|
|
|
_distBase = _unit distance _mineBase;
|
|
|
|
_distance = 10;
|
|
|
|
if (_distCore < _distBase) then {
|
|
|
|
_distance = _distCore;
|
2015-01-15 19:13:12 +00:00
|
|
|
EGVAR(interaction,Target) = _timeBombCore;
|
2015-01-11 16:42:31 +00:00
|
|
|
}else{
|
|
|
|
_distance = _distBase;
|
2015-01-15 19:13:12 +00:00
|
|
|
EGVAR(interaction,Target) = _mineBase;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
if (isNil "_distance") exitWith {false};
|
|
|
|
_distance < 4
|