diff --git a/addons/medical/functions/fnc_handleDamage_advanced.sqf b/addons/medical/functions/fnc_handleDamage_advanced.sqf index 559c52709e..211bf44fee 100644 --- a/addons/medical/functions/fnc_handleDamage_advanced.sqf +++ b/addons/medical/functions/fnc_handleDamage_advanced.sqf @@ -27,6 +27,11 @@ _sourceOfDamage = _this select 3; _typeOfProjectile = _this select 4; _returnDamage = _this select 5; +// Most likely taking exessive fire damage. Lets exit. +if (isNull _sourceOfDamage && (_selectionName == "head" || isBurning _unit) && _typeOfProjectile == "" && vehicle _unit == _unit) exitwith { + 0 +}; + _typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); _part = [_selectionName] call FUNC(selectionNameToNumber); @@ -52,6 +57,11 @@ if (GVAR(enableInternalBleeding)) then { if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then { [_unit, _newDamage] call FUNC(reactionToDamage); + + // If it reaches this, we can assume that the hit did not kill this unit, as this function is called 3 frames after the damage has been passed. + if ([_unit, _part, if (_part > 1) then {_newDamage * 1.3} else {_newDamage * 2}] call FUNC(determineIfFatal)) then { + [_unit] call FUNC(setUnconscious); + }; }; _returnDamage; diff --git a/addons/medical/functions/fnc_handleDamage_caching.sqf b/addons/medical/functions/fnc_handleDamage_caching.sqf index c171439422..1657d65b25 100644 --- a/addons/medical/functions/fnc_handleDamage_caching.sqf +++ b/addons/medical/functions/fnc_handleDamage_caching.sqf @@ -35,14 +35,24 @@ if (_selectionName in _hitSelections) then { _newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName))); }; + // we want to move damage to another selection; have to do it ourselves. // this is only the case for limbs, so this will not impact the killed EH. if (_selectionName != (_this select 1)) then { _unit setHitPointDamage [_hitPoints select (_hitSelections find _selectionName), _damage + _newDamage]; _newDamage = 0; }; +// ?????? _damage = _damage + _newDamage; +// Check for vehicle crash +if (vehicle _unit != _unit && !(vehicle _unit isKindOf "StaticWeapon") && {isNull _source} && {_projectile == ""} && {_selectionName == ""}) then { + if (missionNamespace getvariable [QGVAR(allowVehicleCrashDamage), true]) then { + _selectionName = _hitSelections select (floor(random(count _hitSelections))); + _projectile = "vehiclecrash"; + }; +}; + // From AGM medical: // Exclude falling damage to everything other than legs; reduce structural damage. if (((velocity _unit) select 2 < -5) && (vehicle _unit == _unit)) then {