ACE3/addons/attach/functions/fnc_handleKilled.sqf

40 lines
920 B
Plaintext
Raw Normal View History

/*
* Author: PabstMirror
2015-08-29 14:38:57 +00:00
* Handles when vehicle or man is killed.
* Note: Runs where unit is local.
*
* Arguments:
* 0: DeadVehicle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [bob1] call ACE_attach_fnc_handleKilled
*
* Public: No
*/
#include "script_component.hpp"
params ["_deadUnit"];
2015-08-29 14:38:57 +00:00
TRACE_1("params",_deadUnit);
private ["_attachedList"];
_attachedList = _deadUnit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
{
2015-08-29 14:38:57 +00:00
_x params ["_xObject"];
TRACE_2("detaching",_xObject,_deadUnit);
detach _xObject;
2015-08-29 16:47:56 +00:00
//If it's a vehicle, also delete the attached
if (!(_deadUnit isKindOf "CAManBase")) then {
_xObject setPos ((getPos _deadUnit) vectorAdd [0, 0, -1000]);
[{deleteVehicle (_this select 0)}, [_xObject], 2] call EFUNC(common,waitAndExecute);
};
} forEach _attachedList;
_deadUnit setVariable [QGVAR(attached), nil, true];