use liters for blood volume variable

This commit is contained in:
commy2 2016-10-10 17:30:42 +02:00
parent 3521bca00b
commit 3438ea0946
14 changed files with 23 additions and 21 deletions

View File

@ -30,4 +30,4 @@ private _tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));
} forEach (_unit getVariable [QGVAR(internalWounds), []]);
_totalBloodLoss * ((_unit getVariable [QGVAR(bleedingCoefficient), GVAR(bleedingCoefficient)]) max 0);
_totalBloodLoss * ((_unit getVariable [QGVAR(bleedingCoefficient), GVAR(bleedingCoefficient)]) max 0) * DEFAULT_BLOOD_VOLUME / 100;

View File

@ -23,7 +23,7 @@
params ["_unit", "_syncValues"];
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100];
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME];
private _bloodVolumeChange = -([_unit] call FUNC(getBloodLoss));
if (!isNil {_unit getVariable QGVAR(ivBags)}) then {
@ -33,7 +33,7 @@ if (!isNil {_unit getVariable QGVAR(ivBags)}) then {
_x params ["_bagVolumeRemaining"];
private _bagChange = IV_CHANGE_PER_SECOND min _bagVolumeRemaining; // absolute value of the change in miliLiters
_bagVolumeRemaining = _bagVolumeRemaining - _bagChange;
_bloodVolumeChange = _bloodVolumeChange + (_bagChange / 70); // ((bag change in ml) / (body total:7000ml)) out of 100 percent
_bloodVolumeChange = _bloodVolumeChange + _bagChange;
if (_bagVolumeRemaining < 0.01) then {
[]
} else {

View File

@ -24,4 +24,4 @@
params ["_unit"];
((_unit getVariable [QGVAR(bloodVolume), 100])/MODIFIER_CARDIAC_OUTPUT) + ((_unit getVariable [QGVAR(heartRate), 80])/80-1);
((_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) / MODIFIER_CARDIAC_OUTPUT) + ((_unit getVariable [QGVAR(heartRate), 80]) / 80 - 1);

View File

@ -49,7 +49,7 @@ if (!(_unit getVariable [QGVAR(inCardiacArrest),false])) then {
_adjustment = _adjustment - [ObjNull];
_unit setVariable [QGVAR(heartRateAdjustments), _adjustment];
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100];
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME];
if (_bloodVolume > 75) then {
if (_bloodLoss > 0.0) then {
if (_bloodLoss < 0.5) then {

View File

@ -13,7 +13,7 @@ if (!local _unit) exitWith {
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true];
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
};
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), 100], true];
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
};
systemChat format["handling state default for unit: %1", _this];

View File

@ -13,7 +13,7 @@ if (!local _unit) exitWith {
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true];
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
};
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), 100], true];
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
};
[_unit, CBA_missionTime - _lastTime] call FUNC(handleUnitVitals);

View File

@ -12,7 +12,7 @@ if (!local _unit) exitWith {
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true];
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
};
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), 100], true];
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
};
private _startTime = _unit getVariable [QGVAR(reviveStartTime), 0];

View File

@ -13,7 +13,7 @@ if (!local _unit) exitWith {
_unit setVariable [QGVAR(heartRate), _unit getVariable [QGVAR(heartRate), 80], true];
_unit setVariable [QGVAR(bloodPressure), _unit getVariable [QGVAR(bloodPressure), [80, 120]], true];
};
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), 100], true];
_unit setVariable [QGVAR(bloodVolume), _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME], true];
};
[_unit, CBA_missionTime - _lastTime] call FUNC(handleUnitVitals);

View File

