Skip to content

Commit

Permalink
Airway/Breathing/Circulation/Misc/Pharma/Surgery - Add Ultrasound and…
Browse files Browse the repository at this point in the history
… REBOA Unit + H&Ts + Opioid Relief and Effectivness (#452)

**When merged this pull request will:**

- Adding a handheld ultrasound unit to immediately diagnose cardiac and
thoracic conditions
- Adding a simple REBOA unit to stop bleeding from lower extremities and
chest
- Adding H&T conditions to drop patients into cardiac arrest and better
track those conditions from a single variable

### 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>
  • Loading branch information
mazinskihenry and MiszczuZPolski authored Apr 19, 2024
1 parent d00f7b3 commit e640048
Show file tree
Hide file tree
Showing 75 changed files with 1,479 additions and 56 deletions.
40 changes: 40 additions & 0 deletions addons/breathing/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,26 @@ PREP_RECOMPILE_END;
true
] call CBA_Settings_fnc_init;

// Cardiac Arrest SpO2 value
[
QGVAR(SpO2_cardiacValue),
"SLIDER",
LLSTRING(SETTING_SpO2_cardiacValue),
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[0, 100, 75, 0],
true
] call CBA_Settings_fnc_init;

// Enables cardiac arrest in cause of SpO2 cardiac value
[
QGVAR(SpO2_cardiacActive),
"CHECKBOX",
LLSTRING(SETTING_SpO2_cardiacActive),
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[false],
true
] call CBA_Settings_fnc_init;

// Turn to unconscious in cause of SpO2 unconscious value
[
QGVAR(SpO2_unconscious),
Expand Down Expand Up @@ -259,6 +279,26 @@ PREP_RECOMPILE_END;
true
] call CBA_Settings_fnc_init;

//Deteriorating pneumothorax arrest countdown
[
QGVAR(PneumothoraxArrest),
"CHECKBOX",
[LLSTRING(SETTING_PneumothoraxArrest), LLSTRING(SETTING_PneumothoraxArrest_DESCRIPTION)],
[CBA_SETTINGS_CAT, LSTRING(SubCategory_ThoraxInjuries)],
[true],
true
] call CBA_Settings_fnc_init;

//Deteriorating pneumothorax arrest countdown
[
QGVAR(arrestPneumothorax_interval),
"SLIDER",
[LLSTRING(SETTING_arrestPneumothorax_interval), LLSTRING(SETTING_arrestPneumothorax_interval_Desc)],
[CBA_SETTINGS_CAT, LSTRING(SubCategory_ThoraxInjuries)],
[1, 3600, 30, 0],
true
] call CBA_Settings_fnc_init;

