Skip to content

Commit

Permalink
Breathing - Fix OxyMaskList variable and O2 Mask recognition (#654)
Browse files Browse the repository at this point in the history
**When merged this pull request will:**
- Fixes the availOxyMaskList variable
- Creates a separate mask check function just for oxygen masks

### 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}`.
  • Loading branch information
mazinskihenry authored Dec 11, 2024
1 parent 876733e commit 6ae9dd3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
6 changes: 3 additions & 3 deletions addons/breathing/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class CfgVehicles {
};
class Attach_PersonalOxygen {
displayName = CSTRING(AttachPersonalOxygenTank);
condition = QUOTE(([ARR_2(_player,'kat_personal_oxygen')] call ACEFUNC(common,hasMagazine)) && (_player call EFUNC(airway,checkMask)));
condition = QUOTE(([ARR_2(_player,'kat_personal_oxygen')] call ACEFUNC(common,hasMagazine)) && (_player call FUNC(checkOxygenMask)));
statement = QUOTE(_player call FUNC(attachPersonalOxygen));
showDisabled = 0;
exceptions[] = {"isNotSwimming", "isNotOnLadder"};
Expand Down Expand Up @@ -176,7 +176,7 @@ class CfgVehicles {
class ACE_SelfActions {
class KAT_AttachOxygenVehicle {
displayName = CSTRING(AttachOxygenVehicle);
condition = QUOTE((_player call FUNC(checkAircraftOxygen)) && (_player call EFUNC(airway,checkMask)));
condition = QUOTE((_player call FUNC(checkAircraftOxygen)) && (_player call FUNC(checkOxygenMask)));
statement = QUOTE(_player call FUNC(attachVehicleOxygen));
insertChildren = "";
exceptions[] = {};
Expand All @@ -189,7 +189,7 @@ class CfgVehicles {
class ACE_SelfActions {
class KAT_AttachOxygenVehicle {
displayName = CSTRING(AttachOxygenVehicle);
condition = QUOTE((_player call FUNC(checkAircraftOxygen)) && (_player call EFUNC(airway,checkMask)));
condition = QUOTE((_player call FUNC(checkAircraftOxygen)) && (_player call FUNC(checkOxygenMask)));
statement = QUOTE(_player call FUNC(attachVehicleOxygen));
insertChildren = "";
exceptions[] = {};
Expand Down
1 change: 1 addition & 0 deletions addons/breathing/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ PREP(attachVehicleOxygen);
PREP(canUseBVM);
PREP(checkAircraftOxygen);
PREP(checkBreathing);
PREP(checkOxygenMask);
PREP(checkPersonalOxygen);
PREP(checkPulseOximeter);
PREP(detachPersonalOxygen);
Expand Down
3 changes: 2 additions & 1 deletion addons/breathing/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
[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);
private _array = [_items, "CfgGlasses"] call EFUNC(chemical,getList);

missionNamespace setVariable [QGVAR(availOxyMaskList), _array, true];
2 changes: 1 addition & 1 deletion addons/breathing/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ PREP_RECOMPILE_END;
"'G_AirPurifyingRespirator_01_F'",
1,
{
private _array = [_this, "CfgGlasses"] call FUNC(getList);
private _array = [_this, "CfgGlasses"] call EFUNC(chemical,getList);
missionNamespace setVariable [QGVAR(availOxyMaskList), _array, true];
},
true
Expand Down
24 changes: 24 additions & 0 deletions addons/breathing/functions/fnc_checkOxygenMask.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "..\script_component.hpp"
/*
* Author: Mazinski
* Checks if patient has an oxygen mask on
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player] call kat_breathing_fnc_checkOxygenMask;
*
* Public: No
*/

params ["_patient"];

if ((goggles _patient in (missionNamespace getVariable [QGVAR(availOxyMaskList), []]))) exitWith {
true
};

false

0 comments on commit 6ae9dd3

Please sign in to comment.