diff --git a/addons/airway/ACE_Medical_Treatment_Actions.hpp b/addons/airway/ACE_Medical_Treatment_Actions.hpp index d8e8fe6fe..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') && ([_patient] call FUNC(checkMask))); + 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') && ([_patient] call FUNC(checkMask))); + 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)]) && ([_patient] call FUNC(checkMask))); + 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/functions/fnc_checkMask.sqf b/addons/airway/functions/fnc_checkMask.sqf index 452887113..fafcaec4d 100644 --- a/addons/airway/functions/fnc_checkMask.sqf +++ b/addons/airway/functions/fnc_checkMask.sqf @@ -17,10 +17,8 @@ params ["_patient"]; -return = false; - -if ((goggles _patient in (missionNamespace getVariable [QEGVAR(chemical,availGasmaskList), []])) || (goggles _patient in (missionNamespace getVariable [QEGVAR(breathing,availOxyMaskList), []]))) then { - return = true; +if ((goggles _patient in (missionNamespace getVariable [QEGVAR(chemical,availGasmaskList), []])) || (goggles _patient in (missionNamespace getVariable [QEGVAR(breathing,availOxyMaskList), []]))) exitWith { + true }; -return +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 441b4ddd6..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 = ""; @@ -311,7 +311,7 @@ class ACE_Medical_Treatment_Actions { medicRequired = 0; treatmentTime = 5; items[] = {}; - condition = QUOTE(_patient call EFUNC(breathing,checkMask)); + condition = QUOTE(_patient call EFUNC(airway,checkMask)); callbackSuccess = QFUNC(removeOxygenMask); }; }; diff --git a/addons/breathing/CfgVehicles.hpp b/addons/breathing/CfgVehicles.hpp index 2565f7379..1eb645ba9 100644 --- a/addons/breathing/CfgVehicles.hpp +++ b/addons/breathing/CfgVehicles.hpp @@ -176,7 +176,7 @@ class CfgVehicles { class ACE_SelfActions { class KAT_AttachOxygenVehicle { displayName = CSTRING(AttachOxygenVehicle); - condition = QUOTE((call FUNC(checkAircraftOxygen)) && (_player call EFUNC(airway,checkMask))); + condition = QUOTE(([ARR_2(_target,_player)] call FUNC(checkAircraftOxygen)) && (_player call EFUNC(airway,checkMask))); statement = QUOTE(_player call FUNC(attachVehicleOxygen)); insertChildren = ""; exceptions[] = {}; diff --git a/addons/breathing/functions/fnc_attachPersonalOxygen.sqf b/addons/breathing/functions/fnc_attachPersonalOxygen.sqf index ff7a2cdc8..cce1fc7f7 100644 --- a/addons/breathing/functions/fnc_attachPersonalOxygen.sqf +++ b/addons/breathing/functions/fnc_attachPersonalOxygen.sqf @@ -46,14 +46,26 @@ _patient setVariable [QGVAR(oxygenMaskStatus), [(_largestTankValue + 1), 1], tru _this params ["_args", "_pfhID"]; _args params ["_patient"]; - if !(_patient setVariable [QGVAR(oxygenMaskActive), true]) exitWith { + if !((_patient call EFUNC(airway,checkMask))) exitWith { _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 { diff --git a/addons/breathing/functions/fnc_attachVehicleOxygen.sqf b/addons/breathing/functions/fnc_attachVehicleOxygen.sqf index ede7108d4..cba507193 100644 --- a/addons/breathing/functions/fnc_attachVehicleOxygen.sqf +++ b/addons/breathing/functions/fnc_attachVehicleOxygen.sqf @@ -24,6 +24,24 @@ if (_patient getVariable [QGVAR(oxygenMaskActive), false]) exitWith { _patient setVariable [QGVAR(oxygenMaskActive), true, true]; -[{ isNull objectParent _patient }, { - _patient setVariable [QGVAR(oxygenMaskActive), false, true]; -}, _patient, -1] call CBA_fnc_waitUntilAndExecute; \ No newline at end of file +[{ + _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 index cade62677..9f9aa6da7 100644 --- a/addons/breathing/functions/fnc_checkAircraftOxygen.sqf +++ b/addons/breathing/functions/fnc_checkAircraftOxygen.sqf @@ -22,10 +22,9 @@ if (isNull objectParent _patient) exitWith { false }; -private _fullCrew = fullCrew _vehicle; -private _playerPosition = (_fullCrew select {(_x select 0) == _patient}) select 1; +private _playerPosition = assignedVehicleRole _patient; -if (_playerPosition isEqualTo "cargo") exitWith { +if ((_playerPosition select 0) isEqualTo "cargo") exitWith { false }; diff --git a/addons/breathing/functions/fnc_removeOxygenMask.sqf b/addons/breathing/functions/fnc_removeOxygenMask.sqf index 7dab0cece..48ce263c8 100644 --- a/addons/breathing/functions/fnc_removeOxygenMask.sqf +++ b/addons/breathing/functions/fnc_removeOxygenMask.sqf @@ -16,7 +16,7 @@ * Public: No */ -params ["_patient"]; +params ["_medic", "_patient"]; private _maskStatus = _patient getVariable [QGVAR(oxygenMaskStatus), [0,0]];