////////////////////////////////////////////////
// Revive Action Check
////////////////////////////////////////////////

private ["_target", "_isTargetUnconscious", "_isDragged"];

_return = false;
_isMedic = 0;
	
// Unit that will excute the action
_isPlayerUnconscious = player getVariable "STS24_isUnconscious";
//_isMedic = getNumber (configfile >> "CfgVehicles" >> typeOf player >> "attendant");
if (player isKindOf STS24_Medic1 || player isKindOf STS24_Medic2) then {_isMedic = 1};
_target = cursorTarget;

// Make sure player is alive and target is an injured unit
if( !alive player || _isPlayerUnconscious == 1 || STS24_isDragging || isNil "_target" || !alive _target || (!isPlayer _target && !STS24_Debugging) || (_target distance player) > 2 ) exitWith
{
	_return
};

_isTargetUnconscious = _target getVariable "STS24_isUnconscious";
_isDragged = _target getVariable "STS24_isDragged"; 
	
// Make sure target is unconscious and player is a medic 
if (_isTargetUnconscious == 1 && _isDragged == 0 && (_isMedic == 1 || STS24_ReviveMode > 0) ) then
{
	_return = true;

	// [ReviveMode] Check if player has a Medikit
	if ( STS24_ReviveMode == 2 && !("sc_defib" in (items player)) ) then
	{
		_return = false;
	};
};
	
_return
