#include "..\script_component.hpp"

/*
 * Author: IDSolutions
 * Handles the unit's death
 *
 * Arguments:
 * 0: Unit <OBJECT>
 * 1: Killer <OBJECT>
 * 2: Instigator <OBJECT>
 * 3: Use Effects <BOOLEAN>
 *
 * Return Value:
 * None
 *
 * Example:
 * [player, objNull, objNull, true] call forge_client_medical_fnc_onKilled;
 *
 * Public: Yes
 */

params ["_unit", "_killer", "_instigator", "_useEffects"];

if (!isPlayer _unit) exitWith {};

private _unitPos = getPosATL _unit;
private _bodyBag = createVehicle [QCLASS(bodyBag), _unitPos, [], 0, "NONE"];

[_unit] call FUNC(saveDroppedWeapons);
[_unit, _bodyBag] call FUNC(moveInventory);