ACE3/addons/explosives/functions/fnc_canDefuse.sqf
Mike-MF cee187adac
General - Convert vehicle to objectParent (#9801)
Convert vehicle to objectParent
2024-03-26 09:54:06 -03:00

35 lines
962 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: Garth 'L-H' de Wet
* Whether a unit can perform the defuse action
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target (ACE_DefuseObject) <OBJECT>
*
* Return Value:
* Able to defuse <BOOL>
*
* Example:
* if ([player] call ACE_Explosives_fnc_canDefuse) then {hint "Can Defuse";};
*
* Public: Yes
*/
params ["_unit", "_target"];
TRACE_2("params",_unit,_target);
private _explosive = _target getVariable [QGVAR(Explosive), objNull];
if (isNull _explosive) exitWith {
deleteVehicle _target;
false
};
if (!isNull objectParent _unit || {(_unit call EFUNC(common,uniqueItems)) findAny GVAR(defusalKits) == -1}) exitWith {false};
if (GVAR(RequireSpecialist) && {!([_unit] call EFUNC(Common,isEOD))}) exitWith {false};
//Handle the naval mines (which doens't get turned into items when defused):
if ((_explosive isKindOf "UnderwaterMine_Range_Ammo") && {!mineActive _explosive}) exitWith {false};
true