2015-02-08 09:01:32 +00:00
|
|
|
/*
|
|
|
|
* 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>
|
2015-02-07 22:55:48 +00:00
|
|
|
*
|
2015-02-08 09:01:32 +00:00
|
|
|
* Public: No
|
2015-02-07 22:55:48 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-22 14:25:10 +00:00
|
|
|
params ["_unit"];
|
2015-02-07 22:55:48 +00:00
|
|
|
|
2016-12-05 20:34:20 +00:00
|
|
|
private _bloodLoss = 0;
|
|
|
|
private _limbBleeding = 0;
|
|
|
|
private _bodyBleeding = 0;
|
2016-06-13 10:18:56 +00:00
|
|
|
private _tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
|
2016-10-12 19:59:32 +00:00
|
|
|
|
2016-06-13 10:18:56 +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);
|
|
|
|
};
|
2016-06-13 10:18:56 +00:00
|
|
|
};
|
|
|
|
} 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;
|
2015-02-13 21:55:13 +00:00
|
|
|
|
2016-12-05 20:34:20 +00:00
|
|
|
_bloodLoss * (_unit getVariable [QGVAR(bleedingCoefficient), GVAR(bleedingCoefficient)])
|