Skip to content

Commit

Permalink
Hypothermia/Pharma/Vitals - Dev Vital Fixes (#605)
Browse files Browse the repository at this point in the history
**When merged this pull request will:**
- Fixes critical vitals

### IMPORTANT

- [Development Guidelines](https://ace3.acemod.org/wiki/development/)
are read, understood and applied.
- Title of this PR uses our standard template `Component -
Add|Fix|Improve|Change|Make|Remove {changes}`.

---------

Co-authored-by: MiszczuZPolski <[email protected]>
  • Loading branch information
mazinskihenry and MiszczuZPolski authored Oct 5, 2024
1 parent 846aa86 commit ac915f9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 36 deletions.
16 changes: 7 additions & 9 deletions addons/pharma/functions/fnc_getBloodVolumeChange.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ if (!isNil {_unit getVariable [QACEGVAR(medical,ivBags),[]]}) then {
private _bloodBags = _unit getVariable [QACEGVAR(medical,ivBags), []];
private _IVarray = _unit getVariable [QGVAR(IV), [0,0,0,0,0,0]];
private _flowCalculation = (ACEGVAR(medical,ivFlowRate) * _deltaT * 4.16);
private _hypothermia = missionNamespace getVariable [QEGVAR(hypothermia,hypothermiaActive), false];
private _hypothermia = EGVAR(hypothermia,hypothermiaActive);

if (GET_HEART_RATE(_unit) < 20) then {
_flowCalculation = _flowCalculation / 1.5;
};

if (_hypothermia) then {
private _incomingVolumeChange = [0,0,0,0,0,0];
private _fluidWarmer = _unit getVariable [QEGVAR(hypothermia,fluidWarmer), [0,0,0,0,0,0]];
private _fluidHeat = 0;
};
private _incomingVolumeChange = [0,0,0,0,0,0];
private _fluidWarmer = _unit getVariable [QEGVAR(hypothermia,fluidWarmer), [0,0,0,0,0,0]];
private _fluidHeat = 0;

_bloodBags = _bloodBags apply {
_x params ["_bagVolumeRemaining", "_type", "_bodyPart"];
Expand Down Expand Up @@ -92,7 +90,7 @@ if (!isNil {_unit getVariable [QACEGVAR(medical,ivBags),[]]}) then {

// Incoming fluids impacting internal temperature
if (_hypothermia) then {
{_fluidHeat = _fluidHeat + _x} forEach _incomingVolumeChange;
{ _fluidHeat = _fluidHeat + _x; } forEach _incomingVolumeChange;

if (_fluidHeat > 0) then {
private _totalHeat = _unit getVariable [QEGVAR(hypothermia,warmingImpact), 0];
Expand All @@ -108,12 +106,12 @@ if (!isNil {_unit getVariable [QACEGVAR(medical,ivBags),[]]}) then {
private _shiftValue = 0;
switch (true) do {
case ((_ECB + _ECP) > (_ISP * 0.6)): {
_shiftValue = (5 min ((_ECP + _ECB) - (_ISP * 0.6)));
_shiftValue = (2 min ((_ECP + _ECB) - (_ISP * 0.6)));
_ECP = _ECP - _shiftValue;
_ISP = _ISP + _shiftValue;
};
case ((_ECB + _ECP) < (_ISP * 0.6)): {
_shiftValue = (5 min ((_ISP * 0.6) - (_ECP + _ECB)));
_shiftValue = (2 min ((_ISP * 0.6) - (_ECP + _ECB)));
_ECP = _ECP + _shiftValue;
_ISP = _ISP - _shiftValue;
};
Expand Down
3 changes: 2 additions & 1 deletion addons/vitals/functions/fnc_handleTemperatureFunction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ _positionTemperature params ["_lattitude", "_projectedTemperature"];
private _mapTemperature = _projectedTemperature - ((linearConversion [0, 90, _lattitude, 15, 5, true]) * (linearConversion [0, 1, sunOrMoon, 1, 0, true]));

private _warmingImpact = (_unit getVariable [QEGVAR(hypothermia,warmingImpact), 0]) / ML_TO_LITERS;
private _currentTemperature = DEFAULT_TEMPERATURE min ((-3.5 * (0.95 ^ _mapTemperature + _altitudeAdjustment) + (((_bloodVolume + 0.01) / 6) * (60 + (_warmingImpact * 60)))));
private _pointTemperature = -3.5 * (0.95 ^ _mapTemperature + _altitudeAdjustment);
private _currentTemperature = DEFAULT_TEMPERATURE min (((-0.3392 * (_bloodVolume^2)) + (6.00357 * _bloodVolume) + (13.3 + _warmingImpact - (_pointTemperature / 20))));

_unit setVariable [QEGVAR(hypothermia,unitTemperature), _currentTemperature, _syncValue];

Expand Down
17 changes: 7 additions & 10 deletions addons/vitals/functions/fnc_handleUnitVitals.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,18 @@ if (EGVAR(breathing,enable)) then {
// Systolic Blood Pressure from Blood Volume with postive Heart Rate impacts capped by Blood Volume, Diastolic Blood Pressure from Vasoconstriction and Systolic BP
private _vasoconstriction = GET_VASOCONSTRICTION(_unit);

private _bloodPressureSystolic = (_bloodVolume * 20) * ((_unit getVariable [VAR_PERIPH_RES, DEFAULT_PERIPH_RES]) / 100) + ((_heartRate - DEFAULT_HEART_RATE) - (((5.5 - _bloodVolume) max 0) * 30));
private _bloodPressureSystolic = (_bloodVolume * 20) * ((_unit getVariable [VAR_PERIPH_RES, DEFAULT_PERIPH_RES]) / 100) + ((-0.005 * _heartRate^2) + (1.6 * _heartRate) - 96);
_bloodPressureSystolic = 250 / (1 + exp((-0.04) * (_bloodPressureSystolic - 122)));

private _bloodPressureDiastolic = ((_bloodVolume * 13.33) * ((_unit getVariable [VAR_PERIPH_RES, DEFAULT_PERIPH_RES]) / 100) + ((_vasoconstriction - 1) * 40)) min (_bloodPressureSystolic - 5);
_bloodPressureDiastolic = 250 / (1 + exp((-0.04) * (_bloodPressureDiastolic - 100)));

// Vasoconstriction from Diastolic Blood Pressure and Alpha Adjustment
_vasoconstriction = switch (true) do {
case (_bloodPressureDiastolic <= 40): { 1.5 + _alphaFactorAdjustment };
case (_bloodPressureDiastolic >= 120): { 0.5 + _alphaFactorAdjustment };
default { (1.5 - (_bloodPressureDiastolic - 40) * (1 / 80)) + _alphaFactorAdjustment };
};
private _woundBloodLoss = GET_WOUND_BLEEDING(_unit);

// Vasoconstriction from Wound Blood Loss and Alpha Adjustment
_vasoconstriction = 1 + (0.5 * _woundBloodLoss) + _alphaFactorAdjustment;
_unit setVariable [VAR_VASOCONSTRICTION, (1.8 min (0.2 max _vasoconstriction)), _syncValues];

// Pull wound blood loss after recalculating vasoconstriction
private _woundBloodLoss = GET_WOUND_BLEEDING(_unit);

private _bloodPressure = [round(_bloodPressureDiastolic), round(_bloodPressureSystolic)];
_unit setVariable [VAR_BLOOD_PRESS, _bloodPressure, _syncValues];

Expand Down
32 changes: 16 additions & 16 deletions addons/zeus/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,22 @@
<Dutch>Spanningspneumothorax: </Dutch>
</Key>
<Key ID="STR_KAT_Zeus_ModuleManageAirway_SpO2Value">
<English>SpO2 value: </English>
<German>SpO2-Wert: </German>
<Czech>Hodnota SpO2: </Czech>
<French>Valeur Sp02: </French>
<Polish>Wartość SpO2: </Polish>
<Spanish>Valor SpO2: </Spanish>
<Korean>SpO2 값: </Korean>
<Chinese>SpO2值。</Chinese>
<Turkish>SpO2 değeri: </Turkish>
<Japanese>SpO2値:</Japanese>
<Russian>Значение SpO2:</Russian>
<Italian>Valore di SpO2</Italian>
<Chinesesimp>SpO2值:</Chinesesimp>
<Portuguese>Valor de SpO2:</Portuguese>
<Finnish>Veren happitaso (SpO2): </Finnish>
<Dutch>SpO2 waarde: </Dutch>
<English>PaO2 value: </English>
<German>PaO2-Wert: </German>
<Czech>Hodnota PaO2: </Czech>
<French>Valeur PaO2: </French>
<Polish>Wartość PaO2: </Polish>
<Spanish>Valor PaO2: </Spanish>
<Korean>PaO2 값: </Korean>
<Chinese>PaO2值。</Chinese>
<Turkish>PaO2 değeri: </Turkish>
<Japanese>PaO2:</Japanese>
<Russian>Значение PaO2:</Russian>
<Italian>Valore di PaO2</Italian>
<Chinesesimp>PaO2值:</Chinesesimp>
<Portuguese>Valor de PaO2:</Portuguese>
<Finnish>Veren happitaso (PaO2): </Finnish>
<Dutch>PaO2 waarde: </Dutch>
</Key>
<Key ID="STR_KAT_Zeus_ModuleManageAirway_bloodGroup">
<English>Blood group: </English>
Expand Down

0 comments on commit ac915f9

Please sign in to comment.