<commit_before>// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 <EMAIL> *
// ******************************************************************************************
#include "FAR_defines.sqf"

#define FAR_Max_Distance 2.5

////////////////////////////////////////////////
// Player Actions
////////////////////////////////////////////////
FAR_Player_Actions =
{
	if (alive player && player isKindOf "Man") then
	{
		// addAction args: title, filename, (arguments, priority, showWindow, hideOnUse, shortcut, condition, positionInModel, radius, radiusView, showIn3D, available, textDefault, textToolTip)
		{ [player, _x] call fn_addManagedAction } forEach
		[
			["<t color='#FF0000'>" + "Finish off" + "</t>", "addons\FAR_revive\FAR_handleAction.sqf", ["action_slay"], 101, true, true, "", FAR_Check_Slay],
			["<t color='#00FF00'>" + "Revive" + "</t>", "addons\FAR_revive\FAR_handleAction.sqf", ["action_revive"], 100, true, true, "", FAR_Check_Revive],
			["<t color='#00FF00'>" + "Stabilize" + "</t>", "addons\FAR_revive\FAR_handleAction.sqf", ["action_stabilize"], 99, true, true, "", FAR_Check_Stabilize],
			["<t color='#FFFF00'>" + "Drag" + "</t>", "addons\FAR_revive\FAR_handleAction.sqf", ["action_drag"], 98, true, true, "", FAR_Check_Dragging],
			["<t color='#FFFF00'>" + "Eject injured units from vehicle" + "</t>", "addons\FAR_revive\FAR_handleAction.sqf", ["action_eject"], 5.2, false, true, "", FAR_Check_Eject_Injured]
		];
	};
}
call mf_compile;

////////////////////////////////////////////////
// Handle Death
////////////////////////////////////////////////
FAR_HandleDamage_EH = "addons\far_revive\FAR_HandleDamage_EH.sqf" call mf_compile;
//FAR_fnc_headshotHitPartEH = "addons\far_revive\FAR_headshotHitPartEH.sqf" call mf_compile;

////////////////////////////////////////////////
// Make Player Unconscious
////////////////////////////////////////////////
FAR_Player_Unconscious = "addons\far_revive\FAR_Player_Unconscious.sqf" call mf_compile;

////////////////////////////////////////////////
// Suspect Tracking
////////////////////////////////////////////////
//FAR_setKillerInfo = "addons\far_revive\FAR_setKillerInfo.sqf" call mf_compile; // done from globalCompile.sqf instead, due to use by server

////////////////////////////////////////////////
// Revive Player
////////////////////////////////////////////////
FAR_HandleRevive =
{
	[_this select 0, true] call FAR_HandleTreating;
}
call mf_compile;

////////////////////////////////////////////////
// Stabilize Player
////////////////////////////////////////////////
FAR_HandleStabilize =
{
	[_this select 0, false] call FAR_HandleTreating;
}
call mf_compile;

