ACE3/addons/medical_status/functions/fnc_updateWoundBloodLoss.sqf
SilentSpike 8483a4bcdc Medical - Fix severity of wound bleeding and adjust cardiac output calculations (#7010)
* Fix severity of wound bleeding

I'm simplifying the nastiness calculations so that the wound config
specifies the worst wound and we scale it between 25% to 100% based
on the wound damage and number of wounds recieved.

Similarly I've updated the wound configs to more reasonable maximum
bleeding values based on the fact that they're percentages of cardiac
output being bled.

* Limit variance of pain modifier

This is to avoid unexpectedly high pain for small wounds or unexpectedly
small pain for large wounds

* Make more wounds increase chance for nastiness

Rather than guarantee

* Adjust worst damage scaling

This handles torso wounds better as they're typically around 0.3-0.6 for
6.5mm shots which makes them roughly medium sized.

* Fix cardiac output calculation

Previously the calculation didn't make sense as it wasn't outputting
a value in l/s. This method of calculation makes more logical sense and
provides a point of reference for what the bleeding values actually
represent (percentage of the blood being pumped that is lost - which now
has an actual volumetric value).

* Fix blood pressure after change to cardiac output

* Fix heartrate skyrocketing between 5l and 4l blood

Pretty sure someone accidnentally got these conditions the wrong way
around. This way blood pressure will first drop and then heart rate will
later go up to compensate.

* Fix comment typo

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>
2019-06-10 11:23:21 -05:00

44 lines
1.6 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Glowbal
* Update total wound bleeding based on open wounds and tourniquets
* Wound bleeding = percentage of cardiac output lost
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [player] call ace_medical_status_fnc_updateWoundBloodLoss
*
* Public: No
*/
params ["_unit"];
private _tourniquets = GET_TOURNIQUETS(_unit);
private _bodyPartBleeding = [0,0,0,0,0,0];
{
_x params ["", "_bodyPart", "_amountOf", "_bleeeding"];
if (_tourniquets select _bodyPart == 0) then {
_bodyPartBleeding set [_bodyPart, (_bodyPartBleeding select _bodyPart) + (_amountOf * _bleeeding)];
};
} forEach (_unit getVariable [QEGVAR(medical,openWounds), []]);
if (_bodyPartBleeding isEqualTo [0,0,0,0,0,0]) then {
TRACE_1("updateWoundBloodLoss-none",_unit);
_unit setVariable [VAR_WOUND_BLEEDING, 0, true];
} else {
_bodyPartBleeding params ["_headBleeding", "_bodyBleeding", "_leftArmBleeding", "_rightArmBleeding", "_leftLegBleeding", "_rightLegBleeding"];
private _bodyBleedingRate = ((_headBleeding min 0.9) + (_bodyBleeding min 1.0)) min 1.0;
private _limbBleedingRate = ((_leftArmBleeding min 0.3) + (_rightArmBleeding min 0.3) + (_leftLegBleeding min 0.5) + (_rightLegBleeding min 0.5)) min 1.0;
// limb bleeding is scaled down based on the amount of body bleeding
_limbBleedingRate = _limbBleedingRate * (1 - _bodyBleedingRate);
TRACE_3("updateWoundBloodLoss-bleeding",_unit,_bodyBleedingRate,_limbBleedingRate);
_unit setVariable [VAR_WOUND_BLEEDING, _bodyBleedingRate + _limbBleedingRate, true];
};