2015-02-08 09:01:32 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Calculate the total blood loss of a unit.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* ReturnValue:
|
|
|
|
* Total blood loss of unit <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-04-14 18:40:38 +00:00
|
|
|
#define BLOODLOSSRATE_BASIC 0.2
|
2015-04-05 19:38:15 +00:00
|
|
|
|
2015-08-22 14:25:10 +00:00
|
|
|
private ["_totalBloodLoss","_tourniquets","_openWounds", "_cardiacOutput", "_internalWounds"];
|
2015-02-07 22:55:48 +00:00
|
|
|
// TODO Only use this calculation if medium or higher, otherwise use vanilla calculations (for basic medical).
|
2015-08-22 14:25:10 +00:00
|
|
|
params ["_unit"];
|
2015-02-07 22:55:48 +00:00
|
|
|
_totalBloodLoss = 0;
|
|
|
|
|
2015-02-13 21:55:13 +00:00
|
|
|
// Advanced medical bloodloss handling
|
2015-03-06 21:54:44 +00:00
|
|
|
if (GVAR(level) >= 2) then {
|
2015-11-30 16:27:09 +00:00
|
|
|
_tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
|
|
|
|
_openWounds = _unit getVariable [QGVAR(openWounds), []];
|
2015-04-22 20:36:41 +00:00
|
|
|
//_cardiacOutput = [_unit] call FUNC(getCardiacOutput);
|
2015-02-13 21:55:13 +00:00
|
|
|
|
2015-02-28 18:28:05 +00:00
|
|
|
{
|
2015-03-05 17:42:08 +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-13 21:55:13 +00:00
|
|
|
|
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));
|
|
|
|
};
|
2015-11-30 16:23:48 +00:00
|
|
|
} forEach _openWounds;
|
2015-02-13 21:55:13 +00:00
|
|
|
|
2015-11-30 16:27:09 +00:00
|
|
|
_internalWounds = _unit getVariable [QGVAR(internalWounds), []];
|
2015-02-28 18:28:05 +00:00
|
|
|
{
|
|
|
|
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));
|
2015-11-30 16:23:48 +00:00
|
|
|
} forEach _internalWounds;
|
2015-02-13 21:55:13 +00:00
|
|
|
|
2015-02-28 18:28:05 +00:00
|
|
|
// cap the blood loss to be no greater as the current cardiac output
|
|
|
|
//(_totalBloodLoss min _cardiacOutput);
|
2015-02-21 20:10:57 +00:00
|
|
|
} else {
|
2015-11-30 16:27:09 +00:00
|
|
|
{ _totalBloodLoss = _totalBloodLoss + _x } forEach (_unit getVariable [QGVAR(bodyPartStatus), []]);
|
2015-09-02 19:56:00 +00:00
|
|
|
_totalBloodLoss = (_totalBloodLoss / 6) * BLOODLOSSRATE_BASIC;
|
2015-02-13 21:55:13 +00:00
|
|
|
};
|
2015-04-22 20:38:48 +00:00
|
|
|
_totalBloodLoss * ((_unit getVariable [QGVAR(bleedingCoefficient), GVAR(bleedingCoefficient)]) max 0);
|