From dd2b1f5e1bf78c3efd34a4564dc93f3a7d4de64e Mon Sep 17 00:00:00 2001 From: mazinskihenry <33608576+mazinskihenry@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:29:40 -0800 Subject: [PATCH] Airway/Breathing/Vitals - Adds Oxygen Mask for High Altitude Operations (#646) **When merged this pull request will:** - Adds O2 masks to support high altitude operations - Adds helicopter/plane O2 support for pilots and crew ### 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 <71414303+MiszczuZPolski@users.noreply.github.com> --- .../airway/ACE_Medical_Treatment_Actions.hpp | 6 +- addons/airway/XEH_PREP.hpp | 1 + addons/airway/functions/fnc_checkMask.sqf | 24 ++++++ .../ACE_Medical_Treatment_Actions.hpp | 11 ++- addons/breathing/CfgMagazines.hpp | 18 ++++ addons/breathing/CfgVehicles.hpp | 45 ++++++++++ addons/breathing/XEH_PREP.hpp | 10 ++- addons/breathing/XEH_postInit.sqf | 4 + addons/breathing/XEH_preInit.sqf | 15 ++++ .../functions/fnc_attachPersonalOxygen.sqf | 84 +++++++++++++++++++ .../functions/fnc_attachVehicleOxygen.sqf | 47 +++++++++++ addons/breathing/functions/fnc_canUseBVM.sqf | 2 +- .../functions/fnc_checkAircraftOxygen.sqf | 31 +++++++ .../functions/fnc_checkPersonalOxygen.sqf | 27 ++++++ .../functions/fnc_detachPersonalOxygen.sqf | 34 ++++++++ .../breathing/functions/fnc_handleRespawn.sqf | 3 + addons/breathing/functions/fnc_init.sqf | 3 + .../functions/fnc_removeOxygenMask.sqf | 33 ++++++++ addons/breathing/stringtable.xml | 42 ++++++++++ .../functions/fnc_handleOxygenFunction.sqf | 1 + 20 files changed, 434 insertions(+), 7 deletions(-) create mode 100644 addons/airway/functions/fnc_checkMask.sqf create mode 100644 addons/breathing/functions/fnc_attachPersonalOxygen.sqf create mode 100644 addons/breathing/functions/fnc_attachVehicleOxygen.sqf create mode 100644 addons/breathing/functions/fnc_checkAircraftOxygen.sqf create mode 100644 addons/breathing/functions/fnc_checkPersonalOxygen.sqf create mode 100644 addons/breathing/functions/fnc_detachPersonalOxygen.sqf create mode 100644 addons/breathing/functions/fnc_removeOxygenMask.sqf diff --git a/addons/airway/ACE_Medical_Treatment_Actions.hpp b/addons/airway/ACE_Medical_Treatment_Actions.hpp index 521ca2d6b..a5750776a 100644 --- a/addons/airway/ACE_Medical_Treatment_Actions.hpp +++ b/addons/airway/ACE_Medical_Treatment_Actions.hpp @@ -9,7 +9,7 @@ class ACE_Medical_Treatment_Actions { medicRequired = QGVAR(medLvl_Larynxtubus); treatmentTime = QGVAR(Larynxtubus_time); items[] = {"kat_larynx"}; - condition = QUOTE(!([_patient] call ACEFUNC(common,isAwake)) && (missionNamespace getVariable [ARR_2(QQGVAR(enable),true)]) && !(_patient getVariable [ARR_2(QQGVAR(airway_item),'')] == 'Larynxtubus') && !(_patient getVariable [ARR_2(QQGVAR(airway_item),'')] == 'Guedeltubus')); + condition = QUOTE(!([_patient] call ACEFUNC(common,isAwake)) && (missionNamespace getVariable [ARR_2(QQGVAR(enable),true)]) && !(_patient getVariable [ARR_2(QQGVAR(airway_item),'')] == 'Larynxtubus') && !(_patient getVariable [ARR_2(QQGVAR(airway_item),'')] == 'Guedeltubus') && !([_patient] call FUNC(checkMask))); callbackSuccess = QUOTE([ARR_3(_medic,_patient,(_patient getVariable [ARR_2(QQGVAR(occluded),false)]))] call FUNC(handleRecoveryPosition); [ARR_6(_medic,_patient,_bodyPart,_className,objNull,_usedItem)] call FUNC(treatmentAdvanced_airway);); callbackFailure = ""; callbackProgress = ""; @@ -57,7 +57,7 @@ class ACE_Medical_Treatment_Actions { displayName = CSTRING(AccuvacTreatment_displayName); treatmentTime = QGVAR(Accuvac_time); items[] = {"kat_accuvac"}; - condition = QUOTE(!([_patient] call ACEFUNC(common,isAwake)) && (missionNamespace getVariable [ARR_2(QQGVAR(enable),true)]) && !(_patient getVariable [ARR_2(QQGVAR(recovery),false)]) && !(_patient getVariable [ARR_2(QQGVAR(airway_item),'')] == 'Larynxtubus')); + condition = QUOTE(!([_patient] call ACEFUNC(common,isAwake)) && (missionNamespace getVariable [ARR_2(QQGVAR(enable),true)]) && !(_patient getVariable [ARR_2(QQGVAR(recovery),false)]) && !(_patient getVariable [ARR_2(QQGVAR(airway_item),'')] == 'Larynxtubus') && !([_patient] call FUNC(checkMask))); icon = QPATHTOF(ui\accuvac.paa); consumeItem = 0; medicRequired = QGVAR(medLvl_Accuvac); @@ -140,7 +140,7 @@ class ACE_Medical_Treatment_Actions { allowedSelections[] = {"Head"}; allowSelfTreatment = 0; callbackSuccess = QFUNC(checkAirway); - condition = QUOTE(!([_patient] call ACEFUNC(common,isAwake)) && (missionNamespace getVariable [ARR_2(QQGVAR(enable),true)])); + condition = QUOTE(!([_patient] call ACEFUNC(common,isAwake)) && (missionNamespace getVariable [ARR_2(QQGVAR(enable),true)]) && !([_patient] call FUNC(checkMask))); animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback"; animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon", "kat_recoveryposition"}; }; diff --git a/addons/airway/XEH_PREP.hpp b/addons/airway/XEH_PREP.hpp index e19feb989..1d1e6eda0 100644 --- a/addons/airway/XEH_PREP.hpp +++ b/addons/airway/XEH_PREP.hpp @@ -1,5 +1,6 @@ PREP(checkAirway); PREP(checkRecovery); +PREP(checkMask); PREP(fullHealLocal); PREP(gui_updateBodyImage); PREP(gui_updateInjuryListGeneral); diff --git a/addons/airway/functions/fnc_checkMask.sqf b/addons/airway/functions/fnc_checkMask.sqf new file mode 100644 index 000000000..fafcaec4d --- /dev/null +++ b/addons/airway/functions/fnc_checkMask.sqf @@ -0,0 +1,24 @@ +#include "..\script_component.hpp" +/* + * Author: Mazinski + * Checks if patient has mask on + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [player] call kat_airway_fnc_checkMask; + * + * Public: No + */ + +params ["_patient"]; + +if ((goggles _patient in (missionNamespace getVariable [QEGVAR(chemical,availGasmaskList), []])) || (goggles _patient in (missionNamespace getVariable [QEGVAR(breathing,availOxyMaskList), []]))) exitWith { + true +}; + +false \ No newline at end of file diff --git a/addons/breathing/ACE_Medical_Treatment_Actions.hpp b/addons/breathing/ACE_Medical_Treatment_Actions.hpp index 26f725246..c355b107e 100644 --- a/addons/breathing/ACE_Medical_Treatment_Actions.hpp +++ b/addons/breathing/ACE_Medical_Treatment_Actions.hpp @@ -280,7 +280,7 @@ class ACE_Medical_Treatment_Actions { medicRequired = QGVAR(medLvl_NasalCannula); treatmentTime = QGVAR(NasalCannula_time); items[] = {"kat_nasal"}; - condition = QUOTE((missionNamespace getVariable [ARR_2(QQGVAR(enable),true)]) && !((_patient getVariable [ARR_2(QQGVAR(etco2Monitor),[])] findIf {_x == 'NasalCannula'}) > -1)); + condition = QUOTE((missionNamespace getVariable [ARR_2(QQGVAR(enable),true)]) && !((_patient getVariable [ARR_2(QQGVAR(etco2Monitor),[])] findIf {_x == 'NasalCannula'}) > -1) && !([_patient] call EFUNC(airway,checkMask))); callbackSuccess = QFUNC(treatmentAdvanced_nasalCannula); callbackFailure = ""; callbackProgress = ""; @@ -305,4 +305,13 @@ class ACE_Medical_Treatment_Actions { condition = QUOTE((missionNamespace getVariable [ARR_2(QQGVAR(enable),true)]) && ((_patient getVariable [ARR_2(QQGVAR(etco2Monitor),[])] findIf {_x == 'NasalCannula'}) > -1)); callbackSuccess = QFUNC(treatmentAdvanced_removeNasalCannula); }; + class RemoveOxyMask : NasalCannula { + displayName = CSTRING(Remove_OxyMask); + displayNameProgress = ECSTRING(airway,action_removing); + medicRequired = 0; + treatmentTime = 5; + items[] = {}; + condition = QUOTE(_patient call EFUNC(airway,checkMask)); + callbackSuccess = QFUNC(removeOxygenMask); + }; }; diff --git a/addons/breathing/CfgMagazines.hpp b/addons/breathing/CfgMagazines.hpp index eae0f01e9..c3342089a 100644 --- a/addons/breathing/CfgMagazines.hpp +++ b/addons/breathing/CfgMagazines.hpp @@ -37,4 +37,22 @@ class CfgMagazines { ACE_isMedicalItem = 1; ACE_asItem = 1; }; + class kat_personal_oxygen: CA_Magazine { + scope = 2; + scopeCurator = 2; + scopeArsenal = 2; + author = "Mazinski"; + displayName = CSTRING(PersonalOxygen_Display); + descriptionShort = CSTRING(PersonalOxygen_Desc_Short); + picture = QPATHTOF(ui\oxygenTank.paa); + + ammo = ""; + count = 60; + initSpeed = 0; + tracersEvery = 0; + lastRoundsTracer = 0; + mass = 3; + ACE_isMedicalItem = 1; + ACE_asItem = 1; + }; }; diff --git a/addons/breathing/CfgVehicles.hpp b/addons/breathing/CfgVehicles.hpp index 59c8dd38c..a6c5a6214 100644 --- a/addons/breathing/CfgVehicles.hpp +++ b/addons/breathing/CfgVehicles.hpp @@ -126,6 +126,24 @@ class CfgVehicles { condition = QUOTE((GVAR(locationProvideOxygen) in [ARR_2(2,3)]) && 'kat_oxygenTank_300_Empty' in (items _player) && _player call ACEFUNC(medical_treatment,isInMedicalFacility)); statement = QUOTE([ARR_3(_player,'kat_oxygenTank_300',GVAR(PortableOxygenTank_RefillTime)*2)] call FUNC(refillOxygenTank)); }; + class Attach_PersonalOxygen { + displayName = CSTRING(AttachPersonalOxygenTank); + condition = QUOTE(([ARR_2(_player,'kat_personal_oxygen')] call ACEFUNC(common,hasMagazine)) && (_player call EFUNC(airway,checkMask))); + statement = QUOTE(_player call FUNC(attachPersonalOxygen)); + showDisabled = 0; + exceptions[] = {"isNotSwimming", "isNotOnLadder"}; + icon = QPATHTOF(ui\oxygenTank_ui.paa); + }; + class Detach_PersonalOxygen: Attach_PersonalOxygen { + displayName = CSTRING(RemovePersonalOxygenTank); + condition = QUOTE(_player getVariable [ARR_2(QQGVAR(oxygenMaskActive),false)]); + statement = QUOTE(_player call FUNC(detachPersonalOxygen)); + }; + class Check_PersonalOxygen: Attach_PersonalOxygen { + displayName = CSTRING(CheckPersonalOxygenTank); + condition = QUOTE(_player getVariable [ARR_2(QQGVAR(oxygenMaskActive),false)]); + statement = QUOTE(_player call FUNC(checkPersonalOxygen)); + }; }; }; }; @@ -152,4 +170,31 @@ class CfgVehicles { }; }; }; + + class Air; + class Helicopter: Air { + class ACE_SelfActions { + class KAT_AttachOxygenVehicle { + displayName = CSTRING(AttachOxygenVehicle); + condition = QUOTE((_player call FUNC(checkAircraftOxygen)) && (_player call EFUNC(airway,checkMask))); + statement = QUOTE(_player call FUNC(attachVehicleOxygen)); + insertChildren = ""; + exceptions[] = {}; + icon = QACEPATHTOF(medical_gui,ui\cross.paa); + }; + }; + }; + + class Plane: Air { + class ACE_SelfActions { + class KAT_AttachOxygenVehicle { + displayName = CSTRING(AttachOxygenVehicle); + condition = QUOTE((_player call FUNC(checkAircraftOxygen)) && (_player call EFUNC(airway,checkMask))); + statement = QUOTE(_player call FUNC(attachVehicleOxygen)); + insertChildren = ""; + exceptions[] = {}; + icon = QACEPATHTOF(medical_gui,ui\cross.paa); + }; + }; + }; }; diff --git a/addons/breathing/XEH_PREP.hpp b/addons/breathing/XEH_PREP.hpp index 9986f02b8..0620ce076 100644 --- a/addons/breathing/XEH_PREP.hpp +++ b/addons/breathing/XEH_PREP.hpp @@ -1,6 +1,11 @@ +PREP(attachPersonalOxygen); +PREP(attachVehicleOxygen); PREP(canUseBVM); +PREP(checkAircraftOxygen); PREP(checkBreathing); +PREP(checkPersonalOxygen); PREP(checkPulseOximeter); +PREP(detachPersonalOxygen); PREP(fullHealLocal); PREP(gui_updateBodyImage); PREP(gui_updateInjuryListPart); @@ -16,6 +21,7 @@ PREP(init); PREP(inspectChest); PREP(listenLungs); PREP(refillOxygenTank); +PREP(removeOxygenMask); PREP(treatmentAdvanced_chestSeal); PREP(treatmentAdvanced_chestSealLocal); PREP(treatmentAdvanced_hemopneumothorax); @@ -24,9 +30,9 @@ PREP(treatmentAdvanced_nasalCannula); PREP(treatmentAdvanced_nasalCannulaLocal); PREP(treatmentAdvanced_pulseoximeter); PREP(treatmentAdvanced_pulseoximeterLocal); -PREP(treatmentAdvanced_removePulseoximeter); PREP(treatmentAdvanced_removeNasalCannula); PREP(treatmentAdvanced_removeNasalCannulaLocal); +PREP(treatmentAdvanced_removePulseoximeter); PREP(treatmentAdvanced_tensionpneumothorax); PREP(treatmentAdvanced_tensionpneumothoraxLocal); -PREP(useBVM); +PREP(useBVM); \ No newline at end of file diff --git a/addons/breathing/XEH_postInit.sqf b/addons/breathing/XEH_postInit.sqf index 41d13854e..5e3502139 100644 --- a/addons/breathing/XEH_postInit.sqf +++ b/addons/breathing/XEH_postInit.sqf @@ -21,3 +21,7 @@ [QACEGVAR(medical_gui,updateBodyImage), LINKFUNC(gui_updateBodyImage)] call CBA_fnc_addEventHandler; [QACEGVAR(medical_treatment,fullHealLocalMod), LINKFUNC(fullHealLocal)] call CBA_fnc_addEventHandler; [QACEGVAR(medical,woundReceived),LINKFUNC(handlePulmoHit)] call CBA_fnc_addEventHandler; + +private _items = missionNamespace getVariable [QGVAR(availOxyMask), "'G_AirPurifyingRespirator_01_F'"]; +private _array = [_items, "CfgGlasses"] call FUNC(getList); +missionNamespace setVariable [QGVAR(availOxyMaskList), _array, true]; \ No newline at end of file diff --git a/addons/breathing/XEH_preInit.sqf b/addons/breathing/XEH_preInit.sqf index 47eaed3b6..1db1b0348 100644 --- a/addons/breathing/XEH_preInit.sqf +++ b/addons/breathing/XEH_preInit.sqf @@ -18,6 +18,21 @@ PREP_RECOMPILE_END; true ] call CBA_Settings_fnc_init; +//Adds available oxygen masks +[ + QGVAR(availOxyMask), + "EDITBOX", + [LLSTRING(SETTING_AVAIL_OXYMASK), LLSTRING(SETTING_AVAIL_OXYMASK_DISC)], + [CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)], + "'G_AirPurifyingRespirator_01_F'", + 1, + { + private _array = [_this, "CfgGlasses"] call FUNC(getList); + missionNamespace setVariable [QGVAR(availOxyMaskList), _array, true]; + }, + true +] call CBA_Settings_fnc_init; + //Enable Check Breathing medical action [ QGVAR(enableCheckBreathing), diff --git a/addons/breathing/functions/fnc_attachPersonalOxygen.sqf b/addons/breathing/functions/fnc_attachPersonalOxygen.sqf new file mode 100644 index 000000000..b763ee51e --- /dev/null +++ b/addons/breathing/functions/fnc_attachPersonalOxygen.sqf @@ -0,0 +1,84 @@ +#include "..\script_component.hpp" +/* + * Author: Mazinski + * Attaches personal oxygen tank to player + * Main function + * + * Arguments: + * 0: Patient + * + * Return Value: + * None + * + * Example: + * [player] call kat_breathing_fnc_attachPersonalOxygen; + * + * Public: No + */ + +params ["_patient"]; + +if ((_patient getVariable [QGVAR(oxygenMaskActive), false])) exitWith { + [LSTRING(PersonalOxygen_Affirm), 1.5, _patient] call ACEFUNC(common,displayTextStructured); +}; + +_patient setVariable [QGVAR(oxygenMaskActive), true, true]; + +private _availableTanks = (magazinesAmmo [_patient, false]) select {(_x select 0) isEqualTo "kat_personal_oxygen"}; +private _largestTank = 0; + +{ + if (_x select 1 > ((_availableTanks select _largestTank) select 1)) then { + _largestTank = _y; + }; +} forEach _availableTanks; + +private _largestTankValue = (_availableTanks select _largestTank) select 1; + +_availableTanks deleteAt _largestTank; +_patient removeMagazines "kat_personal_oxygen"; + +{ _patient addMagazine _x; } forEach _availableTanks; + +_patient setVariable [QGVAR(oxygenMaskStatus), [(_largestTankValue + 1), 1], true]; + +[{ + _this params ["_args", "_pfhID"]; + _args params ["_patient"]; + + if !((_patient call EFUNC(airway,checkMask))) exitWith { + _patient call FUNC(detachPersonalOxygen); + _pfhID call CBA_fnc_removePerFrameHandler; + }; + +}, 5, [ + _patient +]] call CBA_fnc_addPerFrameHandler; + +[{ + _this params ["_args", "_pfhID"]; + _args params ["_patient"]; + + if !(alive _patient) exitWith { + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + if !(_patient setVariable [QGVAR(oxygenMaskActive), true]) exitWith { + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + private _maskStatus = _patient getVariable [QGVAR(oxygenMaskStatus), [0,0]]; + + if ((_maskStatus select 0) == 0) exitWith { + [LLSTRING(PersonalOxygen_Empty), 1.5, _patient] call ACEFUNC(common,displayTextStructured); + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + if ((_maskStatus select 1) == 0) exitWith { + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + _patient setVariable [QGVAR(oxygenMaskStatus), [((_maskStatus select 0) - 1), _pfhID]]; +}, 60, [ + _patient +]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/breathing/functions/fnc_attachVehicleOxygen.sqf b/addons/breathing/functions/fnc_attachVehicleOxygen.sqf new file mode 100644 index 000000000..d53c04b61 --- /dev/null +++ b/addons/breathing/functions/fnc_attachVehicleOxygen.sqf @@ -0,0 +1,47 @@ +#include "..\script_component.hpp" +/* + * Author: Mazinski + * Attaches vehicle oxygen to player + * Main function + * + * Arguments: + * 0: Patient + * + * Return Value: + * None + * + * Example: + * [player] call kat_breathing_fnc_attachVehicleOxygen; + * + * Public: No + */ + +params ["_patient"]; + +if (_patient getVariable [QGVAR(oxygenMaskActive), false]) exitWith { + [LSTRING(PersonalOxygen_Affirm), 1.5, _patient] call ACEFUNC(common,displayTextStructured); +}; + +_patient setVariable [QGVAR(oxygenMaskActive), true, true]; + +[{ + _this params ["_args", "_pfhID"]; + _args params ["_patient"]; + + if !(alive _patient) exitWith { + _patient setVariable [QGVAR(oxygenMaskActive), false, true]; + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + if (isNull objectParent _patient) exitWith { + _patient setVariable [QGVAR(oxygenMaskActive), false, true]; + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + if !((_patient call EFUNC(airway,checkMask))) exitWith { + _patient setVariable [QGVAR(oxygenMaskActive), false, true]; + _pfhID call CBA_fnc_removePerFrameHandler; + }; +}, 10, [ + _patient +]] call CBA_fnc_addPerFrameHandler; \ No newline at end of file diff --git a/addons/breathing/functions/fnc_canUseBVM.sqf b/addons/breathing/functions/fnc_canUseBVM.sqf index 3de662f96..39e0a70e9 100644 --- a/addons/breathing/functions/fnc_canUseBVM.sqf +++ b/addons/breathing/functions/fnc_canUseBVM.sqf @@ -17,4 +17,4 @@ params ["_patient"]; -!(_patient call ACEFUNC(common,isAwake)) && !(_patient getVariable [QGVAR(BVMInUse), false] && {["",_patient] call ACEFUNC(medical_treatment,canCPR)}); +!(_patient call ACEFUNC(common,isAwake)) && !(_patient getVariable [QGVAR(BVMInUse), false] && {["",_patient] call ACEFUNC(medical_treatment,canCPR)} && !(_patient getVariable [QGVAR(oxygenMaskActive), false])); diff --git a/addons/breathing/functions/fnc_checkAircraftOxygen.sqf b/addons/breathing/functions/fnc_checkAircraftOxygen.sqf new file mode 100644 index 000000000..62a9ca228 --- /dev/null +++ b/addons/breathing/functions/fnc_checkAircraftOxygen.sqf @@ -0,0 +1,31 @@ +#include "..\script_component.hpp" +/* + * Author: Mazinski + * Checks status of attached oxygen + * Main function + * + * Arguments: + * 0: Patient + * + * Return Value: + * None + * + * Example: + * [player] call kat_breathing_fnc_checkAircraftOxygen; + * + * Public: No + */ + +params ["_patient"]; + +if (isNull objectParent _patient) exitWith { + false +}; + +private _playerPosition = assignedVehicleRole _patient; + +if ((_playerPosition select 0) isEqualTo "cargo") exitWith { + false +}; + +true \ No newline at end of file diff --git a/addons/breathing/functions/fnc_checkPersonalOxygen.sqf b/addons/breathing/functions/fnc_checkPersonalOxygen.sqf new file mode 100644 index 000000000..4af1f6db2 --- /dev/null +++ b/addons/breathing/functions/fnc_checkPersonalOxygen.sqf @@ -0,0 +1,27 @@ +#include "..\script_component.hpp" +/* + * Author: Mazinski + * Checks status of attached oxygen + * Main function + * + * Arguments: + * 0: Patient + * + * Return Value: + * None + * + * Example: + * [player] call kat_breathing_fnc_checkPersonalOxygen; + * + * Public: No + */ + +params ["_patient"]; + +private _maskStatus = _patient getVariable [QGVAR(oxygenMaskStatus), [0,0]]; + +if (_maskStatus isEqualTo [0,0]) exitWith { + [LSTRING(VehicleOxygen_Affirm), 1.5, _patient] call ACEFUNC(common,displayTextStructured); +}; + +[format ["%1 %2", (_maskStatus select 0), LLSTRING(PersonalOxygen_Remaining)], 1.5, _patient] call ACEFUNC(common,displayTextStructured); \ No newline at end of file diff --git a/addons/breathing/functions/fnc_detachPersonalOxygen.sqf b/addons/breathing/functions/fnc_detachPersonalOxygen.sqf new file mode 100644 index 000000000..931e30f56 --- /dev/null +++ b/addons/breathing/functions/fnc_detachPersonalOxygen.sqf @@ -0,0 +1,34 @@ +#include "..\script_component.hpp" +/* + * Author: Mazinski + * Detaches personal oxygen mask from player + * Main function + * + * Arguments: + * 0: Patient + * + * Return Value: + * None + * + * Example: + * [player] call kat_breathing_fnc_detachPersonalOxygen; + * + * Public: No + */ + +params ["_patient"]; + +private _maskStatus = _patient getVariable [QGVAR(oxygenMaskStatus), [0,0]]; + +if ((_maskStatus select 0) > 0) then { + _patient addMagazine ["kat_personal_oxygen", (_maskStatus select 0)]; +}; + +[LSTRING(PersonalOxygen_Disconnect), 1.5, _patient] call ACEFUNC(common,displayTextStructured); + +if ((_maskStatus select 1) != 1) then { + (_maskStatus select 1) call CBA_fnc_removePerFrameHandler; +}; + +_patient setVariable [QGVAR(oxygenMaskActive), false, true]; +_patient setVariable [QGVAR(oxygenMaskStatus), [0,0], true]; \ No newline at end of file diff --git a/addons/breathing/functions/fnc_handleRespawn.sqf b/addons/breathing/functions/fnc_handleRespawn.sqf index fcf114ebb..6336bd964 100644 --- a/addons/breathing/functions/fnc_handleRespawn.sqf +++ b/addons/breathing/functions/fnc_handleRespawn.sqf @@ -36,3 +36,6 @@ _unit setVariable ["kat_PulseoxiInUse_PFH", nil, true]; _unit setVariable ["kat_O2Breathing_PFH", nil, true]; _unit setVariable [QGVAR(usingStethoscope), nil]; + +_unit setVariable [QGVAR(oxygenMaskActive), false, true]; +_unit setVariable [QGVAR(oxygenMaskStatus), [0,0], true]; diff --git a/addons/breathing/functions/fnc_init.sqf b/addons/breathing/functions/fnc_init.sqf index 3bf92c07e..ff579259c 100644 --- a/addons/breathing/functions/fnc_init.sqf +++ b/addons/breathing/functions/fnc_init.sqf @@ -25,3 +25,6 @@ if !(GVAR(enable)) exitWith {}; _unit setVariable [QGVAR(pulseoximeter), false, true]; _unit setVariable [QGVAR(PulseOximeter_Volume), true, true]; _unit setVariable [QGVAR(PulseOximeter_VolumePatient), false, true]; + +_unit setVariable [QGVAR(oxygenMaskActive), false, true]; +_unit setVariable [QGVAR(oxygenMaskStatus), [0,0], true]; \ No newline at end of file diff --git a/addons/breathing/functions/fnc_removeOxygenMask.sqf b/addons/breathing/functions/fnc_removeOxygenMask.sqf new file mode 100644 index 000000000..a9f1497d6 --- /dev/null +++ b/addons/breathing/functions/fnc_removeOxygenMask.sqf @@ -0,0 +1,33 @@ +#include "..\script_component.hpp" +/* + * Author: Mazinski + * Removes oxygen mask from player + * Main function + * + * Arguments: + * 0: Patient + * + * Return Value: + * None + * + * Example: + * [player] call kat_breathing_fnc_removeOxygenMask; + * + * Public: No + */ + +params ["_medic", "_patient"]; + +private _maskStatus = _patient getVariable [QGVAR(oxygenMaskStatus), [0,0]]; + +if ((_maskStatus select 1) > 1) then { + [_maskStatus select 1] call CBA_fnc_removePerFrameHandler; +}; + +if ((_maskStatus select 0) > 0) then { + _patient addMagazine ["kat_personal_oxygen", (_maskStatus select 0)]; +}; + +_patient unassignItem (goggles _patient); +_patient setVariable [QGVAR(oxygenMaskActive), false, true]; +_patient setVariable [QGVAR(oxygenMaskStatus), [0,0], true]; \ No newline at end of file diff --git a/addons/breathing/stringtable.xml b/addons/breathing/stringtable.xml index 0b7002cfb..0cfcb2b54 100644 --- a/addons/breathing/stringtable.xml +++ b/addons/breathing/stringtable.xml @@ -2018,6 +2018,12 @@ Портативный кислородный баллон, содержащий 300 литров кислорода. Подключите к BVM для дальнейшего облегчения дыхания пациентов в критическом состоянии. Draagbare zuurstoftank, bevat 300L van zuurstof. Helpt met het beademen van kritieke patiënten wanneer verbonden aan een BVM + + Personal Oxygen Tank + + + Personal oxygen tank for high altitude operations + Empty Portable Oxygen Tank (150L) Bombona de oxigeno portátil vacío (150L) @@ -2731,5 +2737,41 @@ Whether or not Check Breathing medical action is enabled Se l'azione medica di controllo della respirazione è abilitata o meno + + Available Oxygen Masks + + + Sets which goggles can act as oxygen masks + + + Connect Personal Oxygen + + + Disconnect Personal Oxygen + + + Check Personal Oxygen Status + + + Minutes Remaining + + + Oxygen Tank Empty + + + Connect to Aircraft Oxygen + + + Attached to Aircraft Oxygen + + + Oxygen already connected + + + Oxygen tank disconnected + + + Remove Oxygen Mask + diff --git a/addons/vitals/functions/fnc_handleOxygenFunction.sqf b/addons/vitals/functions/fnc_handleOxygenFunction.sqf index d50598d1b..181936156 100644 --- a/addons/vitals/functions/fnc_handleOxygenFunction.sqf +++ b/addons/vitals/functions/fnc_handleOxygenFunction.sqf @@ -85,6 +85,7 @@ private _fio2 = switch (true) do { }; case ((_respiratoryRate == 0) && (EGVAR(breathing,SpO2_perfusion))): { 0 }; case ((_unit getVariable [QEGVAR(chemical,airPoisoning), false]) || (_unit getVariable [QEGVAR(breathing,tensionpneumothorax), false]) || (_unit getVariable [QEGVAR(breathing,hemopneumothorax), false])): { 0 }; + case (_unit getVariable [QEGVAR(breathing,oxygenMaskActive), false]): { 0.95 }; case (_unit getVariable [QEGVAR(breathing,oxygenTankConnected), false]): { 1 }; default { DEFAULT_FIO2 }; };