ACE3/addons/medical/functions/fnc_getBloodLoss.sqf

46 lines
1.5 KiB
Plaintext
Raw Normal View History

/*
* Author: Glowbal
* Calculate the total blood loss of a unit.
*
* Arguments:
* 0: The Unit <OBJECT>
*
* ReturnValue:
* Total blood loss of unit <NUMBER>
*
* Public: No
*/
#include "script_component.hpp"
private ["_totalBloodLoss","_tourniquets","_openWounds", "_value", "_cardiacOutput", "_internalWounds"];
// TODO Only use this calculation if medium or higher, otherwise use vanilla calculations (for basic medical).
_totalBloodLoss = 0;
// Advanced medical bloodloss handling
2015-03-06 21:54:44 +00:00
if (GVAR(level) >= 2) then {
2015-02-28 18:28:05 +00:00
_tourniquets = _this getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
_openWounds = _this getvariable [QGVAR(openWounds), []];
//_cardiacOutput = [_this] call FUNC(getCardiacOutput);
2015-02-28 18:28:05 +00:00
{
if ((_tourniquets select (_x select 2)) == 0) then {
2015-02-28 18:28:05 +00:00
// total bleeding ratio * percentage of injury left
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));
2015-02-28 18:28:05 +00:00
// (((BLOODLOSS_SMALL_WOUNDS * (_x select 0))) + ((BLOODLOSS_MEDIUM_WOUNDS * (_x select 1))) + ((BLOODLOSS_LARGE_WOUNDS * (_x select 2))) * (_cardiacOutput / DEFAULT_CARDIAC_OUTPUT));
};
}foreach _openWounds;
2015-02-28 18:28:05 +00:00
_internalWounds = _this getvariable [QGVAR(internalWounds), []];
{
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));
}foreach _internalWounds;
2015-02-28 18:28:05 +00:00
// cap the blood loss to be no greater as the current cardiac output
//(_totalBloodLoss min _cardiacOutput);
} else {
2015-02-28 18:28:05 +00:00
// TODO basic medical
};
2015-03-08 11:05:52 +00:00
_totalBloodLoss * GVAR(bleedingCoefficient);