2018-07-30 09:22:14 +00:00
#include "script_component.hpp"
2015-02-08 09:01:32 +00:00
/*
* Author: Glowbal
* Calculate the total blood loss of a unit.
*
* Arguments:
* 0: The Unit <OBJECT>
*
2017-06-08 13:31:51 +00:00
* Return Value:
2015-02-08 09:01:32 +00:00
* Total blood loss of unit <NUMBER>
2015-02-07 22:55:48 +00:00
*
2017-04-22 15:57:32 +00:00
* Example:
2019-03-30 16:07:54 +00:00
* [bob] call ace_medical_status_fnc_getBloodLoss
2017-04-22 15:57:32 +00:00
*
2015-02-08 09:01:32 +00:00
* Public: No
2015-02-07 22:55:48 +00:00
*/
2015-08-22 14:25:10 +00:00
params ["_unit"];
2015-02-07 22:55:48 +00:00
2018-07-29 21:43:14 +00:00
private _tourniquets = GET_TOURNIQUETS(_unit);
2016-12-09 14:54:33 +00:00
private _bodyPartBleeding = [0,0,0,0,0,0];
2016-06-13 10:18:56 +00:00
{
2016-12-09 14:54:33 +00:00
_x params ["", "", "_bodyPart", "_amountOf", "_bleeeding"];
if (_tourniquets select _bodyPart == 0) then {
_bodyPartBleeding set [_bodyPart, (_bodyPartBleeding select _bodyPart) + (_amountOf * _bleeeding)];
2016-06-13 10:18:56 +00:00
};
2018-07-15 16:29:18 +00:00
} forEach (_unit getVariable [QEGVAR(medical,openWounds), []]);
2016-06-13 10:18:56 +00:00
2016-12-09 14:54:33 +00:00
if (_bodyPartBleeding isEqualTo [0,0,0,0,0,0]) exitWith { 0 };
_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;
2016-12-05 20:34:20 +00:00
2016-12-09 14:54:33 +00:00
// limb bleeding is scaled down based on the amount of body bleeding
_limbBleedingRate = _limbBleedingRate * (1 - _bodyBleedingRate);
private _cardiacOutput = [_unit] call FUNC(getCardiacOutput);
2015-02-13 21:55:13 +00:00
2018-05-09 12:37:07 +00:00
((_bodyBleedingRate + _limbBleedingRate) * _cardiacOutput * EGVAR(medical,bleedingCoefficient))