mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
66 lines
2.1 KiB
Plaintext
66 lines
2.1 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Garth 'L-H' de Wet
|
|
* Starts defusing an explosive
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
* 1: Target explosive <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [player, ACE_Interaction_Target] call ACE_Explosives_fnc_StartDefuse;
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
params ["_unit", "_target"];
|
|
TRACE_2("params",_unit,_target);
|
|
|
|
_target = attachedTo (_target);
|
|
|
|
private _fnc_DefuseTime = {
|
|
params ["_specialist", "_target"];
|
|
TRACE_2("defuseTime",_specialist,_target);
|
|
private _defuseTime = 5;
|
|
if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> QGVAR(DefuseTime))) then {
|
|
_defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> QGVAR(DefuseTime));
|
|
};
|
|
if (!_specialist && {GVAR(PunishNonSpecialists)}) then {
|
|
_defuseTime = _defuseTime * 1.5;
|
|
};
|
|
_defuseTime
|
|
};
|
|
private _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 {
|
|
[QGVAR(startDefuse), [_unit, _target], _unit] call CBA_fnc_targetEvent;
|
|
} else {
|
|
[_unit, _actionToPlay] call EFUNC(common,doGesture);
|
|
_unit disableAI "MOVE";
|
|
_unit disableAI "TARGET";
|
|
private _defuseTime = [[_unit] call EFUNC(Common,isEOD), _target] call _fnc_DefuseTime;
|
|
[{
|
|
params ["_unit", "_target"];
|
|
TRACE_2("defuse finished",_unit,_target);
|
|
[_unit, _target] call FUNC(defuseExplosive);
|
|
_unit enableAI "MOVE";
|
|
_unit enableAI "TARGET";
|
|
}, [_unit, _target], _defuseTime] call CBA_fnc_waitAndExecute;
|
|
};
|
|
} else {
|
|
[_unit, _actionToPlay] call EFUNC(common,doGesture);
|
|
private _isEOD = [_unit] call EFUNC(Common,isEOD);
|
|
private _defuseTime = [_isEOD, _target] call _fnc_DefuseTime;
|
|
if (_isEOD || {!GVAR(RequireSpecialist)}) then {
|
|
[_defuseTime, [_unit,_target], {(_this select 0) call FUNC(defuseExplosive)}, {}, (localize LSTRING(DefusingExplosive)), {true}, ["isNotSwimming"]] call EFUNC(common,progressBar);
|
|
};
|
|
};
|