-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Airway/Breathing/Vitals - Adds Oxygen Mask for High Altitude Operatio…
…ns (#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 <[email protected]>
- Loading branch information
1 parent
c2bf560
commit dd2b1f5
Showing
20 changed files
with
434 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: Mazinski | ||
* Checks if patient has mask on | ||
* | ||
* Arguments: | ||
* 0: Unit <OBJECT> | ||
* | ||
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: Mazinski | ||
* Attaches personal oxygen tank to player | ||
* Main function | ||
* | ||
* Arguments: | ||
* 0: Patient <OBJECT> | ||
* | ||
* 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: Mazinski | ||
* Attaches vehicle oxygen to player | ||
* Main function | ||
* | ||
* Arguments: | ||
* 0: Patient <OBJECT> | ||
* | ||
* 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: Mazinski | ||
* Checks status of attached oxygen | ||
* Main function | ||
* | ||
* Arguments: | ||
* 0: Patient <OBJECT> | ||
* | ||
* 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 |
Oops, something went wrong.