Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical Vitals - Add SPO2 #9360

Merged
merged 29 commits into from
Feb 7, 2024
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d451da6
spo2 initial
BrettMayson Sep 4, 2023
d7e1a43
Merge branch 'master' into spo2
BrettMayson Sep 4, 2023
93b3f9a
remove missed systemChat
BrettMayson Sep 4, 2023
1f4a0ad
some minor cleanup
BrettMayson Sep 4, 2023
c064ae0
review suggestions, effectiveness changes
BrettMayson Sep 8, 2023
3bb589e
cleanup
BrettMayson Sep 8, 2023
83054a3
fatigue compatibility with RC units
LinkIsGrim Oct 26, 2023
e79e6b3
Rename CfgVehicles.hpp to CfgWeapons.hpp
LinkIsGrim Oct 26, 2023
c901cab
CfgWeapons
LinkIsGrim Oct 26, 2023
9a8315b
Merge remote-tracking branch 'upstream/master' into spo2
LinkIsGrim Oct 26, 2023
f898a0c
fix script_component
LinkIsGrim Oct 26, 2023
4658059
switch to weather enabled setting
LinkIsGrim Oct 26, 2023
db8d2cc
move condition cache to preStart, add vest support
LinkIsGrim Oct 26, 2023
0ab9abc
add setting to disable
LinkIsGrim Oct 26, 2023
f4802ae
Update addons/medical_vitals/initSettings.sqf
BrettMayson Nov 21, 2023
5fedf37
Update addons/medical_vitals/functions/fnc_updateOxygen.sqf
BrettMayson Dec 28, 2023
328f8af
move default value reset to setting change
LinkIsGrim Jan 2, 2024
daee82b
Merge remote-tracking branch 'upstream/master' into spo2
LinkIsGrim Jan 2, 2024
570ac7a
fix setting
LinkIsGrim Jan 2, 2024
22a4c91
Update addons/medical_vitals/functions/fnc_updateOxygen.sqf
BrettMayson Jan 2, 2024
5dc1898
Merge remote-tracking branch 'upstream/master' into spo2
LinkIsGrim Jan 16, 2024
ff6f63c
fix respawn, full heal
LinkIsGrim Jan 16, 2024
80da6f6
edit macro name
LinkIsGrim Jan 16, 2024
f0d8fc4
OCD extra whitespace
LinkIsGrim Jan 16, 2024
c76e2b4
reduce aerobic fatigue effect (max oxygen demand from fatigue is now …
LinkIsGrim Jan 16, 2024
75a6edf
Update addons/medical_vitals/functions/fnc_updateOxygen.sqf
BrettMayson Jan 26, 2024
8e5ca92
Merge remote-tracking branch 'upstream/master' into spo2
LinkIsGrim Feb 5, 2024
f6a0baa
use AF's o2sat value if SPO2 simulation is disabled
LinkIsGrim Feb 5, 2024
4bdc410
Update addons/weather/functions/fnc_calculateOxygenDensity.sqf
LinkIsGrim Feb 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .hemtt/project.toml
Original file line number Diff line number Diff line change
@@ -44,3 +44,10 @@ workshop = [
dlc = [
"S.O.G. Prairie Fire",
]

[hemtt.launch.cup]
workshop = [
"450814997", # CBA_A3's Workshop ID
"583496184", # CUP Terrains - Core
"583544987", # CUP Terrains - Maps
]
6 changes: 1 addition & 5 deletions addons/advanced_fatigue/functions/fnc_mainLoop.sqf
Original file line number Diff line number Diff line change
@@ -23,11 +23,7 @@ if (!alive ACE_player) exitWith {
_staminaBarContainer ctrlCommit 1;
};

private _oxygen = if (missionNamespace getVariable ["ace_medical", false]) then {
(ACE_player getVariable [QEGVAR(medical,spo2), 90]) / 100
} else {
0.9
};
private _oxygen = (ACE_player getVariable [QEGVAR(medical,spo2), 90]) / 100;
johnb432 marked this conversation as resolved.
Show resolved Hide resolved

private _currentWork = REE;
private _currentSpeed = (vectorMagnitude (velocity ACE_player)) min 6;
19 changes: 11 additions & 8 deletions addons/medical_vitals/functions/fnc_updateOxygen.sqf
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ params ["_unit", "_deltaT", "_syncValue"];
private _current = GET_SPO2(_unit);
private _heartRate = GET_HEART_RATE(_unit);

private _altitude = (getPosASL _unit) select 2;
private _altitude = EGVAR(common,mapAltitude) + ((getPosASL _unit) select 2);
private _po2 = if (missionNamespace getVariable ["ace_weather", false]) then {
private _temperature = _altitude call EFUNC(weather,calculateTemperatureAtHeight);
private _pressure = _altitude call EFUNC(weather,calculateBarometricPressure);
@@ -39,8 +39,13 @@ private _oxygenSaturation = (IDEAL_PPO2 min _po2) / IDEAL_PPO2;
// Check gear for oxygen supply
[goggles _unit, headgear _unit] findIf {
if (_x != "") then {
private _condition = getText (configFile >> "CfgWeapons" >> _x >> QGVAR(oxygenSupply));
if (_condition != "" && {ace_player call compile _condition}) then {
if (isNil QGVAR(oxygenSupplyConditionCache)) then {
GVAR(oxygenSupplyConditionCache) = createHashmap;
};
private _condition = GVAR(oxygenSupplyConditionCache) getOrDefaultCall [_x, {
compile getText (configFile >> "CfgWeapons" >> _x >> QGVAR(oxygenSupply))
}, true];
if (_condition isNotEqualTo {} && {ACE_player call _condition}) then {
_oxygenSaturation = 1;
_po2 = IDEAL_PPO2;
true
@@ -56,14 +61,14 @@ private _oxygenSaturation = (IDEAL_PPO2 min _po2) / IDEAL_PPO2;
private _negativeChange = BASE_OXYGEN_USE;

// Fatigue will demand more oxygen
if (missionNamespace getVariable [QEGVAR(advanced_fatigue,enabled), false]) then {
if (_unit == player && {missionNamespace getVariable [QEGVAR(advanced_fatigue,enabled), false]}) then {
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved
_negativeChange = _negativeChange - ((1 - EGVAR(advanced_fatigue,aeReservePercentage)) * 0.5);
BrettMayson marked this conversation as resolved.
Show resolved Hide resolved
};

// Effectiveness of capturing oxygen
// increases slightly as po2 starts lowering
// but falls off quickly as po2 drops further
private _capture = 1 max ((_po2 / IDEAL_PPO2) ^ (-_po2 * 0.2));
private _capture = 1 max ((_po2 / IDEAL_PPO2) ^ (-_po2 * 3));
BrettMayson marked this conversation as resolved.
Show resolved Hide resolved
private _positiveChange = _heartRate * 0.00368 * _oxygenSaturation * _capture;

private _breathingEffectiveness = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume more factors will be come into play here later.

@@ -75,9 +80,7 @@ if (_rateOfChange < 0) then {
_negativeChange + _rateOfChange
};

private _spo2 = _current + (_rateOfChange * _deltaT);
_spo2 = _spo2 max 0;
_spo2 = _spo2 min 100;
private _spo2 = (_current + (_rateOfChange * _deltaT)) max 0 min 100;

_unit setVariable [QGVAR(oxygenDemand), _negativeChange - BASE_OXYGEN_USE];
_unit setVariable [VAR_SPO2, _spo2, _syncValue];