@ -10,7 +10,6 @@
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_interval"];
@ -23,27 +22,24 @@ if (_syncValues) then {
_unit setVariable [QGVAR(lastMomentValuesSynced), CBA_missionTime];
};
private _bloodVolume = (_unit getVariable [QGVAR(bloodVolume), 100]) + ([_unit, _syncValues] call FUNC(getBloodVolumeChange));
private _bloodVolume = (_unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME]) + ([_unit, _syncValues] call FUNC(getBloodVolumeChange));
_bloodVolume = _bloodVolume max 0;
_unit setVariable [QGVAR(bloodVolume), _bloodVolume, _syncValues];
TRACE_3("ACE_DEBUG",_bloodVolume,_syncValues,_unit);
// Set variables for synchronizing information across the net
if (_bloodVolume < 100) then {
if (_bloodVolume < 90) then {
TRACE_4("ACE_DEBUG",_bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit);
if (_bloodVolume < DEFAULT_BLOOD_VOLUME - HAS_LOST_SOME_BLOOD_THRESHOLD) then {
if (_bloodVolume < DEFAULT_BLOOD_VOLUME - HAS_LOST_MUCH_BLOOD_THRESHOLD) then {
if (_unit getVariable [QGVAR(hasLostBlood), 0] != 2) then {
_unit setVariable [QGVAR(hasLostBlood), 2, true];
};
} else {
TRACE_4("ACE_DEBUG", _bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit);
if (_unit getVariable [QGVAR(hasLostBlood), 0] != 1) then {
_unit setVariable [QGVAR(hasLostBlood), 1, true];
};
};
} else {
TRACE_4("ACE_DEBUG",_bloodVolume,_unit getVariable QGVAR(hasLostBlood),_syncValues,_unit);
if (_unit getVariable [QGVAR(hasLostBlood), 0] != 0) then {
_unit setVariable [QGVAR(hasLostBlood), 0, true];
};

View File

@ -19,7 +19,7 @@ if (damage _unit > 0) then {
};
_unit setVariable [QGVAR(pain), 0, true];
_unit setVariable [QGVAR(bloodVolume), 100, true];
_unit setVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME, true];
_unit setVariable ["ACE_isUnconscious", false, true]; // TODO this is done based on state
// tourniquets

View File

@ -14,3 +14,9 @@
#define GET_NUMBER(config,default) (if (isNumber (config)) then {getNumber (config)} else {default})
#define GET_STRING(config,default) (if (isText (config)) then {getText (config)} else {default})
#define GET_ARRAY(config,default) (if (isArray (config)) then {getArray (config)} else {default})
// --- blood
#define DEFAULT_BLOOD_VOLUME 6.0 // in liters
#define HAS_LOST_SOME_BLOOD_THRESHOLD 0.100 // in liters
#define HAS_LOST_MUCH_BLOOD_THRESHOLD 0.500 // in liters

View File

@ -23,5 +23,5 @@ private _bloodAdded = switch (true) do {
default {BLOODBAGHEAL};
};
private _blood = ((_target getVariable [QEGVAR(medical,bloodVolume), 100]) + _bloodAdded) min 100;
private _blood = ((_target getVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME]) + _bloodAdded) min DEFAULT_BLOOD_VOLUME;
_target setVariable [QEGVAR(medical,bloodVolume), _blood, true];

View File

@ -18,7 +18,7 @@ params ["_caller", "_target"];
if (alive _target) exitWith {
_target setVariable [QEGVAR(medical,pain), 0, true];
_target setVariable [QEGVAR(medical,morphine), 0, true];
_target setVariable [QEGVAR(medical,bloodVolume), 100, true];
_target setVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME, true];
// tourniquets
_target setVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0], true];

View File

@ -17,9 +17,9 @@
params ["_target", "_treatmentClassname"];
private _bloodVolume = _target getVariable [QEGVAR(medical,bloodVolume), 100];
private _bloodVolume = _target getVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME];
if (_bloodVolume >= 100) exitWith {};
if (_bloodVolume >= DEFAULT_BLOOD_VOLUME) exitWith {};
// Find the proper attributes for the used IV
private _config = (configFile >> "ace_medical_treatment" >> "IV");