2015-02-08 09:01:32 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Calculates the blood volume change and decreases the IVs given to the unit.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* ReturnValue:
|
|
|
|
* Current cardiac output <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"
|
|
|
|
|
|
|
|
/*
|
|
|
|
IV Change per second calculation:
|
|
|
|
250ml should take 60 seconds to fill. 250/60 = 4.166.
|
|
|
|
*/
|
|
|
|
#define IV_CHANGE_PER_SECOND -4.166
|
|
|
|
|
|
|
|
/*
|
|
|
|
Blood Change per second calculation for IVs:
|
|
|
|
250ml should take 60 seconds to fill in. Total blood volume is 7000ml = 100%.
|
|
|
|
7000/100 = 70 = 1%
|
|
|
|
250 / 70 = 3.571428571%
|
|
|
|
3.571428571 / 60 = 0.0595% per second.
|
|
|
|
*/
|
|
|
|
#define BLOOD_CHANGE_PER_SECOND 0.0595
|
|
|
|
|
2016-06-13 00:34:56 +00:00
|
|
|
#define EMPTY_IV_BAG_VALUE 0
|
|
|
|
#define IV_VOLUME (_unit getVariable [_x, EMPTY_IV_BAG_VALUE]) + IV_CHANGE_PER_SECOND
|
|
|
|
|
2015-08-22 14:25:10 +00:00
|
|
|
private ["_bloodVolume", "_bloodVolumeChange", "_ivVolume"];
|
|
|
|
params ["_unit"];
|
2015-02-07 22:55:48 +00:00
|
|
|
|
2016-06-13 00:34:56 +00:00
|
|
|
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100];
|
|
|
|
private _bloodVolumeChange = -([_unit] call FUNC(getBloodLoss));
|
2015-02-07 22:55:48 +00:00
|
|
|
|
2016-06-13 00:34:56 +00:00
|
|
|
if (_bloodVolume < 100) then {
|
2015-03-22 22:24:24 +00:00
|
|
|
{
|
2016-06-13 00:34:56 +00:00
|
|
|
if ((_unit getVariable [_x, EMPTY_IV_BAG_VALUE]) > EMPTY_IV_BAG_VALUE) then {
|
2015-03-22 22:24:24 +00:00
|
|
|
_bloodVolumeChange = _bloodVolumeChange + BLOOD_CHANGE_PER_SECOND;
|
2016-06-13 00:34:56 +00:00
|
|
|
_unit setVariable [_x, IV_VOLUME];
|
2015-03-22 22:24:24 +00:00
|
|
|
};
|
2015-11-30 16:23:48 +00:00
|
|
|
} forEach GVAR(IVBags);
|
2015-04-05 18:11:54 +00:00
|
|
|
} else {
|
|
|
|
{
|
2016-06-13 00:34:56 +00:00
|
|
|
if ((_unit getVariable [_x, EMPTY_IV_BAG_VALUE]) > EMPTY_IV_BAG_VALUE) then {
|
|
|
|
_unit setVariable [_x, EMPTY_IV_BAG_VALUE]; // lets get rid of exessive IV volume
|
2015-04-05 18:11:54 +00:00
|
|
|
};
|
2015-11-30 16:23:48 +00:00
|
|
|
} forEach GVAR(IVBags);
|
2015-02-07 22:55:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_bloodVolumeChange;
|