From 9336e7c9e1a4376aa76ee56de17cbaa3e34018de Mon Sep 17 00:00:00 2001 From: ulteq Date: Wed, 10 Jun 2015 16:51:46 +0200 Subject: [PATCH] [WIP] Various handleDamage_caching fixes --- addons/medical/functions/fnc_handleDamage.sqf | 3 ++- .../medical/functions/fnc_handleDamage_advanced.sqf | 4 +--- addons/medical/functions/fnc_handleDamage_caching.sqf | 11 +++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index 5e58772a36..2226cdc20a 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -53,7 +53,8 @@ if (GVAR(level) < 2) then { }; _newDamage = _this call FUNC(handleDamage_caching); _typeOfDamage = [_projectile] call FUNC(getTypeOfDamage); - + systemChat _typeOfDamage; + _typeIndex = (GVAR(allAvailableDamageTypes) find _typeOfDamage); _minLethalDamage = 0.01; if (_typeIndex >= 0) then { diff --git a/addons/medical/functions/fnc_handleDamage_advanced.sqf b/addons/medical/functions/fnc_handleDamage_advanced.sqf index fb72e06d3a..1692f4444b 100644 --- a/addons/medical/functions/fnc_handleDamage_advanced.sqf +++ b/addons/medical/functions/fnc_handleDamage_advanced.sqf @@ -47,10 +47,8 @@ _unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; [_unit] call FUNC(handleDamage_advancedSetDamage); -if (_typeOfProjectile == "" && {_unit getVariable [QGVAR(isFalling), false]}) then { - _typeOfProjectile = "falling"; -}; _typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); +systemChat _typeOfDamage; [_unit, _selectionName, _newDamage, _typeOfProjectile, _typeOfDamage] call FUNC(handleDamage_wounds); // TODO Disabled until implemented fully diff --git a/addons/medical/functions/fnc_handleDamage_caching.sqf b/addons/medical/functions/fnc_handleDamage_caching.sqf index 13a0ca94d0..358b53a85e 100644 --- a/addons/medical/functions/fnc_handleDamage_caching.sqf +++ b/addons/medical/functions/fnc_handleDamage_caching.sqf @@ -41,17 +41,24 @@ if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isN if (GVAR(enableVehicleCrashes)) then { _selectionName = _hitSelections select (floor(random(count _hitSelections))); _projectile = "vehiclecrash"; + _this set [4, "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 { - _unit setVariable [QGVAR(isFalling), True]; + _unit setVariable [QGVAR(isFalling), true]; + _projectile = "falling"; + _this set [4, "falling"]; }; - if (_unit getVariable [QGVAR(isFalling), false] && {!(_selectionName in ["", "leg_l", "leg_r"])}) exitWith {0}; if (_unit getVariable [QGVAR(isFalling), false]) then { + if (_selectionName == "") then { + _selectionName = ["leg_l", "leg_r"] select (floor(random 2)); + }; + _this set [1, _selectionName]; + systemChat Str(_this); _newDamage = _newDamage * 0.7; };