From 558142cfd810b2e1f03053e307d09d4ce4ef18d0 Mon Sep 17 00:00:00 2001 From: Blue Date: Thu, 19 Oct 2023 21:16:58 +0200 Subject: [PATCH] Breathing/Circulation - Fix medical menu breaking, fix AED-X behaviour (#419) **When merged this pull request will:** - Fix medical menu breaking if `pneumothoraxAlwaysVisible` is enabled and the patient is suffering from pneumothorax - Closes #420 - Fix AED-X behaviour when `advRhythm` is disabled ### 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> --- .../breathing/functions/fnc_inspectChest.sqf | 12 ++++- addons/chemical/script_component.hpp | 48 ------------------- addons/circulation/XEH_preInit.sqf | 2 + .../fnc_AEDX_ViewMonitor_AnalyzeFeedback.sqf | 2 +- .../circulation/functions/fnc_AED_Analyze.sqf | 4 +- .../functions/fnc_handleCardiacArrest.sqf | 3 +- addons/gui/functions/fnc_updateInjuryList.sqf | 2 +- addons/main/script_version.hpp | 4 +- addons/misc/stringtable.xml | 17 ------- addons/pharma/functions/fnc_init.sqf | 2 +- 10 files changed, 22 insertions(+), 74 deletions(-) diff --git a/addons/breathing/functions/fnc_inspectChest.sqf b/addons/breathing/functions/fnc_inspectChest.sqf index 82e30d24d..ce90a5019 100644 --- a/addons/breathing/functions/fnc_inspectChest.sqf +++ b/addons/breathing/functions/fnc_inspectChest.sqf @@ -53,8 +53,13 @@ if (GET_HEART_RATE(_patient) isEqualTo 0) then { }; } else { if (_hasPneumothorax && (_airwaySecure || _airwayClear)) then { - _message = LLSTRING(inspectChest_unevenMovement); - _messageLog = LLSTRING(inspectChest_unevenMovement); + if (_patient getVariable [QGVAR(tensionpneumothorax), false] || _patient getVariable [QGVAR(hemopneumothorax), false]) then { + _message = LLSTRING(inspectChest_none); + _messageLog = LLSTRING(inspectChest_none_log); + } else { + _message = LLSTRING(inspectChest_unevenMovement); + _messageLog = LLSTRING(inspectChest_unevenMovement); + }; if (_simpleSetting) then { _hintSize = 2; _hintWidth = 13; @@ -69,6 +74,9 @@ if (GET_HEART_RATE(_patient) isEqualTo 0) then { _message = _message + "
" + format [LLSTRING(inspectChest_simple), _type]; _messageLog = _messageLog + format [" (%1)", _type_log]; + } else { + _message = format ["%1
%2", _message, LLSTRING(inspectChest_uneven)]; + _messageLog = format ["%1%2", _messageLog, LLSTRING(inspectChest_uneven_log)]; }; } else { if !(_airwayClear) then { diff --git a/addons/chemical/script_component.hpp b/addons/chemical/script_component.hpp index b832e400b..b5dd16eac 100644 --- a/addons/chemical/script_component.hpp +++ b/addons/chemical/script_component.hpp @@ -28,54 +28,6 @@ #define IDC_INJURIES 1410 -#define VAR_WOUND_BLEEDING "ace_medical_woundBleeding" -#define GET_WOUND_BLEEDING(unit) (unit getVariable [VAR_WOUND_BLEEDING, 0]) -#define IS_BLEEDING(unit) (GET_WOUND_BLEEDING(unit) > 0) - - -#define VAR_HEMORRHAGE "ace_medical_hemorrhage" -#define GET_HEMORRHAGE(unit) (unit getVariable [VAR_HEMORRHAGE, 0]) - - -#define DEFAULT_TOURNIQUET_VALUES [0,0,0,0,0,0] -#define VAR_TOURNIQUET "ace_medical_tourniquets" -#define GET_TOURNIQUETS(unit) (unit getVariable [VAR_TOURNIQUET, DEFAULT_TOURNIQUET_VALUES]) -#define HAS_TOURNIQUET_APPLIED_ON(unit,index) ((GET_TOURNIQUETS(unit) select index) > 0) - - -#define DEFAULT_FRACTURE_VALUES [0,0,0,0,0,0] -#define VAR_FRACTURES "ace_medical_fractures" -#define GET_FRACTURES(unit) (unit getVariable [VAR_FRACTURES, DEFAULT_FRACTURE_VALUES]) - - -#define VAR_PAIN "ace_medical_pain" -#define VAR_PAIN_SUPP "ace_medical_painSuppress" -#define GET_PAIN(unit) (unit getVariable [VAR_PAIN, 0]) -#define GET_PAIN_SUPPRESS(unit) (unit getVariable [VAR_PAIN_SUPP, 0]) -#define GET_PAIN_PERCEIVED(unit) (0 max (GET_PAIN(unit) - GET_PAIN_SUPPRESS(unit)) min 1) -#define VAR_IN_PAIN "ace_medical_inPain" - - -#define VAR_OPEN_WOUNDS "ace_medical_openWounds" -#define GET_OPEN_WOUNDS(unit) (unit getVariable [VAR_OPEN_WOUNDS, []]) -#define VAR_BANDAGED_WOUNDS "ace_medical_bandagedWounds" -#define GET_BANDAGED_WOUNDS(unit) (unit getVariable [VAR_BANDAGED_WOUNDS, []]) -#define VAR_STITCHED_WOUNDS "ace_medical_stitchedWounds" -#define GET_STITCHED_WOUNDS(unit) (unit getVariable [VAR_STITCHED_WOUNDS, []]) - -#define DEFAULT_BLOOD_VOLUME 6.0 // in liters -#define DEFAULT_HEART_RATE 80 -#define DEFAULT_PERIPH_RES 100 -#define VAR_MEDICATIONS "ace_medical_medications" -#define VAR_BLOOD_PRESS "ace_medical_bloodPressure" -#define VAR_BLOOD_VOL "ace_medical_bloodVolume" -#define VAR_HEART_RATE "ace_medical_heartRate" -#define VAR_PERIPH_RES "ace_medical_peripheralResistance" - -#define VAR_UNCON "ACE_isUnconscious" -#define IS_UNCONSCIOUS(unit) (unit getVariable [VAR_UNCON, false]) - - #define IDD_MEDICAL_MENU 38580 #define IDC_BODY_GROUP 6000 diff --git a/addons/circulation/XEH_preInit.sqf b/addons/circulation/XEH_preInit.sqf index 8a9122989..763f870b6 100644 --- a/addons/circulation/XEH_preInit.sqf +++ b/addons/circulation/XEH_preInit.sqf @@ -333,6 +333,8 @@ PREP_RECOMPILE_END; LLSTRING(SETTING_AdvRhythm_Enable), [CBA_SETTINGS_CAT, LSTRING(SubCategory_AdvRhythms)], [true], + true, + {}, true ] call CBA_Settings_fnc_init; diff --git a/addons/circulation/functions/fnc_AEDX_ViewMonitor_AnalyzeFeedback.sqf b/addons/circulation/functions/fnc_AEDX_ViewMonitor_AnalyzeFeedback.sqf index 39192557e..f8773c425 100644 --- a/addons/circulation/functions/fnc_AEDX_ViewMonitor_AnalyzeFeedback.sqf +++ b/addons/circulation/functions/fnc_AEDX_ViewMonitor_AnalyzeFeedback.sqf @@ -94,7 +94,7 @@ private _fnc_displayMsg = { { params ["_dlg", "_fnc_displayMsg"]; - if (GVAR(AEDX_MonitorTarget) getVariable [QGVAR(cardiacArrestType), 0] > 2 || (!(GVAR(AdvRhythm)) && GVAR(AEDX_MonitorTarget) getVariable [QACEGVAR(medical,heartRate), 0] isEqualTo 0)) then { + if ((GVAR(AdvRhythm) && GVAR(AEDX_MonitorTarget) getVariable [QGVAR(cardiacArrestType), 0] > 2) || (!(GVAR(AdvRhythm)) && GVAR(AEDX_MonitorTarget) getVariable [QACEGVAR(medical,heartRate), 0] isEqualTo 0)) then { [_dlg, 2] call _fnc_displayMsg; [{ diff --git a/addons/circulation/functions/fnc_AED_Analyze.sqf b/addons/circulation/functions/fnc_AED_Analyze.sqf index 96522acf5..7887a2f05 100644 --- a/addons/circulation/functions/fnc_AED_Analyze.sqf +++ b/addons/circulation/functions/fnc_AED_Analyze.sqf @@ -66,6 +66,7 @@ playsound3D [QPATHTOF_SOUND(sounds\analyzingnow.wav), _soundSource, false, getPo playsound3D [QPATHTOF_SOUND(sounds\shockadvised.wav), _soundSource, false, getPosASL _soundSource, 6, 1, 15]; [{ // If shock advised begin to charge params ["_medic", "_patient", "_defibrillatorType", "_soundSource"]; + [_medic, _patient, _soundSource, _defibrillatorType] call FUNC(AED_Charge); }, [_medic, _patient, _defibrillatorType, _soundSource], 1.7] call CBA_fnc_waitAndExecute; } else { // no shock advised @@ -74,10 +75,11 @@ playsound3D [QPATHTOF_SOUND(sounds\analyzingnow.wav), _soundSource, false, getPo }; } else { // If advanced rhythms are disabled just check if patient is in cardiac arrest if (_patient getVariable [QACEGVAR(medical,heartRate), 0] isEqualTo 0) then { + playsound3D [QPATHTOF_SOUND(sounds\shockadvised.wav), _soundSource, false, getPosASL _soundSource, 6, 1, 15]; [{ // If shock advised begin to charge params ["_medic", "_patient", "_defibrillatorType", "_soundSource"]; - [_medic, _patient, _defibrillatorType, _soundSource] call FUNC(AED_Charge); + [_medic, _patient, _soundSource, _defibrillatorType] call FUNC(AED_Charge); }, [_medic, _patient, _defibrillatorType, _soundSource], 1.7] call CBA_fnc_waitAndExecute; } else { playsound3D [QPATHTOF_SOUND(sounds\noshockadvised.wav), _soundSource, false, getPosASL _soundSource, 6, 1, 15]; diff --git a/addons/circulation/functions/fnc_handleCardiacArrest.sqf b/addons/circulation/functions/fnc_handleCardiacArrest.sqf index 41a9e5c52..a6916466d 100644 --- a/addons/circulation/functions/fnc_handleCardiacArrest.sqf +++ b/addons/circulation/functions/fnc_handleCardiacArrest.sqf @@ -29,7 +29,8 @@ params ["_unit", "_active", ["_initial",true]]; private _cardiacArrestType = 0; -if !(alive _unit) exitWith {}; +if !(GVAR(AdvRhythm)) exitWith {}; +if !(alive _unit) exitWith {_unit setVariable [QGVAR(cardiacArrestType), 1, true];}; if (_initial) then { if !(_active) exitWith {}; diff --git a/addons/gui/functions/fnc_updateInjuryList.sqf b/addons/gui/functions/fnc_updateInjuryList.sqf index 398c460cd..705f2d4ee 100644 --- a/addons/gui/functions/fnc_updateInjuryList.sqf +++ b/addons/gui/functions/fnc_updateInjuryList.sqf @@ -336,7 +336,7 @@ private _fnc_processWounds = { [GET_STITCHED_WOUNDS(_target), "[S] %1", [0.7, 0.7, 0.7, 1]] call _fnc_processWounds; if (_ptxEntry isNotEqualTo []) then { - _woundEntries pushBack _ptxEntry; + _woundEntries append _ptxEntry; }; // Handle no wound entries diff --git a/addons/main/script_version.hpp b/addons/main/script_version.hpp index 05b6c2815..fa5875776 100644 --- a/addons/main/script_version.hpp +++ b/addons/main/script_version.hpp @@ -1,4 +1,4 @@ #define MAJOR 2 #define MINOR 13 -#define PATCH 0 -#define BUILD 35 +#define PATCH 1 +#define BUILD 36 diff --git a/addons/misc/stringtable.xml b/addons/misc/stringtable.xml index 8727bf7cb..8f2beb58e 100644 --- a/addons/misc/stringtable.xml +++ b/addons/misc/stringtable.xml @@ -843,22 +843,5 @@ Arrêt du transport de %1 %1의 운반 취소함 - - Medical - Zdravotní - Médical - Sanitäter - Medico - Medyczne - Médico - Медик - Médico - Orvosi - 治療 - 의료 - 医疗设定 - 醫療設定 - Medikal - diff --git a/addons/pharma/functions/fnc_init.sqf b/addons/pharma/functions/fnc_init.sqf index c572f2a73..73b724640 100644 --- a/addons/pharma/functions/fnc_init.sqf +++ b/addons/pharma/functions/fnc_init.sqf @@ -127,7 +127,7 @@ if (GVAR(coagulation)) then { [_idPFH] call CBA_fnc_removePerFrameHandler; }; - private _openWounds = _unit getVariable [VAR_OPEN_WOUNDS, []]; + private _openWounds = _unit getVariable [VAR_OPEN_WOUNDS, createHashMap]; private _pulse = _unit getVariable [VAR_HEART_RATE, 80]; private _coagulationFactor = _unit getVariable [QGVAR(coagulationFactor), 10];