ACE3/addons/medical/functions/fnc_getBloodLoss.sqf

40 lines
1.2 KiB
Plaintext
Raw Normal View History

/*
* Author: Glowbal
* Calculate the total blood loss of a unit.
*
* Arguments:
* 0: The Unit <OBJECT>
*
* ReturnValue:
2016-12-05 20:34:20 +00:00
* Total blood loss of unit (liter per second) <NUMBER>
*
* Public: No
*/
#include "script_component.hpp"
2015-08-22 14:25:10 +00:00
params ["_unit"];
2016-12-05 20:34:20 +00:00
private _bloodLoss = 0;
private _limbBleeding = 0;
private _bodyBleeding = 0;
private _tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
2016-10-12 19:59:32 +00:00
{
2016-12-05 20:34:20 +00:00
_x params ["", "", "_bodyPart", "_percentage", "_bleeeding"];
if (_bodyPart == 1) then {
_bodyBleeding = _bodyBleeding + (_bleeeding * _percentage);
} else {
if (_tourniquets select _bodyPart == 0) then {
_limbBleeding = _limbBleeding + (_bleeeding * _percentage);
};
};
} forEach (_unit getVariable [QGVAR(openWounds), []]);
2016-12-05 20:34:20 +00:00
private _cardiacOutput = [_unit] call FUNC(getCardiacOutput);
// limb bleeding is scaled down based on the amount of body bleeding and limited by the current cardiac output
_limbBleeding = 0 max (_limbBleeding * (1 - (_bodyBleeding min 1))) min 1;
_bloodLoss = (_bodyBleeding + _limbBleeding) * _cardiacOutput;
2016-12-05 20:34:20 +00:00
_bloodLoss * (_unit getVariable [QGVAR(bleedingCoefficient), GVAR(bleedingCoefficient)])