diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 8e7a98fd16..394fb3fd1b 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -328,6 +328,7 @@ class ACE_Medical_Advanced { class Large { name = CSTRING(Wounds_Abrasion_Large); minDamage = 0.3; + maxDamage = 0.5; bleedingRate = 0.0002; }; }; diff --git a/addons/medical/functions/fnc_handleDamage_caching.sqf b/addons/medical/functions/fnc_handleDamage_caching.sqf index 7bea992828..8476c09542 100644 --- a/addons/medical/functions/fnc_handleDamage_caching.sqf +++ b/addons/medical/functions/fnc_handleDamage_caching.sqf @@ -18,7 +18,7 @@ #include "script_component.hpp" -private ["_unit", "_selectionName","_damage", "_source","_projectile","_hitSelections","_hitPoints","_newDamage","_cache_hitpoints","_cache_projectiles","_cache_params","_cache_damages"]; +private ["_unit", "_selectionName", "_damage", "_source", "_projectile", "_hitSelections", "_hitPoints", "_impactVelocity", "_newDamage", "_cache_hitpoints", "_cache_projectiles", "_cache_params", "_cache_damages"]; _unit = _this select 0; _selectionName = _this select 1; _damage = _this select 2; @@ -46,17 +46,16 @@ if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isN }; }; -// From AGM medical: -// Exclude falling damage to everything other than legs; reduce structural damage. -if (((velocity _unit) select 2 < -5) && {(vehicle _unit == _unit)}) then { +// Handle falling damage +_impactVelocity = (velocity _unit) select 2; +if (_impactVelocity < -5 && {vehicle _unit == _unit}) then { _unit setVariable [QGVAR(isFalling), true]; - _projectile = "falling"; - _this set [4, "falling"]; + _unit setVariable [QGVAR(impactVelocity), _impactVelocity]; }; if (_unit getVariable [QGVAR(isFalling), false]) then { if !(_selectionName in ["", "leg_l", "leg_r"]) then { if (_selectionName == "body") then { - _newDamage = _newDamage * 0.1; + _newDamage = _newDamage * abs(_unit getVariable [QGVAR(impactVelocity), _impactVelocity]) / 50; } else { _newDamage = _newDamage * 0.5; }; @@ -67,6 +66,8 @@ if (_unit getVariable [QGVAR(isFalling), false]) then { }; _newDamage = _newDamage * 0.7; }; + _projectile = "falling"; + _this set [4, "falling"]; }; diag_log format["[handleDamage_caching] Projectile: %1; Velocity: %2 m/s; SelectionName: %3; newDamage: %4", _projectile, (velocity _unit) select 2, _selectionName, _newDamage]; @@ -103,7 +104,7 @@ if (_selectionName != "") then { private ["_index","_otherDamage"]; _index = _cache_projectiles find _projectile; // Check if the current projectile has already been handled once - if (_index >= 0) exitwith { + if (_index >= 0 && {_projectile != "falling"}) exitwith { _cache_damages = _unit getVariable QGVAR(cachedDamages); // Find the previous damage this projectile has done _otherDamage = (_cache_damages select _index);