// Set if pneumothorax injury should always be visible in medical menu
[
QGVAR(PneumothoraxAlwaysVisible),
Expand Down
2 changes: 1 addition & 1 deletion addons/breathing/functions/fnc_checkBreathing.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "..\script_component.hpp"
/*
* Author: 1LT.Mazinski.H
* Author: Mazinski
* Modified: Blue
* Check how patient is breathing and the patient's PH levels
*
Expand Down
21 changes: 20 additions & 1 deletion addons/breathing/functions/fnc_handleBreathing.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "..\script_component.hpp"
/*
* Author: Katalam, edited by Tomcat, Kygan, YetheSamartaka and MJSTIC
* Author: Katalam, edited by Tomcat, Kygan, YetheSamartaka and Mazinski
* Handling oxygen saturation for breathing
*
* Arguments:
Expand Down Expand Up @@ -66,6 +66,25 @@ if (!local _unit) then {
private _multiplierOxygen = GVAR(BVMOxygen_Multiplier);
private _perfusionActive = false;

if (GVAR(SpO2_cardiacActive)) then {
private _ht = _unit getVariable [QEGVAR(circulation,ht), []];

if (_status <= GVAR(SpO2_cardiacValue)) then {
if ((_ht findIf {_x isEqualTo "hypoxia"}) == -1) then {
_ht pushBack "hypoxia";

if (_unit getVariable [QEGVAR(circulation,cardiacArrestType), 0] == 0) then {
[QACEGVAR(medical,FatalVitals), _unit] call CBA_fnc_localEvent;
};

_unit setVariable [QEGVAR(circulation,ht), _ht, true];
};
} else {
_ht deleteAt (_ht find "hypoxia");
_unit setVariable [QEGVAR(circulation,ht), _ht, true];
};
};

//if lethal SpO2 value is activated and lower the value x, then kill _unit
if ((_status <= GVAR(SpO2_dieValue)) && { GVAR(SpO2_dieActive) && { !_blockDeath } }) exitWith {
[_unit, "terminal_SpO2_death"] call ACEFUNC(medical_status,setDead);
Expand Down
23 changes: 23 additions & 0 deletions addons/breathing/functions/fnc_handlePneumothoraxDeterioration.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,34 @@ params ["_unit", "_chanceIncrease"];
private _ptxTarget = (_unit getVariable [QGVAR(pneumothorax), 0]) + 1;
// Once deteriorated far enough try to inflict advanced pneumothorax or if disabled kill the PFH
if (_ptxTarget > 4) exitWith {

if (GVAR(PneumothoraxArrest)) then {
[{
params ["_args", "_idPFH"];
_args params ["_unit"];

if ((_unit getVariable [QGVAR(pneumothorax), 0]) == 4) then {
private _ht = _unit getVariable [QEGVAR(circulation,ht), []];
if ((_ht findIf {_x isEqualTo "tension"}) == -1) then {
_ht pushBack "tension";

if (_unit getVariable [QEGVAR(circulation,cardiacArrestType), 0] == 0) then {
[QACEGVAR(medical,FatalVitals), _unit] call CBA_fnc_localEvent;
};

_unit setVariable [QEGVAR(circulation,ht), _ht, true];
};
};
}, [_unit], GVAR(arrestPneumothorax_interval)] call CBA_fnc_waitAndExecute;
};

if (GVAR(advPtxEnable)) then {
[_unit, _chanceIncrease, true] call FUNC(inflictAdvancedPneumothorax);
};

[_idPFH] call CBA_fnc_removePerFrameHandler;
};

_unit setVariable [QGVAR(pneumothorax), _ptxTarget, true];
[_unit, 0.5 * (_ptxTarget / 4)] call ACEFUNC(medical_status,adjustPainLevel); // Adjust pain based on severity
[_unit, -12, -12, "ptx_tension"] call EFUNC(circulation,updateBloodPressureChange); // Simulate low blood pressure and high heart rate caused by pneumothorax
Expand Down
50 changes: 50 additions & 0 deletions addons/breathing/functions/fnc_handlePulmoHit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ if (floor (random 100) < (GVAR(pneumothoraxChance) + _chanceIncrease)) then {
if (_unit getVariable [QGVAR(tensionpneumothorax), false]) then { // If already afflicted with tensionpneumothorax -> fully deteriorate pneumothorax
_unit setVariable [QGVAR(pneumothorax), 4, true];
_unit setVariable [QGVAR(activeChestSeal), false, true];

} else {
if (GVAR(advPtxEnable)) then {
// Roll chance to get advanced pneumothorax while afflicted with early stage of pneumothorax
Expand All @@ -58,5 +59,54 @@ if (floor (random 100) < (GVAR(pneumothoraxChance) + _chanceIncrease)) then {
if (floor (random 100) < GVAR(deepPenetratingInjuryChance)) then {
_unit setVariable [QGVAR(deepPenetratingInjury), true, true];
_unit setVariable [QGVAR(activeChestSeal), false, true];

if ((floor (random 100) <= EGVAR(circulation,tamponadeChance)) && (_unit getVariable [QEGVAR(circulation,effusion), 0] == 0)) then {
_unit setVariable [QEGVAR(circulation,effusion), 1, true];

[{
params ["_unit"];

if (_unit getVariable [QEGVAR(circulation,effusion), 0] > 0) then {
// Try to deteriorate at set interval
[{
params ["_args", "_idPFH"];
_args params ["_unit"];

private _effusion = _unit getVariable [QEGVAR(circulation,effusion), 0];

// If patient is dead, already treated or has already deteriorated into full tamponade, kill the PFH
if ((_effusion == 0) || !(alive _unit) || (_effusion == 4)) exitWith {
[_idPFH] call CBA_fnc_removePerFrameHandler;
};

if (floor (random 100) <= EGVAR(circulation,deterioratingTamponade_chance)) then {
private _effusionTarget = _effusion + 1;

// Once deteriorated far enough try to inflict tamponade
if (_effusionTarget == 4) exitWith {
private _ht = _unit getVariable [QEGVAR(circulation,ht), []];

if ((_ht findIf {_x isEqualTo "tamponade"}) == -1) then {
_ht pushBack "tamponade";

if (_unit getVariable [QEGVAR(circulation,cardiacArrestType), 0] == 0) then {
[QACEGVAR(medical,FatalVitals), _unit] call CBA_fnc_localEvent;
};

_unit setVariable [QEGVAR(circulation,ht), _ht, true];
};

[_idPFH] call CBA_fnc_removePerFrameHandler;
};

_unit setVariable [QEGVAR(circulation,effusion), _effusionTarget, true];
[_unit, 0.5 * (_effusionTarget / 4)] call ACEFUNC(medical_status,adjustPainLevel); // Adjust pain based on severity
[_unit, -10, -10, "cardiac_tension"] call EFUNC(circulation,updateBloodPressureChange); // Emulate low blood pressure and low heart rate caused by tamponade
};

}, EGVAR(circulation,deterioratingTamponade_interval), [_unit]] call CBA_fnc_addPerFrameHandler;
};
}, [_unit], EGVAR(circulation,deterioratingTamponade_interval)] call CBA_fnc_waitAndExecute;
};
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ if (_patient getVariable [QGVAR(activeChestSeal), false]) then {
[_patient] call EFUNC(circulation,updateInternalBleeding);
};

private _ht = _patient getVariable [QEGVAR(circulation,ht), []];
_ht deleteAt (_ht find "tension");
_patient setVariable [QEGVAR(circulation,ht), _ht, true];

if (!(_patient getVariable [QGVAR(pneumothorax), 0] > 0) && !(_patient getVariable [QGVAR(hemopneumothorax), false]) && !(_patient getVariable [QGVAR(tensionpneumothorax), false])) then {
[_patient, 0, 0, "ptx_tension", true] call EFUNC(circulation,updateBloodPressureChange);
if (GVAR(clearChestSealAfterTreatment)) then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if (_patient getVariable [QGVAR(activeChestSeal), false]) then {
_patient setVariable [QGVAR(tensionpneumothorax), false, true];
};

private _ht = _patient getVariable [QEGVAR(circulation,ht), []];
_ht deleteAt (_ht find "tension");
_patient setVariable [QEGVAR(circulation,ht), _ht, true];

if (!(_patient getVariable [QGVAR(pneumothorax), 0] > 0) && !(_patient getVariable [QGVAR(hemopneumothorax), false]) && !(_patient getVariable [QGVAR(tensionpneumothorax), false])) then {
[_patient, 0, 0, "ptx_tension", true] call EFUNC(circulation,updateBloodPressureChange);
if (GVAR(clearChestSealAfterTreatment)) then {
Expand Down
18 changes: 18 additions & 0 deletions addons/breathing/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
<Portuguese>Ativar o valor letal de SpO2</Portuguese>
<Finnish>Aktivoi tappava SpO2-arvo</Finnish>
</Key>
<Key ID="STR_KAT_Breathing_SETTING_SpO2_cardiacValue">
<English>Cardiac arrest SpO2 value</English>
</Key>
<Key ID="STR_KAT_Breathing_SETTING_SpO2_cardiacActive">
<English>Activate cardiac arrest SpO2 value</English>
</Key>
<Key ID="STR_KAT_Breathing_SETTING_MultiplyPositive">
<English>SpO2 positive multiplier</English>
<German>SpO2 positiver Multiplikator</German>
Expand Down Expand Up @@ -1274,6 +1280,18 @@
<Finnish>Jokaisen ajanjakson jälkeen lasketaan mahdollisuus, paheneeko ilmarinta vai ei</Finnish>
<Russian>После каждого интервала будет проверяться, ухудшится пневмоторакс или нет</Russian>
</Key>
<Key ID="STR_KAT_Breathing_SETTING_PneumothoraxArrest">
<English>Enable Pneumothorax Arrest</English>
</Key>
<Key ID="STR_KAT_Breathing_SETTING_PneumothoraxArrest_DESCRIPTION">
<English>Enables a chance for cardiac arrest following pneumothorax</English>
</Key>
<Key ID="STR_KAT_Breathing_SETTING_arrestPneumothorax_interval">
<English>Deteriorating pneumothorax arrest interval</English>
</Key>
<Key ID="STR_KAT_Breathing_SETTING_arrestPneumothorax_interval_Desc">
<English>After each interval a chance will be rolled whether or not a pneumothorax will result in cardiac arrest</English>
</Key>
<Key ID="STR_KAT_Breathing_SubCategory_Items">
<English>Breathing items Settings</English>
<Italian>Impostazioni oggetti respirazione </Italian>
Expand Down
29 changes: 29 additions & 0 deletions addons/circulation/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -524,4 +524,33 @@ PREP_RECOMPILE_END;
}
] call CBA_Settings_fnc_init;

// Chance of tamponade from chest wounds
[
QGVAR(tamponadeChance),
"SLIDER",
LLSTRING(SETTING_tamponadeChance),
[CBA_SETTINGS_CAT, LSTRING(SubCategory_AdvRhythms)],
[0,100,10,0],
true
] call CBA_Settings_fnc_init;

[
QGVAR(deterioratingTamponade_chance),
"SLIDER",
LLSTRING(SETTING_tamponadeChance_deterioration),
[CBA_SETTINGS_CAT, LSTRING(SubCategory_AdvRhythms)],
[0,100,35,0],
true
] call CBA_Settings_fnc_init;

// Tamponade deterioration timer
[
QGVAR(deterioratingTamponade_interval),
"SLIDER",
LLSTRING(SETTING_tamponadeInterval),
[CBA_SETTINGS_CAT, LSTRING(SubCategory_AdvRhythms)],
[0,3600,60,0],
true
] call CBA_Settings_fnc_init;

ADDON = true;
3 changes: 3 additions & 0 deletions addons/circulation/functions/fnc_fullHealLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ _patient setVariable [VAR_BLOODPRESSURE_CHANGE, nil, true];
_patient setVariable [QGVAR(isPerformingCPR), false, true];
_patient setVariable [QGVAR(OxygenationPeriod), 0, true];

_patient setVariable [QGVAR(ht), [], true];
_patient setVariable [QGVAR(effusion), 0, true];

[_patient] call FUNC(updateInternalBleeding);
8 changes: 8 additions & 0 deletions addons/circulation/functions/fnc_handleCardiacArrest.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ if (_initial) then {
};
};

if ((count(_unit getVariable [QGVAR(ht), []])) != 0) then {
_cardiacArrestType = 2;
};

_unit setVariable [QGVAR(cardiacArrestType), _cardiacArrestType, true];
} else {
_cardiacArrestType = _unit getVariable [QGVAR(cardiacArrestType), 0];
Expand Down Expand Up @@ -89,6 +93,8 @@ if (GVAR(AdvRhythm_canDeteriorate)) then {
{
params ["_unit"];

if (!((count(_unit getVariable [QGVAR(ht), []])) == 0)) exitWith {};

if (_unit getVariable [QACEGVAR(medical,CPR_provider), objNull] isEqualTo objNull) then { // Don't deteriorate during CPR
// chance to deteriorate straight into asystole (PEA)
if (GVAR(AdvRhythm_Hardcore_Enable) && {floor (random 100) < GVAR(AdvRhythm_hardcoreDeteriorationChance) && {_unit getVariable [QGVAR(cardiacArrestType), 0] isEqualTo 4}}) then {
Expand Down Expand Up @@ -126,6 +132,8 @@ if (GVAR(AdvRhythm_canDeteriorate)) then {
{
params ["_unit"];

if (!((count(_unit getVariable [QGVAR(ht), []])) == 0)) exitWith {};

if (_unit getVariable [QACEGVAR(medical,CPR_provider), objNull] isEqualTo objNull) then { // Don't deteriorate during CPR
if (_unit getVariable [QGVAR(cardiacArrestType), 0] isEqualTo 3) then {// if VF skip PEA
_unit setVariable [QGVAR(cardiacArrestType), 1, true];
Expand Down
6 changes: 4 additions & 2 deletions addons/circulation/functions/fnc_init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* Public: No
*/

params ["_unit"];
params ["_unit", ["_isRespawn", true]];

_unit setVariable [QGVAR(cprCount), 2, true];
if (!local _unit) exitWith {};

[_unit] call FUNC(fullHealLocal);
9 changes: 9 additions & 0 deletions addons/circulation/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2858,5 +2858,14 @@
<Finnish>Verenvuoto sydämenpysähdyksen aikana</Finnish>
<Russian>Частота кровотечений после остановки сердца</Russian>
</Key>
<Key ID="STR_KAT_Circulation_SETTING_tamponadeChance">
<English>Chance for tamponade in penetrating wounds</English>
</Key>
<Key ID="STR_KAT_Circulation_SETTING_tamponadeInterval">
<English>Tamponade progression timer</English>
</Key>
<Key ID="STR_KAT_Circulation_SETTING_tamponadeChance_deterioration">
<English>Tamponade progression chance</English>
</Key>
</Package>
</Project>
6 changes: 6 additions & 0 deletions addons/gui/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ class CfgFunctions {
class updateCategories {
file = QPATHTOF(functions\fnc_updateCategories.sqf);
};
class updateInjuryList {
file = QPATHTOF(functions\fnc_updateInjuryList.sqf);
};
class updateBodyImage {
file = QPATHTOF(functions\fnc_updateBodyImage.sqf);
};
};
};
};
2 changes: 2 additions & 0 deletions addons/gui/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ PREP(logListAppended);
PREP(onMenuClose);
PREP(onMenuOpen);
PREP(updateCategories);
PREP(updateInjuryList);
PREP(updateBodyImage);
2 changes: 1 addition & 1 deletion addons/gui/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include "script_component.hpp"

#include "XEH_PREP.hpp"
#include "XEH_PREP.hpp"
4 changes: 2 additions & 2 deletions addons/gui/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class CfgPatches {
"ace_dogtags",
"cba_settings"
};
author = "2LT.Mazinski";
authors[] = {"2LT.Mazinski"};
author = "Mazinski";
authors[] = {"Mazinski"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
Expand Down
Loading

0 comments on commit e640048

Please sign in to comment.