ACE3/addons/explosives/functions/fnc_canDefuse.sqf
Garth L-H de Wet 452947148a Random clean ups and explosive can now detonate with their object.
Defuse object doesn't get cleaned up on it's own. But if a player comes near it with interact menu on it will get cleaned up.
2015-04-01 20:43:18 +02:00

29 lines
694 B
Plaintext

/*
* 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
*/
#include "script_component.hpp"
private ["_specialist"];
EXPLODE_2_PVT(_this,_unit,_target);
if (isNull(_target getVariable [QGVAR(Explosive),objNull])) exitWith {
deleteVehicle _target;
false
};
if (vehicle _unit != _unit || {!("ACE_DefusalKit" in (items _unit))}) exitWith {false};
_isSpecialist = [_unit] call EFUNC(Common,isEOD);
if (GVAR(RequireSpecialist) && {!_isSpecialist}) exitWith {false};
true