From 1c5761f845044383d477288b20b69aecfe9f5712 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 3 Sep 2016 15:00:45 -0500 Subject: [PATCH] Bundle fire damage into larger chunks (#4223) --- .../functions/fnc_handleDamage_advanced.sqf | 24 ++++++++++++------- .../functions/fnc_handleDamage_wounds.sqf | 2 ++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/addons/medical/functions/fnc_handleDamage_advanced.sqf b/addons/medical/functions/fnc_handleDamage_advanced.sqf index 068162a55b..724958dfbc 100644 --- a/addons/medical/functions/fnc_handleDamage_advanced.sqf +++ b/addons/medical/functions/fnc_handleDamage_advanced.sqf @@ -9,9 +9,6 @@ * 3: Shooter * 4: Projectile * 5: Hit part index of the hit point - * 6: Current damage to be returned - * - * //On 1.63 dev: * 6: Shooter? * 7: Current damage to be returned * @@ -23,12 +20,23 @@ #include "script_component.hpp" -params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfProjectile", "_hitPointNumber", "_newDamage"]; +params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfProjectile", "_hitPointNumber", "", "_newDamage"]; -//Temp fix for 1.63 handleDamage changes -if (_newDamage isEqualType objNull) then { - _newDamage = _this select 7; -}; +// For burning damage we will get a ton of very small hits of damage; they are too small to create any wounds +// Save them up in a variable and run when it is over a noticable amount + +if ((_typeOfProjectile == "") && {_newDamage < 0.15} && { + _newDamage = _newDamage + (_unit getVariable [QGVAR(trivialDamage), 0]); + if (_newDamage > 0.15) then { + // if the new sum is large enough, reset variable and continue with it added in + _unit setVariable [QGVAR(trivialDamage), 0]; + false + } else { + // otherwise just save the new sum into the variable and exit + _unit setVariable [QGVAR(trivialDamage), _newDamage]; + true // exit + }; +}) exitWith {}; private _part = [_selectionName] call FUNC(selectionNameToNumber); if (_part < 0) exitWith {}; diff --git a/addons/medical/functions/fnc_handleDamage_wounds.sqf b/addons/medical/functions/fnc_handleDamage_wounds.sqf index 31a3e360a5..170880ce34 100644 --- a/addons/medical/functions/fnc_handleDamage_wounds.sqf +++ b/addons/medical/functions/fnc_handleDamage_wounds.sqf @@ -20,6 +20,8 @@ params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"]; TRACE_6("ACE_DEBUG: HandleDamage Called",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage); +if (_typeOfDamage == "") then {_typeOfDamage = "unknown";}; + // Administration for open wounds and ids private _openWounds = _unit getVariable[QGVAR(openWounds), []]; private _woundID = _unit getVariable[QGVAR(lastUniqueWoundID), 1];