2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-02-08 09:01:32 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Calculate the total blood loss of a unit.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The Unit <OBJECT>
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Return Value:
|
2019-06-10 16:23:21 +00:00
|
|
|
* Total blood loss of unit (litres/second) <NUMBER>
|
2015-02-07 22:55:48 +00:00
|
|
|
*
|
2017-04-22 15:57:32 +00:00
|
|
|
* Example:
|
2019-04-27 19:12:11 +00:00
|
|
|
* [player] call ace_medical_status_fnc_getBloodLoss
|
2017-04-22 15:57:32 +00:00
|
|
|
*
|
2015-02-08 09:01:32 +00:00
|
|
|
* Public: No
|
2015-02-07 22:55:48 +00:00
|
|
|
*/
|
|
|
|
|
2015-08-22 14:25:10 +00:00
|
|
|
params ["_unit"];
|
2015-02-07 22:55:48 +00:00
|
|
|
|
2019-04-27 19:12:11 +00:00
|
|
|
private _woundBleeding = GET_WOUND_BLEEDING(_unit);
|
|
|
|
if (_woundBleeding == 0) exitWith {0};
|
2016-12-09 14:54:33 +00:00
|
|
|
|
|
|
|
private _cardiacOutput = [_unit] call FUNC(getCardiacOutput);
|
2024-08-11 23:29:11 +00:00
|
|
|
private _resistance = _unit getVariable [VAR_PERIPH_RES, DEFAULT_PERIPH_RES]; // can use value directly since this is sum of default and adjustments
|
2015-02-13 21:55:13 +00:00
|
|
|
|
2019-06-28 00:01:20 +00:00
|
|
|
// even if heart stops blood will still flow slowly (gravity)
|
2024-08-11 23:29:11 +00:00
|
|
|
private _bloodLoss = (_woundBleeding * (_cardiacOutput max CARDIAC_OUTPUT_MIN) * (DEFAULT_PERIPH_RES / _resistance) * EGVAR(medical,bleedingCoefficient));
|
2024-04-07 01:18:07 +00:00
|
|
|
|
|
|
|
private _eventArgs = [_unit, _bloodLoss]; // Pass by reference
|
|
|
|
|
|
|
|
[QGVAR(getBloodLoss), _eventArgs] call CBA_fnc_localEvent;
|
|
|
|
|
|
|
|
_eventArgs select 1 // return
|