Skip to content
17 changes: 12 additions & 5 deletions addons/vitals/functions/fnc_handleUnitVitals.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,26 @@ if (_syncValues) then {
private _bloodVolume = ([_unit, _deltaT, _syncValues] call EFUNC(pharma,getBloodVolumeChange));
_unit setVariable [VAR_BLOOD_VOL, _bloodVolume, _syncValues];

private _temperature = 37;
// Enviromental Impact (Altitude, Temperature, Pressure)
private _baroPressure = 760;
private _temperature = DEFAULT_TEMPERATURE;
private _altitude = (getPosASL _unit) select 2;

if (GVAR(baroPressureEnable)) then {
if (GVAR(useACEpressure)) then {
private _hPa = _altitude call ACEFUNC(weather,calculateBarometricPressure);
_baroPressure = _hPa * 0.750062;
} else {
_baroPressure = 760 * exp((-(_altitude)) / 8400);
};
};

if (EGVAR(hypothermia,hypothermiaActive)) then {
// Enviromental Impact (Altitude, Temperature, Pressure)
private _altitude = (getPosASL _unit) select 2;
private _altitudeTempImpact = switch (true) do {
case (_altitude >= 10): { abs(_altitude/153) * -1 }; //For every 1000 meters of elevation gain, temperature decreases by ~6.5 degrees celsius
case (_altitude <= -1): { -35 max((abs(_altitude/50) * -1) - 17) }; //Average water temperature is 20 degrees celsius. Decreases to 2 degrees celsius at 1000 meters
default { 0 };
};

_baroPressure = 760 * exp((-(_altitude)) / 8400);
_temperature = [_unit, _altitudeTempImpact, _bloodVolume, _deltaT, _syncValues] call FUNC(handleTemperatureFunction);
};

Expand Down
18 changes: 18 additions & 0 deletions addons/vitals/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,21 @@
[0.1, 60, 15, 1],
true
] call CBA_fnc_addSetting;

[
QGVAR(baroPressureEnable),
"CHECKBOX",
[LLSTRING(PRESSURE_ENABLE), LLSTRING(PRESSURE_ENABLE_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Environment)],
[true],
true
] call CBA_fnc_addSetting;

[
QGVAR(useACEpressure),
"CHECKBOX",
[LLSTRING(PRESSURE_ACE), LLSTRING(PRESSURE_ACE_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Environment)],
[true],
true
] call CBA_fnc_addSetting;
16 changes: 16 additions & 0 deletions addons/vitals/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@
<Dutch>Versimpelt de vitale-waardensimulatie voor KI-eenheden. Dit kan helpen bij het besparen op FPS</Dutch>
<Turkish>FPS tasarrufu sağlamak için yapay zekâ birimlerine basitleştirilmiş vital hesaplamaları uygular.</Turkish>
</Key>
<Key ID="STR_KAT_Vitals_PRESSURE_ENABLE">
<English>Enable barometric pressure change</English>
<Japanese>気圧の変化を有効化</Japanese>
</Key>
<Key ID="STR_KAT_Vitals_PRESSURE_ENABLE_DESC">
<English>Enables barometric pressure changes with altitude that affect vitals such as oxygen calculations.\nDisabling this will prevent oxygen deprivation symptoms at high altitudes.</English>
<Japanese>酸素の計算などバイタルに影響を与える高度による気圧の変化を有効化します。\n無効化すると、高高度での酸欠症状が発生しなくなります。</Japanese>
</Key>
<Key ID="STR_KAT_Vitals_PRESSURE_ACE">
<English>Use ACE barometric pressure</English>
<Japanese>ACEの大気圧を使用</Japanese>
</Key>
<Key ID="STR_KAT_Vitals_PRESSURE_ACE_DESC">
<English>Use ACE calculation instead of KAM simplified calculation for barometric pressure value. (Require ACE Weather)</English>
<Japanese>気圧の値にKAMによる簡易化された計算ではなく、ACEによる計算を使用します。 (ACE Weather 天候システム が必要です)</Japanese>
</Key>
<Key ID="STR_KAT_Vitals_basicDiagnostic_Log">
<English>%1 - %2</English>
<Czech>%1 - %2</Czech>
Expand Down
14 changes: 11 additions & 3 deletions addons/watch/functions/fnc_showKWatch.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,18 @@ private _timeSeconds = _display displayCtrl 22008;
_altitude ctrlSetText ([_altitudeValue, 1, 0] call CBA_fnc_formatNumber);
};

if (GVAR(pressureUnit) == 1) then {
_baro ctrlSetText ([(_altitudeValue call ACEFUNC(weather,calculateBarometricPressure)), 1, 0] call CBA_fnc_formatNumber);
if (EGVAR(vitals,useACEpressure)) then {
if (GVAR(pressureUnit) == 1) then {
_baro ctrlSetText ([(_altitudeValue call ACEFUNC(weather,calculateBarometricPressure)), 1, 0] call CBA_fnc_formatNumber);
} else {
_baro ctrlSetText ([((_altitudeValue call ACEFUNC(weather,calculateBarometricPressure)) * 0.750062), 1, 0] call CBA_fnc_formatNumber);
};
} else {
_baro ctrlSetText ([((_altitudeValue call ACEFUNC(weather,calculateBarometricPressure)) / 1.3), 1, 0] call CBA_fnc_formatNumber);
if (GVAR(pressureUnit) == 1) then {
_baro ctrlSetText ([((760 * exp((-(_altitudeValue)) / 8400))* 1.333), 1, 0] call CBA_fnc_formatNumber);
} else {
_baro ctrlSetText ([(760 * exp((-(_altitudeValue)) / 8400)), 1, 0] call CBA_fnc_formatNumber);
};
};

if (GVAR(temperatureUnit) == 1) then {
Expand Down
Loading