Different max. bleeding rates for different body parts

This commit is contained in:
ulteq 2016-12-09 15:54:33 +01:00
parent 0a81baf498
commit bfda932384

View File

@ -14,26 +14,24 @@
params ["_unit"];
private _bloodLoss = 0;
private _limbBleeding = 0;
private _bodyBleeding = 0;
private _tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
private _bodyPartBleeding = [0,0,0,0,0,0];
{
_x params ["", "", "_bodyPart", "_percentage", "_bleeeding"];
if (_bodyPart == 1) then {
_bodyBleeding = _bodyBleeding + (_bleeeding * _percentage);
} else {
if (_tourniquets select _bodyPart == 0) then {
_limbBleeding = _limbBleeding + (_bleeeding * _percentage);
};
_x params ["", "", "_bodyPart", "_amountOf", "_bleeeding"];
if (_tourniquets select _bodyPart == 0) then {
_bodyPartBleeding set [_bodyPart, (_bodyPartBleeding select _bodyPart) + (_amountOf * _bleeeding)];
};
} forEach (_unit getVariable [QGVAR(openWounds), []]);
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;
// limb bleeding is scaled down based on the amount of body bleeding
_limbBleedingRate = _limbBleedingRate * (1 - _bodyBleedingRate);
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;
_bloodLoss * (_unit getVariable [QGVAR(bleedingCoefficient), GVAR(bleedingCoefficient)])
((_bodyBleedingRate + _limbBleedingRate) * _cardiacOutput * GVAR(bleedingCoefficient))