Skip to content

Commit

Permalink
Airway/Breathing/Circulation/Surgery/Misc - Various fixes (#444)
Browse files Browse the repository at this point in the history
**When merged this pull request will:**
- Fix hardcore deterioration not working as intended
- Fix continuous actions cancelling if patient instantly died
- Fix IFAK not consuming contents properly
- Add hints when continuous actions have started
- Fix surgery option not working as intended
- Fix continuous actions cancelling when in vehicles
- Reword pneumothorax setting description
- Fix while loop in gasAI function causing server stutter

### 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
BlueTheKing and MiszczuZPolski authored Dec 1, 2023
1 parent 7e405a7 commit 79d0760
Show file tree
Hide file tree
Showing 16 changed files with 87 additions and 84 deletions.
9 changes: 8 additions & 1 deletion addons/airway/functions/fnc_startHeadTurning.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,18 @@ GVAR(headTurn_timeOut) = true;
params ["_medic", "_patient", "_notInVehicle"];

[LLSTRING(headTurning_stop), "", ""] call ACEFUNC(interaction,showMouseHint);
[LLSTRING(headTurning_start), 1.5, _medic] call ACEFUNC(common,displayTextStructured);

[{
params ["_args", "_idPFH"];
_args params ["_medic", "_patient", "_notInVehicle"];

if (!(alive _medic) || IS_UNCONSCIOUS(_medic) || !(IS_UNCONSCIOUS(_patient)) || !(_patient getVariable [QGVAR(headTurningActive), false]) || dialog || {!(objectParent _medic isEqualTo objectParent _patient) || {_patient distance2D _medic > ACEGVAR(medical_gui,maxDistance)}}) exitWith {
private _patientCondition = (!(IS_UNCONSCIOUS(_patient)) && alive _patient || _patient isEqualTo objNull);
private _medicCondition = (!(alive _medic) || IS_UNCONSCIOUS(_medic) || _medic isEqualTo objNull);
private _vehicleCondition = !(objectParent _medic isEqualTo objectParent _patient);
private _distanceCondition = (_patient distance2D _medic > ACEGVAR(medical_gui,maxDistance));

if (_patientCondition || _medicCondition || !(_patient getVariable [QGVAR(headTurningActive), false]) || dialog || {(!_notInVehicle && _vehicleCondition) || {(_notInVehicle && _distanceCondition)}}) exitWith {
[_idPFH] call CBA_fnc_removePerFrameHandler;

[] call ACEFUNC(interaction,hideMouseHint);
Expand Down
3 changes: 3 additions & 0 deletions addons/airway/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@
<Portuguese>Rotação de cabeça cancelada</Portuguese>
<Spanish>Giro de cabeza cancelado</Spanish>
</Key>
<Key ID="STR_KAT_Airway_headTurning_start">
<English>Head Turning Started</English>
</Key>
<Key ID="STR_KAT_Airway_headTurning_stop">
<English>Stop head turning</English>
<Japanese>頭を回すのを止める</Japanese>
Expand Down
29 changes: 18 additions & 11 deletions addons/breathing/functions/fnc_useBVM.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,31 @@ if (dialog) then { // If another dialog is open (medical menu) close it

private _notInVehicle = isNull objectParent _medic;
totalProvided = 1;
loopBVM = false;
GVAR(BVM_loop) = false;

if (_notInVehicle) then {
[_medic, "AinvPknlMstpSnonWnonDnon_AinvPknlMstpSnonWnonDnon_medic", 1] call ACEFUNC(common,doAnimation);
loopBVM = true;
GVAR(BVM_loop) = true;
};

timeOut = true;
GVAR(BVM_timeOut) = true;

[{
params ["_medic", "_patient", "_pocket", "_useOxygen", "_oxygenOrigin", "_notInVehicle"];

[LLSTRING(UseBVM_PutAway), "", ""] call ACEFUNC(interaction,showMouseHint);
[LLSTRING(UseBVM_Start), 1.5, _medic] call ACEFUNC(common,displayTextStructured);

[{
params ["_args", "_idPFH"];
_args params ["_medic", "_patient", "_pocket", "_useOxygen", "_oxygenOrigin", "_notInVehicle"];

if (!(alive _medic) || IS_UNCONSCIOUS(_medic) || !(IS_UNCONSCIOUS(_patient)) || !(_patient getVariable [QGVAR(BVMInUse), false]) || dialog || {!(objectParent _medic isEqualTo objectParent _patient) || {_patient distance2D _medic > ACEGVAR(medical_gui,maxDistance)}}) exitWith {
private _patientCondition = (!(IS_UNCONSCIOUS(_patient)) && alive _patient || _patient isEqualTo objNull);
private _medicCondition = (!(alive _medic) || IS_UNCONSCIOUS(_medic) || _medic isEqualTo objNull);
private _vehicleCondition = !(objectParent _medic isEqualTo objectParent _patient);
private _distanceCondition = (_patient distance2D _medic > ACEGVAR(medical_gui,maxDistance));

if (_patientCondition || _medicCondition || !(_patient getVariable [QGVAR(BVMInUse), false]) || dialog || {(!_notInVehicle && _vehicleCondition) || {(_notInVehicle && _distanceCondition)}}) exitWith {
[_idPFH] call CBA_fnc_removePerFrameHandler;

_patient setVariable [QGVAR(BVMInUse), false, true];
Expand Down Expand Up @@ -94,8 +101,8 @@ timeOut = true;
[LLSTRING(UseBVM_Cancelled), 1.5, _medic] call ACEFUNC(common,displayTextStructured);
};

if !(timeOut) then {
timeOut = true;
if !(GVAR(BVM_timeOut)) then {
GVAR(BVM_timeOut) = true;

if (_useOxygen && !_pocket) then {
switch (_oxygenOrigin) do {
Expand Down Expand Up @@ -183,23 +190,23 @@ timeOut = true;
!(_patient getVariable [QGVAR(BVMInUse), false]);
}, {}, [_patient], 5,
{
timeOut = false;
GVAR(BVM_timeOut) = false;
totalProvided = totalProvided + 1;
}] call CBA_fnc_waitUntilAndExecute;
};

if (loopBVM) then {
if (GVAR(BVM_loop)) then {
[QACEGVAR(common,switchMove), [_medic, "kat_BVM"]] call CBA_fnc_globalEvent;
loopBVM = false;
GVAR(BVM_loop) = false;

[{
params ["_patient"];
!(_patient getVariable [QGVAR(BVMInUse), false]);
}, {}, [_patient], 9, {
loopBVM = true;
GVAR(BVM_loop) = true;
}] call CBA_fnc_waitUntilAndExecute;
};
}, 0, [_medic, _patient, _pocket, _useOxygen, _oxygenOrigin, _notInVehicle]] call CBA_fnc_addPerFrameHandler;

[{timeOut = false;}, [], 1] call CBA_fnc_waitAndExecute;
[{GVAR(BVM_timeOut) = false;}, [], 1] call CBA_fnc_waitAndExecute;
}, [_medic, _patient, _pocket, _useOxygen, _oxygenOrigin, _notInVehicle], 2] call CBA_fnc_waitAndExecute;
46 changes: 4 additions & 42 deletions addons/breathing/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -604,20 +604,7 @@
<Portuguese>Probabilidade de pneumotórax avançado</Portuguese>
</Key>
<Key ID="STR_KAT_Breathing_DESCRIPTION_ADVANCED_PTX_CHANCE_OPTION">
<English>The percentage chance that a patient will suffer from a hemopneumotorax or tension pneumothorax after they are treated for a pneumothorax. Treatment requires the draining of fluids with the use of an AAT Kit.</English>
<Polish>Procentowa szansa, że pacjent będzie cierpieć na krwiaka opłucnej lub odmę prężną w tym samym czasie, gdy cierpi na odmę opłucnową. Zabieg wymaga drenażu opłucnej za pomocą zestawu AAT.</Polish>
<Spanish>La probabilidad de que un paciente sufra un hemotórax/neumotórax a tensión al mismo tiempo que padece un neumotórax. El tratamiento requiere el uso de un kit AAT.</Spanish>
<Chinese>患者患氣胸的同時患上血胸的機會百分比。 處理需要使用AAT套件排出流體。</Chinese>
<Chinesesimp>患者在接受气胸治疗后是否有能患血气胸或张力性气胸,需要使用AAT Kit排出胸腔液体</Chinesesimp>
<Czech>Procentní šance, že pacient bude trpět hemotoraxem současně s pneumotoraxem. Léčba vyžaduje odsátí tekutin pomocí sady AAT.</Czech>
<Korean>환자가 혈기흉을 앓을 확률입니다. 치료에는 AAT 키트를 사용하여 체액을 배출해야합니다.</Korean>
<French>Le pourcentage de chance qu'un patient souffre d'un hémopneumothorax ou un pneumothorax sous tension en même temps qu'un pneumothorax. Le traitement necessitera d'évacuer les fluides en utilisant un kit AAT</French>
<Turkish>Bir hastanın pnömotoraks tedavisi gördükten sonra hemotoraks veya tansiyon pnömotorakstan muzdarip olma şansı yüzdesi. Tedavi, sıvıların bir AAT Kiti kullanılarak boşaltılmasını gerektirir.</Turkish>
<Italian>La probabilità percentuale che un paziente soffra di un emopneumotorace o pneumotorace iperteso in seguito al trattamento di uno pneumotorace. Il trattamento richiede un drenaggio con l'AAT Kit.</Italian>
<Russian>Процентная вероятность того, что пациент будет страдать гемопневмотораксом или напряженным пневмотораксом после лечения пневмоторакса. Лечение требует дренирования жидкости с использованием набора ААТ.</Russian>
<Japanese>気胸の治療を受けた後、患者が血気胸または緊張性気胸に苦しむ可能性の割合。治療には、AATキットを使用して体液を排出する必要があります。</Japanese>
<Portuguese>A porcentagem de chance de um paciente sofrer de um pneumotórax avançado após a falta de tratamento de um pneumotórax simples. O tratamento requer a drenagem de fluidos com o uso do kit AAT.</Portuguese>
<German>Die prozentuale Wahrscheinlichkeit, dass ein Patient an einem Hämopneumotorax oder Spannungspneumothorax leidet, nachdem er wegen eines Pneumothorax behandelt wurde. Die Behandlung erfordert das Ablassen von Flüssigkeiten unter Verwendung eines AAT-Kits.</German>
<English>The percentage chance that determines whether a fully deteriorated pneumothorax will deteriorate into an advanced pneumothorax, this is rolled continuously as set in pneumothorax deterioration interval.</English>
</Key>
<Key ID="STR_KAT_Breathing_HEMOPNEUMOTHORAX_TREATMENT_LEVEL">
<English>Hemothorax / Tension Pnuemothorax Treament Minimum Level</English>
Expand Down Expand Up @@ -1130,34 +1117,6 @@
<Spanish>Valor SpO2 de Cianosis severa - Predeterminado en 66 SpO2 \nEste valor deberia de ser un poco mas alto que el valor letal de SpO2</Spanish>
<Portuguese>Valor de SpO2 para cianose grave (padrão 66)\nDeve estar um pouco acima do valor letal de SpO2</Portuguese>
</Key>
<Key ID="STR_KAT_Breathing_CYANOSIS_TREATMENT_LEVEL">
<English>Check Cyanosis Minimum Level</English>
<German>Zyanose prüfen Trainingslevel</German>
<Polish>Minimalny poziom wyszkolenia do sprawdzenia sinicy</Polish>
<Japanese>チアノーゼの確認の許可</Japanese>
<Chinesesimp>允许检查面色所需的医疗培训水平</Chinesesimp>
<Korean>치아노제 증상 확인 최소 수준</Korean>
<French>Niveau médical minimum pour contrôler la cyanose</French>
<Turkish>Siyanoz minimum düzeyini kontrol edin</Turkish>
<Czech>Minimální úroveň ke zkontrolování cyanózy</Czech>
<Italian>Controlla livello minimo di cianosi</Italian>
<Spanish>Nivel médico minimo requerido para analizar la cianosis</Spanish>
<Portuguese>Nível médico mínimo requerido para verificação de cianose</Portuguese>
</Key>
<Key ID="STR_KAT_Breathing_CYANOSIS_TREATMENT_LEVEL_DESCRIPTION">
<English>The minimum medical level required for someone to be able to check cyanosis.</English>
<German>Benötigter medizinischer Grad, um eine Zyanose feststellen </German>
<Polish>Minimalny poziom wyszkolenia medycznego wymagany, aby ktoś był w stanie sprawdzić sinicę.</Polish>
<Japanese>チアノーゼの確認の使用に訓練レベルを必要とさせます。</Japanese>
<Chinesesimp>允许检查面色所需的医疗培训水平</Chinesesimp>
<Korean>치아노제 증상을 확인할 수 있는 사람의 최소 의료레벨 수준입니다.</Korean>
<French>Le niveau médical minimum nécessaire pour pouvoir contrôler la cyanose</French>
<Turkish>Bir kişinin Siyanozu kontrol edebilmesi için gereken minimum tıbbi seviye.</Turkish>
<Italian>Il livello minimo richiesto per poter diagnosticare la cianosi</Italian>
<Czech>Minimální úroveň zdravotnického výcviku potřebná k tomu, aby někdo mohl zkontrolovat cyanózu</Czech>
<Spanish>Nivel médico minimo requerido para que alguien pueda analizar la cianosis</Spanish>
<Portuguese>O nível médico mínimo requerido para que alguém verifique a cianose</Portuguese>
</Key>
<Key ID="STR_KAT_Breathing_SETTING_deterioratingPneumothorax_chance">
<English>Pneumothorax deterioration chance</English>
<Italian>Possibilità di deterioramento del pneumotorace</Italian>
Expand Down Expand Up @@ -1366,6 +1325,9 @@
<Italian>Usa maschera ambu</Italian>
<Portuguese>Usar BVM</Portuguese>
</Key>
<Key ID="STR_KAT_Breathing_UseBVM_Start">
<English>Rescue Breaths Started</English>
</Key>
<Key ID="STR_KAT_Breathing_UseBVM_PutAway">
<English>Put away BVM</English>
<Japanese>BVMを取り外す</Japanese>
Expand Down
6 changes: 3 additions & 3 deletions addons/chemical/functions/fnc_gasAI.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ if (!isDamageAllowed _unit) exitWith {
[_logic,_unit]
] call CBA_fnc_addPerFrameHandler;

private _skill = _unit skill "aimingAccuracy";
[
{
params["_args","_handler"];
Expand All @@ -51,11 +50,12 @@ private _skill = _unit skill "aimingAccuracy";

if ((_unit distance _pos) <= _radius_max && !(_unit getVariable [QGVAR(enteredPoison), false])) then {
_unit setVariable [QGVAR(enteredPoison), true, true];
private _skill = _unit skill "aimingAccuracy";
private _fnc_afterwait = {
params ["_unit", "_gastype", "_pos", "_skill"];
if !((goggles _unit) in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) exitwith {
if (_gastype isEqualTo "CS") then {
while {_unit distance _pos < 10 && _unit getVariable [QGVAR(enteredPoison), false]} do {
if {_unit distance _pos < 10 && _unit getVariable [QGVAR(enteredPoison), false]} do {
_unit say3D QGVAR(cough_1);
_unit setskill ["aimingAccuracy", 0.001];
[
Expand All @@ -64,7 +64,7 @@ private _skill = _unit skill "aimingAccuracy";
_unit setskill ["aimingAccuracy", _skill];
},
[_unit, _skill],
2
30
] call CBA_fnc_waitAndExecute;
};
} else {
Expand Down
10 changes: 8 additions & 2 deletions addons/circulation/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ GVAR(AEDX_MonitorTarget) = objNull;
params ["_unit", "_patient"];

if (ACEGVAR(medical_gui,target) isEqualTo _patient) then {
[_unit, 0.4] call ACEFUNC(medical_status,adjustPainLevel);
[_unit, 0.3] call ACEFUNC(medical_status,adjustPainLevel);
};
//TODO add sound effect
}] call CBA_fnc_addEventHandler;

[QGVAR(incorrectAEDUsage), {
params ["_unit"];

[QACEGVAR(medical,FatalVitals), _unit] call CBA_fnc_localEvent;
_unit setVariable [QGVAR(cardiacArrestType), 1, true];
}] call CBA_fnc_addEventHandler;
14 changes: 12 additions & 2 deletions addons/circulation/functions/fnc_AED_Shock.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ _bystanders = _bystanders - [_medic];
[QGVAR(handleNearToAED), [_x, _patient], _x] call CBA_fnc_targetEvent;
} forEach _bystanders;

if (_patient getVariable [QACEGVAR(medical,CPR_provider), objNull] != objNull) then {
[(_patient getVariable QACEGVAR(medical,CPR_provider)), 0.4] call ACEFUNC(medical_status,adjustPainLevel);
};

_patient setVariable [QGVAR(heartRestart), true, true];
_patient setVariable [QGVAR(RhythmAnalyzed), false, true];

Expand All @@ -43,6 +47,12 @@ _patient setVariable [QGVAR(RhythmAnalyzed), false, true];

_patient setVariable [QGVAR(Defibrillator_ShockAmount), (_patient getVariable [QGVAR(Defibrillator_ShockAmount), 0]) + 1, true];

if (alive _patient && {_patient getVariable [QACEGVAR(medical,inCardiacArrest), false]}) then {
[QACEGVAR(medical_treatment,cprLocal), [_medic, _patient, _defibType], _patient] call CBA_fnc_targetEvent;
if (alive _patient) then {
if (_patient getVariable [VAR_CRDC_ARRST, false]) then {
[QACEGVAR(medical_treatment,cprLocal), [_medic, _patient, _defibType], _patient] call CBA_fnc_targetEvent;
} else {
if (GVAR(AdvRhythm) && GVAR(AdvRhythm_Hardcore_Enable)) then {
[QGVAR(incorrectAEDUsage), _patient, _patient] call CBA_fnc_targetEvent;
};
};
};
9 changes: 8 additions & 1 deletion addons/circulation/functions/fnc_CPRStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,20 @@ if (_notInVehicle) then {

[{
params ["_medic", "_patient", "_notInVehicle", "_CPRStartTime"];

[LLSTRING(StopCPR), "", ""] call ACEFUNC(interaction,showMouseHint);
[LLSTRING(StartCPR), 1.5, _medic] call ACEFUNC(common,displayTextStructured);

[{
params ["_args", "_idPFH"];
_args params ["_medic", "_patient", "_notInVehicle", "_CPRStartTime"];

if (_patient isEqualTo objNull || _medic isEqualTo objNull || !(alive _medic) || IS_UNCONSCIOUS(_medic) || !(IS_UNCONSCIOUS(_patient)) || (_patient getVariable [QACEGVAR(medical,CPR_provider), objNull]) isEqualTo objNull || !(_medic getVariable [QGVAR(isPerformingCPR), false]) || dialog || {!(objectParent _medic isEqualTo objectParent _patient) || {_patient distance _medic > ACEGVAR(medical_gui,maxDistance)}}) exitWith { // Stop CPR
private _patientCondition = (!(IS_UNCONSCIOUS(_patient)) && alive _patient || _patient isEqualTo objNull);
private _medicCondition = (!(alive _medic) || IS_UNCONSCIOUS(_medic) || _medic isEqualTo objNull);
private _vehicleCondition = !(objectParent _medic isEqualTo objectParent _patient);
private _distanceCondition = (_patient distance2D _medic > ACEGVAR(medical_gui,maxDistance));

if (_patientCondition || _medicCondition || (_patient getVariable [QACEGVAR(medical,CPR_provider), objNull]) isEqualTo objNull || !(_medic getVariable [QGVAR(isPerformingCPR), false]) || dialog || {(!_notInVehicle && _vehicleCondition) || {(_notInVehicle && _distanceCondition)}}) exitWith { // Stop CPR
[_idPFH] call CBA_fnc_removePerFrameHandler;

_medic setVariable [QGVAR(isPerformingCPR), false, true];
Expand Down
9 changes: 2 additions & 7 deletions addons/circulation/functions/fnc_cprLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,8 @@ if (_reviveObject in ["AED", "AEDX"]) exitWith {
};
_patient setVariable [QGVAR(cprCount), 2, true];
} else {
if (GVAR(AdvRhythm_Hardcore_Enable) && _patientState < 3) then {
if (floor (random 100) < GVAR(AdvRhythm_PEAChance)) then {
_patient setVariable [QGVAR(cardiacArrestType), 2, true];
[_patient, nil, false] call FUNC(handleCardiacArrest);
} else {
_patient setVariable [QGVAR(cardiacArrestType), 1, true];
};
if (GVAR(AdvRhythm_Hardcore_Enable) && _patientState == 2) then {
_patient setVariable [QGVAR(cardiacArrestType), 1, true];
};
};
} else {
Expand Down
2 changes: 1 addition & 1 deletion addons/circulation/functions/fnc_handleCardiacArrest.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Public: No
*/

params ["_unit", "_active", ["_initial",true]];
params ["_unit", "_active", ["_initial", true]];

/* type
0 normal
Expand Down
3 changes: 2 additions & 1 deletion addons/circulation/functions/fnc_placeAED.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ params ["_unit", "_AEDClassName"];

_unit removeItem _AEDClassName;

private _AED = ([_AEDClassName,"Item"] joinString "") createVehicle (getPosASL _unit);
private _AED = ([_AEDClassName,"Item"] joinString "") createVehicle (position _unit);

// startCarry
if (stance _unit != "STAND") then {
_AED attachTo [_unit, [0,1.1,1]];
[_unit, _AED] call ACEFUNC(dragging,dropObject_carry);
} else {
_AED attachTo [_unit, [0,0.4,0]];
_unit setVariable [QACEGVAR(dragging,isCarrying), true, true];
[ACEFUNC(dragging,startCarryPFH), 0.2, [_unit, _AED, (CBA_missionTime + 1)]] call CBA_fnc_addPerFrameHandler;
};
Expand Down
3 changes: 3 additions & 0 deletions addons/circulation/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2032,6 +2032,9 @@
<Portuguese>Interromper RCP</Portuguese>
<Spanish>RCP parado</Spanish>
</Key>
<Key ID="STR_KAT_Circulation_StartCPR">
<English>CPR Started</English>
</Key>
<Key ID="STR_KAT_Circulation_CancelCPR">
<English>CPR Cancelled</English>
<Japanese>CPRを中止しました</Japanese>
Expand Down
Loading

0 comments on commit 79d0760

Please sign in to comment.