////////////////////////////////////////////////
// Revive or Stabilize Player
////////////////////////////////////////////////
FAR_HandleTreating =
{
	private "_treatThread";
	_treatThread = _this spawn
	{
		params ["_target", ["_revive",false]]; // _revive false = stabilize
		private "_medicMove";

		if (alive _target) then
		{
			_target setVariable ["FAR_treatedBy", player, true];
			player setVariable ["FAR_isTreating", _target];

			_medicMove = format ["AinvPknlMstpSlayW%1Dnon_medic", [player, true] call getMoveWeapon];
			player playMove _medicMove;

			waitUntil {sleep 0.1; animationState player == _medicMove || !CAN_PERFORM};
			waitUntil {sleep 0.1; animationState player != _medicMove || !CAN_PERFORM};

			if (CAN_PERFORM) then
			{
				if (_revive) then
				{
					_target setVariable ["FAR_isUnconscious", 0, true];
					[player, "reviveCount", 1] call fn_addScore;
				}
				else
				{
					_target setVariable ["FAR_isStabilized", 1, true];
					_target setVariable ["FAR_handleStabilize", true, true];
				};

				if !("Medikit" in items player) then
				{<commit_msg>Added progress dialog to revive<commit_after>// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 <EMAIL> *
// ******************************************************************************************
#include "FAR_defines.sqf"

#define FAR_Max_Distance 2.5
#define FAR_Revive_Duration 10 //seconds

////////////////////////////////////////////////
// Player Actions
////////////////////////////////////////////////
FAR_Player_Actions =
{
	if (alive player && player isKindOf "Man") then
	{
		// addAction args: title, filename, (arguments, priority, showWindow, hideOnUse, shortcut, condition, positionInModel, radius, radiusView, showIn3D, available, textDefault, textToolTip)
		{ [player, _x] call fn_addManagedAction } forEach
		[
			["<t color='#FF0000'>" + "Finish off" + "</t>", "addons\FAR_revive\FAR_handleAction.sqf", ["action_slay"], 101, true, true, "", FAR_Check_Slay],
			["<t color='#00FF00'>" + "Revive" + "</t>", "addons\FAR_revive\FAR_handleAction.sqf", ["action_revive"], 100, true, true, "", FAR_Check_Revive],
			["<t color='#00FF00'>" + "Stabilize" + "</t>", "addons\FAR_revive\FAR_handleAction.sqf", ["action_stabilize"], 99, true, true, "", FAR_Check_Stabilize],
			["<t color='#FFFF00'>" + "Drag" + "</t>", "addons\FAR_revive\FAR_handleAction.sqf", ["action_drag"], 98, true, true, "", FAR_Check_Dragging],
			["<t color='#FFFF00'>" + "Eject injured units from vehicle" + "</t>", "addons\FAR_revive\FAR_handleAction.sqf", ["action_eject"], 5.2, false, true, "", FAR_Check_Eject_Injured]
		];
	};
}
call mf_compile;

////////////////////////////////////////////////
// Handle Death
////////////////////////////////////////////////
FAR_HandleDamage_EH = "addons\far_revive\FAR_HandleDamage_EH.sqf" call mf_compile;
//FAR_fnc_headshotHitPartEH = "addons\far_revive\FAR_headshotHitPartEH.sqf" call mf_compile;

////////////////////////////////////////////////
// Make Player Unconscious
////////////////////////////////////////////////
FAR_Player_Unconscious = "addons\far_revive\FAR_Player_Unconscious.sqf" call mf_compile;

////////////////////////////////////////////////
// Suspect Tracking
////////////////////////////////////////////////
//FAR_setKillerInfo = "addons\far_revive\FAR_setKillerInfo.sqf" call mf_compile; // done from globalCompile.sqf instead, due to use by server

////////////////////////////////////////////////
// Revive Player
////////////////////////////////////////////////
FAR_HandleRevive =
{
	[_this select 0, true] call FAR_HandleTreating;
}
call mf_compile;

////////////////////////////////////////////////
// Stabilize Player
////////////////////////////////////////////////
FAR_HandleStabilize =
{
	[_this select 0, false] call FAR_HandleTreating;
}
call mf_compile;

////////////////////////////////////////////////
// Revive or Stabilize Player
////////////////////////////////////////////////
FAR_HandleTreating =
{
	private "_treatThread";
	_treatThread = _this spawn
	{
		params ["_target", ["_revive",false]]; // _revive false = stabilize
		private "_medicMove";

		if (alive _target) then
		{
			_target setVariable ["FAR_treatedBy", player, true];
			player setVariable ["FAR_isTreating", _target];

			//_medicMove = format ["AinvPknlMstpSlayW%1Dnon_medic", [player, true] call getMoveWeapon];
			//player playMove _medicMove;

			_checks =
			{
				params ["_progress", "_target", "_isRevive"];
				private _failed = true;
				private _text = "Action failed!";

				if (CAN_PERFORM) then
				{
					_failed = false;
					_text = format [["Stabilizing %1%2 complete","Reviving %1%2 complete"] select _isRevive, floor (_progress * 100), "%"];
				};

				[_failed, _text];
			};

			_success = [FAR_Revive_Duration, "", _checks, [_target, _revive]] call a3w_actions_start;

			if (_success && CAN_PERFORM) then
			{
				if (_revive) then
				{
					_target setVariable ["FAR_isUnconscious", 0, true];
					[player, "reviveCount", 1] call fn_addScore;
				}
				else
				{
					_target setVariable ["FAR_isStabilized", 1, true];
					_target setVariable ["FAR_handleStabilize", true, true];
				};

				if !("Medikit" in items player) then
				{
{'fraction_non_alphanumeric': 0.3246015074755962, 'fraction_numerical': 0.012109230198937353, 'mean_word_length': 2.2414897877452944, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4996277', 'n_tokens_mistral': 2726, 'n_tokens_neox': 2408, 'n_words': 535}