diff --git a/addons/medical/functions/fnc_getBloodLoss.sqf b/addons/medical/functions/fnc_getBloodLoss.sqf index a7e6ae15b8..1a7e3968d8 100644 --- a/addons/medical/functions/fnc_getBloodLoss.sqf +++ b/addons/medical/functions/fnc_getBloodLoss.sqf @@ -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; diff --git a/addons/medical/functions/fnc_getBloodVolumeChange.sqf b/addons/medical/functions/fnc_getBloodVolumeChange.sqf index 396d058140..17b80f2f99 100644 --- a/addons/medical/functions/fnc_getBloodVolumeChange.sqf +++ b/addons/medical/functions/fnc_getBloodVolumeChange.sqf @@ -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 { diff --git a/addons/medical/functions/fnc_getCardiacOutput.sqf b/addons/medical/functions/fnc_getCardiacOutput.sqf index 74da98012b..9515d2cafe 100644 --- a/addons/medical/functions/fnc_getCardiacOutput.sqf +++ b/addons/medical/functions/fnc_getCardiacOutput.sqf @@ -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); diff --git a/addons/medical/functions/fnc_getHeartRateChange.sqf b/addons/medical/functions/fnc_getHeartRateChange.sqf index 4f0b19f80c..7476a088c9 100644 --- a/addons/medical/functions/fnc_getHeartRateChange.sqf +++ b/addons/medical/functions/fnc_getHeartRateChange.sqf @@ -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 { diff --git a/addons/medical/functions/fnc_handleStateDefault.sqf b/addons/medical/functions/fnc_handleStateDefault.sqf index 5339268054..c94add2798 100644 --- a/addons/medical/functions/fnc_handleStateDefault.sqf +++ b/addons/medical/functions/fnc_handleStateDefault.sqf @@ -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]; diff --git a/addons/medical/functions/fnc_handleStateInjured.sqf b/addons/medical/functions/fnc_handleStateInjured.sqf index 9f104498c6..3e81bd29cd 100644 --- a/addons/medical/functions/fnc_handleStateInjured.sqf +++ b/addons/medical/functions/fnc_handleStateInjured.sqf @@ -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); diff --git a/addons/medical/functions/fnc_handleStateRevive.sqf b/addons/medical/functions/fnc_handleStateRevive.sqf index 45abbd2ed4..e5251c93e5 100644 --- a/addons/medical/functions/fnc_handleStateRevive.sqf +++ b/addons/medical/functions/fnc_handleStateRevive.sqf @@ -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]; diff --git a/addons/medical/functions/fnc_handleStateUnconscious.sqf b/addons/medical/functions/fnc_handleStateUnconscious.sqf index 9f104498c6..3e81bd29cd 100644 --- a/addons/medical/functions/fnc_handleStateUnconscious.sqf +++ b/addons/medical/functions/fnc_handleStateUnconscious.sqf @@ -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); diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index b7d3e2496a..b01b1d9aee 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -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]; }; diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index 516879ad31..192ccc5fcb 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -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 diff --git a/addons/medical/script_macros_medical.hpp b/addons/medical/script_macros_medical.hpp index db1872207f..907b47c2f1 100644 --- a/addons/medical/script_macros_medical.hpp +++ b/addons/medical/script_macros_medical.hpp @@ -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 diff --git a/addons/medical_treatment/functions/fnc_treatmentBloodbagLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentBloodbagLocal.sqf index 144e386f3a..af725adadb 100644 --- a/addons/medical_treatment/functions/fnc_treatmentBloodbagLocal.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentBloodbagLocal.sqf @@ -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]; diff --git a/addons/medical_treatment/functions/fnc_treatmentFullHealLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentFullHealLocal.sqf index b177e026b9..34749ff421 100644 --- a/addons/medical_treatment/functions/fnc_treatmentFullHealLocal.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentFullHealLocal.sqf @@ -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]; diff --git a/addons/medical_treatment/functions/fnc_treatmentIVLocal.sqf b/addons/medical_treatment/functions/fnc_treatmentIVLocal.sqf index 2e2687b7d1..6324abd126 100644 --- a/addons/medical_treatment/functions/fnc_treatmentIVLocal.sqf +++ b/addons/medical_treatment/functions/fnc_treatmentIVLocal.sqf @@ -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");