/*
	FILE: fnc_fired.sqf

	Name: tbd_m119_m119_fnc_fired

	Author(s):
		ilbinek

	Description:
		Fired EH for the M119. This script is called when the M119 is fired. It animates the recoil of the M119.

	Parameters:
		_arty	- object	- M119 that fired

	Returns:
		Nothing
	
	Examples:
		> [_arty] call tbd_m119_m119_fnc_fired;

	Public:
		No
*/

#include "..\script_component.hpp"

params ["_arty"];
_arty animateSource ["recoil_rest_source", 0.5, 5];
_arty animateSource ["recoil_barrel_source", 2, 20];

[{params ["_arty"]; _arty animateSource ["recoil_barrel_source", 0];}, [_arty], 0.3] call CBA_fnc_waitAndExecute;
[{params ["_arty"]; _arty animateSource ["recoil_rest_source", 0, 0.2];}, [_arty], 0.1] call CBA_fnc_waitAndExecute;

_arty setVariable [QGVAR(fired), true, true];

private _mags = _arty magazinesTurret [0];
{
	_arty removeMagazinesTurret [_x, [0]];
} forEach _mags;

_arty animateSource ["magazine_hide_source", 1, true];
_arty animateSource ["magazine_load_source", 0, true];
