<commit_before>// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
//	@file Name: FAR_HandleDamage_EH.sqf
//	@file Author: Farooq, AgentRev

#include "FAR_defines.sqf"
#include "gui_defines.hpp"

//private ["_unit", "_selection", "_damage", "_source", "_fatalHit", "_killerVehicle", "_oldDamage"];

_unit = _this select 0;
//_selection = _this select 1;
//_damage = _this select 2;
_source = _this select 3;
_ammo = _this select 4;

// a critical hit is if this type of selection can trigger death upon suffering damage >= 1 (usually all of them except "hands", "arms", and "legs")
// this is intercepted to prevent engine-triggered death and put the unit in revive mode instead; behavior and selections can change with game updates

_criticalHit = (_selection in ["","body","head","spine1","spine2","spine3","pelvis","neck","face_hub"]);
_fatalHit = (_damage >= 1 && alive _unit && _criticalHit);

// Find suspects
if (_fatalHit && !isNull _source && isNil {_unit getVariable "FAR_killerVehicle"}) then
{
	[_unit, _source, _ammo] call FAR_setKillerInfo;
};

//diag_log format ["FAR_HandleDamage_EH %1 - alive: %2", [_unit, _selection, _damage, _source, _ammo], alive _unit];

_reviveReady = _unit getVariable ["FAR_reviveModeReady", false];
_skipRevive = false;

// skip revive if headshot by another player with non-explosive ammo (regular bullets and sub-50mm APDS rounds)
if (["A3W_headshotNoRevive"] call isConfigOn && _fatalHit &&
   {_selection == "head" && _ammo select [0,2] == "B_" && {getNumber (configfile >> "CfgAmmo" >> _ammo >> "explosive") <= 0 && !isNil {_unit getVariable "FAR_killerVehicle"} && !_reviveReady}}) then
{
	_killer = _unit call FAR_findKiller;

	if (!isNull _killer) then
	{
		_killerGroup = group _killer;
		_killerSide = side _killerGroup;
		_unitGroup = group _unit;
		_unitSide = side _unitGroup;

		_unit setVariable ["FAR_killerPrimeSuspect", _killer];

		if (isPlayer _killer && {_killerSide != _unitSide || (!(_unitSide in [BLUFOR,OPFOR]) && _killerGroup != _unitGroup)}) then // check if enemy
		{
			_skipRevive = true;
			diag_log format ["HEADSHOT by [%1] with [%2]", _killer, _ammo];
		};
	};
};

if (UNCONSCIOUS(_unit) && !_skipRevive) then<commit_msg>Added face_hub to PvP headshot processing<commit_after>// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
//	@file Name: FAR_HandleDamage_EH.sqf
//	@file Author: Farooq, AgentRev

#include "FAR_defines.sqf"
#include "gui_defines.hpp"

//private ["_unit", "_selection", "_damage", "_source", "_fatalHit", "_killerVehicle", "_oldDamage"];

_unit = _this select 0;
//_selection = _this select 1;
//_damage = _this select 2;
_source = _this select 3;
_ammo = _this select 4;

// a critical hit is if this type of selection can trigger death upon suffering damage >= 1 (usually all of them except "hands", "arms", and "legs")
// this is intercepted to prevent engine-triggered death and put the unit in revive mode instead; behavior and selections can change with game updates

_criticalHit = (_selection in ["","body","head","spine1","spine2","spine3","pelvis","neck","face_hub"]);
_fatalHit = (_damage >= 1 && alive _unit && _criticalHit);

// Find suspects
if (_fatalHit && !isNull _source && isNil {_unit getVariable "FAR_killerVehicle"}) then
{
	[_unit, _source, _ammo] call FAR_setKillerInfo;
};

//diag_log format ["FAR_HandleDamage_EH %1 - alive: %2", [_unit, _selection, _damage, _source, _ammo], alive _unit];

_reviveReady = _unit getVariable ["FAR_reviveModeReady", false];
_skipRevive = false;

// skip revive if headshot by another player with non-explosive ammo (regular bullets and sub-50mm APDS rounds)
if (["A3W_headshotNoRevive"] call isConfigOn && _fatalHit &&
   {_selection in ["head","face_hub"] && _ammo select [0,2] == "B_" && {getNumber (configfile >> "CfgAmmo" >> _ammo >> "explosive") <= 0 && !isNil {_unit getVariable "FAR_killerVehicle"} && !_reviveReady}}) then
{
	_killer = _unit call FAR_findKiller;

	if (!isNull _killer) then
	{
		_killerGroup = group _killer;
		_killerSide = side _killerGroup;
		_unitGroup = group _unit;
		_unitSide = side _unitGroup;

		_unit setVariable ["FAR_killerPrimeSuspect", _killer];

		if (isPlayer _killer && {_killerSide != _unitSide || (!(_unitSide in [BLUFOR,OPFOR]) && _killerGroup != _unitGroup)}) then // check if enemy
		{
			_skipRevive = true;
			diag_log format ["HEADSHOT by [%1] with [%2]", _killer, _ammo];
		};
	};
};

if (UNCONSCIOUS(_unit) && !_skipRevive) then
{'fraction_non_alphanumeric': 0.20196038390851542, 'fraction_numerical': 0.010618746171125178, 'mean_word_length': 5.394255874673629, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '7307905', 'n_tokens_mistral': 1705, 'n_tokens_neox': 1588, 'n_words': 485}