ACE3/addons/attach/functions/fnc_handleKilled.sqf
Mike-MF 1c6c4d6bff
All - Fix parentheses around code (#10073)
* Fix Brackets around code

* Update fnc_handleFired.sqf

* Shouldn't have changed this one

---------

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
2024-06-18 14:08:03 +00:00

38 lines
894 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: PabstMirror
* 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
*/
params ["_deadUnit"];
TRACE_1("params",_deadUnit);
private _attachedList = _deadUnit getVariable [QGVAR(attached), []];
if (_attachedList isEqualTo []) exitWith {};
{
_x params ["_xObject"];
TRACE_2("detaching",_xObject,_deadUnit);
detach _xObject;
//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 CBA_fnc_waitAndExecute;
};
} forEach _attachedList;
_deadUnit setVariable [QGVAR(attached), nil, true];