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

Airway/Vitals - Airway Rework #690

Draft
wants to merge 3 commits into
base: dev-Tomcat
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 23 additions & 12 deletions addons/airway/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ class ACE_Medical_Treatment_Actions {
callbackProgress = "";
sounds[] = {{QPATHTO_R(sounds\accuvac_start.wav),6,1,15}};
};
class SurgicalAccuvac: Larynxtubus {
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'));
icon = QPATHTOF(ui\accuvac.paa);
consumeItem = 0;
medicRequired = QGVAR(medLvl_Accuvac);
callbackStart = QFUNC(treatmentAdvanced_AccuvacStart);
callbackSuccess = QUOTE([ARR_6(_medic,_patient,_bodyPart,'Accuvac','','kat_accuvac')] call FUNC(treatmentAdvanced_accuvac)); //Need to manuelly call fnc due to ACE not providing _itemName when consumeItem == 0
callbackProgress = "";
sounds[] = {{QPATHTO_R(sounds\accuvac_start.wav),6,1,15}};
};
class Suction: Accuvac {
displayName = CSTRING(SuctionTreatment_displayName);
treatmentTime = QGVAR(Suction_time);
Expand All @@ -76,6 +89,16 @@ class ACE_Medical_Treatment_Actions {
callbackSuccess = QFUNC(treatmentAdvanced_accuvac);
sounds[] = {{QPATHTO_R(sounds\manualpump_start.wav),6,1,15}};
};
class SurgicalSuction: Accuvac {
displayName = CSTRING(SuctionTreatment_displayName);
treatmentTime = QGVAR(Suction_time);
items[] = {"kat_suction"};
icon = QPATHTOF(ui\suction.paa);
consumeItem = 1;
medicRequired = QGVAR(medLvl_Suction);
callbackSuccess = QFUNC(treatmentAdvanced_accuvac);
sounds[] = {{QPATHTO_R(sounds\manualpump_start.wav),6,1,15}};
};
class HyperextendHead: Larynxtubus {
displayName = CSTRING(Hyperextend_displayName);
displayNameProgress = CSTRING(Hyperextend_progress);
Expand All @@ -88,18 +111,6 @@ class ACE_Medical_Treatment_Actions {
callbackProgress = "";
callbackCondition = "useCondition";
};
class BeginHeadTurning: Larynxtubus {
displayName = CSTRING(headTurning_begin);
displayNameProgress = "";
treatmentTime = 0.01;
medicRequired = 0;
items[] = {};
icon = "";
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 getVariable [ARR_2(QQGVAR(airway_item),'')] == 'Guedeltubus') || !(missionNamespace getVariable [ARR_2(QQGVAR(block_headTurning_ifAirwayItem),true)])));
callbackSuccess = QFUNC(startHeadTurning);
callbackProgress = "";
sounds[] = {};
};
class RecoveryPosition: Larynxtubus {
displayName = CSTRING(RecoveryPosition_displayName);
displayNameProgress = CSTRING(RecoveryPosition_displayNameProgress);
Expand Down
44 changes: 44 additions & 0 deletions addons/airway/functions/fnc_airwayStatus.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include "..\script_component.hpp"
/*
* Author: Mazinski
* Checks or not whether the airway is clear
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Airway Clearance <BOOL>
*
* Example:
* [player] call kat_airway_fnc_airwayStatus;
*
* Public: No
*/

params ["_patient"];

private _occulsion = _patient getVariable [QGVAR(occlusion), 0, true];
private _surgical = _patient getVariable [QGVAR(airwaySurgical), false, true];
private _obstruction = _patient getVariable [QGVAR(obstruction), [false, false, false], true];

_return = false;

private _obstructonCount = count[_obstruction select { _x isEqualTo false }];

// If a surgical airway is present, then the oral and upper airway obstructions are disregarded
if !(_surgical) then {

// The worse the occlusion is, the fewer parts of the airway need to be obstructed for an airway blockage to occur
switch (_occulsion) do {
case 4: { _return = false; }; // Full occlusion, surgical
case 3: { _return = false; }; // Full occlusion
case 2: { _return = (_obstructionCount < 1); }; // Moderate occlusion
case 1: { _return = (_obstructionCount < 2); }; // Mild occlusion
default { _return = (_obstructionCount < 3); }; // No occlusion, obstruction needs 3 parts
};
} else {
// Only check lower airway obstruction when a surgical airway is present
_return = !(_obstruction select 2);
};

_patient setVariable [QGVAR(airwayClear), _return, true];
22 changes: 16 additions & 6 deletions addons/airway/functions/fnc_fullHealLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@
params ["_patient"];
TRACE_1("fullHealLocal",_patient);

/*
0 = No Stenosis (Grade 1)
1 = Light Stenosis (Grade 2)
2 = Heavy Stenosis (Grade 3)
3 = Full Stenosis/Removable (Grade 4)
4 = Full Stenosis/Not Removable (Surgical Grade 4)
*/
_patient setVariable [QGVAR(occlusion), 0, true];
_patient setVariable [QGVAR(airwaySurgical), false, true];

// Oral Obstruction, Upper Obstruction, Lower Obstruction
_patient setVariable [QGVAR(obstruction), [false, false, false], true];
_patient setVariable [QGVAR(airwayClear), true, true];

_patient setVariable [QGVAR(airway_item), "", true];
_patient setVariable [QGVAR(airway), false, true];
_patient setVariable [QGVAR(clearedTime), 0, true];
_patient setVariable [QGVAR(obstruction), false, true];
_patient setVariable [QGVAR(occluded), false, true];
_patient setVariable [QGVAR(overstretch), false, true];

_patient setVariable [QGVAR(headTilt), false, true];
_patient setVariable [QGVAR(recovery), false, true];
_patient setVariable [QGVAR(wasOccluded), false];
2 changes: 1 addition & 1 deletion addons/airway/functions/fnc_gui_updateInjuryListPart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

params ["_ctrl", "_target", "_selectionN", "_entries"];

if (_target getVariable [QGVAR(overstretch), false] && _selectionN isEqualTo 0) then {
if (_target getVariable [QGVAR(headTilt), false] && _selectionN isEqualTo 0) then {
_entries pushBack [LLSTRING(Hyperextended), [0.1, 1, 1, 1]];
};

if (_target getVariable [QGVAR(airway), false] && _selectionN isEqualTo 0) then {
private _a = _target getVariable [QGVAR(airway_item), ""];
if !(_a isEqualTo "") then {

Check notice on line 29 in addons/airway/functions/fnc_gui_updateInjuryListPart.sqf

View workflow job for this annotation

GitHub Actions / windows

Unneeded Not

unneeded not
private _text = format [LSTRING(%1_Display), _a];
_entries pushBack [localize _text, [0.1, 1, 1, 1]];
};
Expand Down
33 changes: 33 additions & 0 deletions addons/airway/functions/fnc_handleAirwayHit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include "..\script_component.hpp"
/*
* Author: Mazinski
* Called when a unit is damaged.
*
* Arguments:
* 0: Unit That Was Hit <OBJECT>
* 1: Damage done to each body part <ARRAY>
* 0: Damage <NUMBER>
* 1: Bodypart <STRING>
* 2: Shooter <OBJECT>
* 3: Ammo classname or damage type <STRING>
*
* Return Value:
* None
*
* Example:
* [cursorTarget, [1, "Body"], objNull, "BulletBase"] call kat_airway_fnc_handleAirwayHit;
*
* Public: No
*/

params ["_unit", "_allDamages", "", "_ammo"];
_allDamages select 0 params ["_damage", "_bodyPart"];

if (!(GVAR(enable)) || !(_bodyPart isEqualTo "Head") || !(_ammo isKindOF "BulletBase")) exitWith {};

Check notice on line 26 in addons/airway/functions/fnc_handleAirwayHit.sqf

View workflow job for this annotation

GitHub Actions / windows

Unneeded Not

unneeded not

Check notice on line 26 in addons/airway/functions/fnc_handleAirwayHit.sqf

View workflow job for this annotation

GitHub Actions / windows

`isKindOF` does not match the wiki's case

non-standard command case

if (floor (random 100) < GVAR(airwayDamageChance)) then {
private _occlusion = _unit getVariable [QGVAR(occlusion), 0];
_occlusion = ((_occlusion + 1) min 4);

_unit setVariable [QGVAR(occlusion), _occlusion, true];
};
24 changes: 15 additions & 9 deletions addons/airway/functions/fnc_handlePuking.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: Katalam, edited by MiszczuZPolski
* Called when a unit enters the unconscious state. Will add a FrameHandler for puking while unconscious.
* Called when a unit enters the unconscious state. Will add a FrameHandler for aspirating while unconscious.
*
* Arguments:
* 0: Unit <OBJECT>
Expand All @@ -18,7 +18,7 @@
params ["_unit"];

//Other mods can utilise KAT_Occlusion_Exclusion variable to prevent occlusions from happening
if ((_unit getVariable ["kat_pukeActive_PFH", false]) || !(GVAR(enable)) || (_unit getVariable ["KAT_Occlusion_Exclusion", false])) exitWith {};
if ((_unit getVariable ["kat_pukeActive_PFH", false]) || !(GVAR(enable)) || (_unit getVariable ["KAT_Obstruction_Exclusion", false])) exitWith {};
_unit setVariable ["kat_pukeActive_PFH", true];

[{
Expand All @@ -27,20 +27,26 @@

private _isUnconscious = _unit getVariable ["ACE_isUnconscious", false];
private _recovery = _unit getVariable [QGVAR(recovery), false];
private _obstruction = _unit getVariable [QGVAR(obstruction), [false, false, false]];
_obstruction params ["_oral", "_upper", "_lower"];

if ((!(alive _unit)) || !_isUnconscious || (_unit getVariable [QGVAR(airway_item), ""] isEqualTo "Larynxtubus") || _recovery) exitWith {
if ((!(alive _unit)) || !_isUnconscious) exitWith {
[_idPFH] call CBA_fnc_removePerFrameHandler;
_unit setVariable ["kat_pukeActive_PFH", nil];
};

if (GVAR(occlusion_cooldownPeriod) > 0 && {(_unit getVariable [QGVAR(clearedTime), 0] > 0) && ((_unit getVariable [QGVAR(clearedTime), 0]) + GVAR(occlusion_cooldownPeriod)) > CBA_missionTime}) exitWith {};
if (GVAR(obstruction_cooldownPeriod) > 0 && {(_unit getVariable [QGVAR(clearedTime), 0] > 0) && ((_unit getVariable [QGVAR(clearedTime), 0]) + GVAR(obstruction_cooldownPeriod)) > CBA_missionTime}) exitWith {};

if (random(100) <= GVAR(probability_obstructed)) then {
if !(_upper) then {
_upper = true;

if (random(100) <= GVAR(probability_occluded)) then {
if !(_unit getVariable [QGVAR(occluded), false]) then {
_unit setVariable [QGVAR(occluded), true, true];
if (GVAR(checkbox_puking_sound)) then {
playSound3D [selectRandom [QPATHTOF_SOUND(sounds\puking1.wav),QPATHTOF_SOUND(sounds\puking2.wav),QPATHTOF_SOUND(sounds\puking3.wav)], _unit, false, getPosASL _unit, 8, 1, 15];
playsound3D [selectRandom [QPATHTOF_SOUND(sounds\puking1.wav),QPATHTOF_SOUND(sounds\puking2.wav),QPATHTOF_SOUND(sounds\puking3.wav)], _unit, false, getPosASL _unit, 8, 1, 15];

Check notice on line 45 in addons/airway/functions/fnc_handlePuking.sqf

View workflow job for this annotation

GitHub Actions / windows

`playsound3D` does not match the wiki's case

non-standard command case
};
} else {
_upper = false;
_lower = true;
};
};
}, GVAR(occlusion_repeatTimer), [_unit]] call CBA_fnc_addPerFrameHandler;
}, GVAR(obstruction_repeatTimer), [_unit]] call CBA_fnc_addPerFrameHandler;
Loading