2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-08-28 21:57:16 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
2015-08-29 14:38:57 +00:00
|
|
|
* Handles when vehicle or man is killed.
|
|
|
|
* Note: Runs where unit is local.
|
2015-08-28 21:57:16 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: DeadVehicle <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [bob1] call ACE_attach_fnc_handleKilled
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_deadUnit"];
|
2015-08-29 14:38:57 +00:00
|
|
|
TRACE_1("params",_deadUnit);
|
2015-08-28 21:57:16 +00:00
|
|
|
|
2016-09-04 14:44:22 +00:00
|
|
|
private _attachedList = _deadUnit getVariable [QGVAR(attached), []];
|
2015-08-28 21:57:16 +00:00
|
|
|
|
2016-09-04 14:44:22 +00:00
|
|
|
if (_attachedList isEqualTo []) exitWith {};
|
2015-08-28 21:57:16 +00:00
|
|
|
|
|
|
|
{
|
2015-08-29 14:38:57 +00:00
|
|
|
_x params ["_xObject"];
|
|
|
|
TRACE_2("detaching",_xObject,_deadUnit);
|
2015-08-28 21:57:16 +00:00
|
|
|
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]);
|
2016-05-22 13:27:24 +00:00
|
|
|
[{deleteVehicle (_this select 0)}, [_xObject], 2] call CBA_fnc_waitAndExecute;
|
2015-08-29 16:47:56 +00:00
|
|
|
};
|
2015-08-28 21:57:16 +00:00
|
|
|
} forEach _attachedList;
|
|
|
|
|
|
|
|
_deadUnit setVariable [QGVAR(attached), nil, true];
|