From 28a1aa4b4f190bf9c00b246246b8528adf3495ad Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Fri, 11 Oct 2024 07:16:48 -0700 Subject: [PATCH 01/57] Initial Commit --- .hemtt/launch.toml | 2 + addons/medical_status/XEH_PREP.hpp | 3 +- .../functions/fnc_addMedicationAdjustment.sqf | 20 ++--- .../functions/fnc_getAllMedicationCount.sqf | 43 +++++++++ .../functions/fnc_getMedicationCount.sqf | 14 +-- .../ACE_Medical_Treatment.hpp | 6 +- .../ACE_Medical_Treatment_Actions.hpp | 4 + addons/medical_treatment/XEH_PREP.hpp | 1 + .../functions/fnc_medicationLocal.sqf | 9 +- .../functions/fnc_onMedicationUsage.sqf | 46 +++------- .../functions/fnc_onOverdose.sqf | 36 ++++++++ addons/medical_treatment/initSettings.inc.sqf | 90 +++++++++++++++++++ addons/medical_treatment/script_component.hpp | 2 +- addons/medical_treatment/stringtable.xml | 60 +++++++++++++ .../functions/fnc_handleUnitVitals.sqf | 2 +- 15 files changed, 281 insertions(+), 57 deletions(-) create mode 100644 addons/medical_status/functions/fnc_getAllMedicationCount.sqf create mode 100644 addons/medical_treatment/functions/fnc_onOverdose.sqf diff --git a/.hemtt/launch.toml b/.hemtt/launch.toml index d0726cbdded..94623dcf996 100644 --- a/.hemtt/launch.toml +++ b/.hemtt/launch.toml @@ -1,6 +1,8 @@ [default] workshop = [ "450814997", # CBA_A3 + "2369477168", # Advanced Developer Tools's Workshop ID + "1779063631", # ZEN ] [spe] diff --git a/addons/medical_status/XEH_PREP.hpp b/addons/medical_status/XEH_PREP.hpp index 77f9712eb17..710c3c35b38 100644 --- a/addons/medical_status/XEH_PREP.hpp +++ b/addons/medical_status/XEH_PREP.hpp @@ -6,6 +6,7 @@ PREP(getBloodPressure); PREP(getBloodVolumeChange); PREP(getCardiacOutput); PREP(getMedicationCount); +PREP(getAllMedicationCount); PREP(handleKilled); PREP(handleKilledMission); PREP(hasStableVitals); @@ -17,4 +18,4 @@ PREP(setCardiacArrestState); PREP(setDead); PREP(setStatusEffects); PREP(setUnconsciousState); -PREP(updateWoundBloodLoss); +PREP(updateWoundBloodLoss); \ No newline at end of file diff --git a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf index 8770eaf0aec..514fd9c85a6 100644 --- a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf +++ b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf @@ -1,27 +1,27 @@ #include "..\script_component.hpp" /* - * Author: BaerMitUmlaut, PabstMirror + * Author: BaerMitUmlaut, PabstMirror modified by Cplhardcore * Adds a medication and it's effects * * Arguments: * 0: The Unit * 1: Medication - * 2: Time in system for the adjustment to reach its peak - * 3: Duration the adjustment will have an effect - * 4: Heart Rate Adjust - * 5: Pain Suppress Adjust - * 6: Flow Adjust + * 3: Time in system for the adjustment to reach its peak + * 4: Duration the adjustment will have an effect + * 5: Heart Rate Adjust + * 6: Pain Suppress Adjust + * 7: Flow Adjust * * Return Value: * None * * Example: - * [player, "Morphine", 120, 60, -10, 0.8, -10] call ace_medical_status_fnc_addMedicationAdjustment + * [player, "Morphine", 1, 120, 60, -10, 0.8, -10] call ace_medical_status_fnc_addMedicationAdjustment * * Public: No */ -params ["_unit", "_medication", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"]; -TRACE_7("addMedicationAdjustment",_unit,_medication,_timeToMaxEffect,_maxTimeInSystem,_hrAdjust,_painAdjust,_flowAdjust); +params ["_unit", "_medication", "_dose", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"]; +TRACE_8("addMedicationAdjustment",_unit,_medication,_dose,_timeToMaxEffect,_maxTimeInSystem,_hrAdjust,_painAdjust,_flowAdjust); if (_maxTimeInSystem <= 0) exitWith { WARNING_1("bad value for _maxTimeInSystem - %1",_this); }; _timeToMaxEffect = _timeToMaxEffect max 1; @@ -29,6 +29,6 @@ _timeToMaxEffect = _timeToMaxEffect max 1; private _adjustments = _unit getVariable [VAR_MEDICATIONS, []]; -_adjustments pushBack [_medication, CBA_missionTime, _timeToMaxEffect, _maxTimeInSystem, _hrAdjust, _painAdjust, _flowAdjust]; +_adjustments pushBack [_medication, CBA_missionTime, _dose, _timeToMaxEffect, _maxTimeInSystem, _hrAdjust, _painAdjust, _flowAdjust]; _unit setVariable [VAR_MEDICATIONS, _adjustments, true]; diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf new file mode 100644 index 00000000000..afaeaf199bc --- /dev/null +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -0,0 +1,43 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror, modified by Cplhardcore + * Gets effective count of all medications in a unit's system + * (each medication dose is scaled from 0..1 based on time till max effect and max time in system) + * + * Arguments: + * 0: The patient + * 1: Get raw count (true) or effect ratio (false) (default: true) + * + * Return Value: + * Dose Count + * Medication effectiveness (float) + * + * Example: + * [player] call ace_medical_status_fnc_getAllMedicationCount + * + * Public: No + */ + +params ["_target", ["_getCount", true]]; + +private _results = []; // Array to store medication info +{ + _x params ["_xMed", "_timeAdded", "_dose", "_timeTillMaxEffect", "_maxTimeInSystem"]; + + private _timeInSystem = CBA_missionTime - _timeAdded; + private _medDose = _dose; + private _medication = _xMed; + private _effectiveness = 0; + + if (_getCount) then { + _effectiveness = linearConversion [_timeTillMaxEffect, _maxTimeInSystem, _timeInSystem, 1, 0, true]; + } else { + _effectiveness = (((_timeInSystem / _timeTillMaxEffect) ^ 2) min 1) * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem; + }; + _results pushBack [_medication, _medDose, _effectiveness]; + +} forEach (_target getVariable [VAR_MEDICATIONS, []]); + +TRACE_4("getMedicationCount",_target,_medication,_getCount,_results); + +_results \ No newline at end of file diff --git a/addons/medical_status/functions/fnc_getMedicationCount.sqf b/addons/medical_status/functions/fnc_getMedicationCount.sqf index e98707c7212..2afe54d6ed0 100644 --- a/addons/medical_status/functions/fnc_getMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getMedicationCount.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author: PabstMirror + * Author: PabstMirror modified by Cplhardcore * Gets effective count of medications in a unit's system * (each medication dose is scaled from 0..1 based on time till max effect and max time in system) * @@ -10,7 +10,8 @@ * 2: Get raw count (true) or effect ratio (false) (default: true) * * Return Value: - * Medication count (float) + * Dose Count + * Medication effectiveness (float) * * Example: * [player, "Epinephrine"] call ace_medical_status_fnc_getMedicationCount @@ -21,10 +22,12 @@ params ["_target", "_medication", ["_getCount", true]]; private _return = 0; +private _medDose = 0; { - _x params ["_xMed", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem"]; + _x params ["_xMed", "_timeAdded", "_dose", "_timeTillMaxEffect", "_maxTimeInSystem"]; if (_xMed == _medication) then { private _timeInSystem = CBA_missionTime - _timeAdded; + _medDose = _medDose + _dose; if (_getCount) then { // just return effective count, a medication will always start at 1 and only drop after reaching timeTilMaxEffect _return = _return + linearConversion [_timeTillMaxEffect, _maxTimeInSystem, _timeInSystem, 1, 0, true]; @@ -35,5 +38,6 @@ private _return = 0; }; } forEach (_target getVariable [VAR_MEDICATIONS, []]); -TRACE_4("getMedicationCount",_target,_medication,_getCount,_return); -_return +TRACE_5("getMedicationCount",_target,_medication,_getCount,_return,_medDose); + +[_medDose, _return] diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index 267a45dd445..01b734df122 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -571,7 +571,7 @@ class ADDON { // Example with maxDose = 4 and maxDoseDeviation = 2: Dose 4: Safe | Dose 5 and 6: Possible overdose | Dose 7: Guaranteed overdose maxDoseDeviation = 2; // Function to execute upon overdose. Arguments passed to call back are 0: unit , 1: medicationClassName - onOverDose = ""; + onOverDoseCustom = ""; // The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. For liquids, it corresponds to the informal concept of "thickness". This value will increase/decrease the viscoty of the blood with the percentage given. Where 100 = max. Using the minus will decrease viscosity viscosityChange = 0; @@ -584,6 +584,7 @@ class ADDON { timeInSystem = 1800; timeTillMaxEffect = 30; maxDose = 4; + dose = 1; incompatibleMedication[] = {}; viscosityChange = -10; }; @@ -595,6 +596,7 @@ class ADDON { timeInSystem = 120; timeTillMaxEffect = 10; maxDose = 9; + dose = 1; incompatibleMedication[] = {}; }; class Adenosine { @@ -605,6 +607,7 @@ class ADDON { timeInSystem = 120; timeTillMaxEffect = 15; maxDose = 5; + dose = 1; incompatibleMedication[] = {}; }; class PainKillers { @@ -615,6 +618,7 @@ class ADDON { timeInSystem = 420; timeTillMaxEffect = 60; maxDose = 5; + dose = 1; incompatibleMedication[] = {}; viscosityChange = 5; }; diff --git a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp index 4058132e3db..b9d376b60e4 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp @@ -114,10 +114,12 @@ class GVAR(actions) { class Morphine: FieldDressing { displayName = CSTRING(Inject_Morphine); displayNameProgress = CSTRING(Injecting_Morphine); + medicRequired = QGVAR(medicMorphine); icon = QPATHTOEF(medical_gui,ui\auto_injector.paa); allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"}; category = "medication"; items[] = {"ACE_morphine"}; + treatmentLocations = QGVAR(locationMorphine); condition = ""; treatmentTime = QGVAR(treatmentTimeAutoinjector); callbackSuccess = QFUNC(medication); @@ -128,8 +130,10 @@ class GVAR(actions) { class Adenosine: Morphine { displayName = CSTRING(Inject_Adenosine); displayNameProgress = CSTRING(Injecting_Adenosine); + medicRequired = QGVAR(medicAdenosine); condition = QGVAR(advancedMedication); items[] = {"ACE_adenosine"}; + treatmentLocations = QGVAR(locationAdenosine); litter[] = {{"ACE_MedicalLitter_adenosine"}}; }; class Epinephrine: Morphine { diff --git a/addons/medical_treatment/XEH_PREP.hpp b/addons/medical_treatment/XEH_PREP.hpp index 709c97952f4..0dd30bb31fb 100644 --- a/addons/medical_treatment/XEH_PREP.hpp +++ b/addons/medical_treatment/XEH_PREP.hpp @@ -67,3 +67,4 @@ PREP(treatmentFailure); PREP(treatmentSuccess); PREP(unloadUnit); PREP(useItem); +PREP(onOverdose); diff --git a/addons/medical_treatment/functions/fnc_medicationLocal.sqf b/addons/medical_treatment/functions/fnc_medicationLocal.sqf index 18ef4e4d680..52e08134b31 100644 --- a/addons/medical_treatment/functions/fnc_medicationLocal.sqf +++ b/addons/medical_treatment/functions/fnc_medicationLocal.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author: Glowbal, mharis001 + * Author: Glowbal, mharis001, modified by Cplhardcore * Local callback for administering medication to a patient. * * Arguments: @@ -65,8 +65,7 @@ private _medicationConfig = _defaultConfig >> _classname; private _painReduce = GET_NUMBER(_medicationConfig >> "painReduce",getNumber (_defaultConfig >> "painReduce")); private _timeInSystem = GET_NUMBER(_medicationConfig >> "timeInSystem",getNumber (_defaultConfig >> "timeInSystem")); private _timeTillMaxEffect = GET_NUMBER(_medicationConfig >> "timeTillMaxEffect",getNumber (_defaultConfig >> "timeTillMaxEffect")); -private _maxDose = GET_NUMBER(_medicationConfig >> "maxDose",getNumber (_defaultConfig >> "maxDose")); -private _maxDoseDeviation = GET_NUMBER(_medicationConfig >> "maxDoseDeviation",getNumber (_defaultConfig >> "maxDoseDeviation")); +private _dose = GET_NUMBER(_medicationConfig >> "dose",getNumber (_defaultConfig >> "dose")); private _viscosityChange = GET_NUMBER(_medicationConfig >> "viscosityChange",getNumber (_defaultConfig >> "viscosityChange")); private _hrIncreaseLow = GET_ARRAY(_medicationConfig >> "hrIncreaseLow",getArray (_defaultConfig >> "hrIncreaseLow")); private _hrIncreaseNormal = GET_ARRAY(_medicationConfig >> "hrIncreaseNormal",getArray (_defaultConfig >> "hrIncreaseNormal")); @@ -80,7 +79,7 @@ private _heartRateChange = _minIncrease + random (_maxIncrease - _minIncrease); // Adjust the medication effects and add the medication to the list TRACE_3("adjustments",_heartRateChange,_painReduce,_viscosityChange); -[_patient, _className, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange] call EFUNC(medical_status,addMedicationAdjustment); +[_patient, _className, _dose, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange] call EFUNC(medical_status,addMedicationAdjustment); // Check for medication compatiblity -[_patient, _className, _maxDose, _maxDoseDeviation, _incompatibleMedication] call FUNC(onMedicationUsage); +[_patient, _className, _incompatibleMedication] call FUNC(onMedicationUsage); diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index cd26d154242..fb58e4069e5 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -1,32 +1,32 @@ #include "..\script_component.hpp" /* - * Author: Glowbal + * Author: Glowbal, modified by Cplhardcore * Handles the medication given to a patient. * * Arguments: * 0: The patient * 1: Medication Treatment classname - * 2: Max dose (0 to ignore) - * 3: Max dose deviation - * 3: Incompatable medication > + * 2: Incompatable medication > * * Return Value: * None * * Example: - * [player, "morphine", 4, 2, [["x", 1]]] call ace_medical_treatment_fnc_onMedicationUsage + * [player, "morphine", [["x", 1]]] call ace_medical_treatment_fnc_onMedicationUsage * * Public: No */ -params ["_target", "_className", "_maxDose", "_maxDoseDeviation", "_incompatibleMedication"]; -TRACE_5("onMedicationUsage",_target,_className,_maxDose,_maxDoseDeviation,_incompatibleMedication); - -private _overdosedMedications = []; +params ["_target", "_className", "_incompatibleMedication"]; +TRACE_3("onMedicationUsage",_target,_className,_incompatibleMedication); // Check for overdose from current medication +private _defaultConfig = configFile >> QUOTE(ADDON) >> "Medication"; +private _medicationConfig = _defaultConfig >> _classname; +private _maxDose = GET_NUMBER(_medicationConfig >> "maxDose",getNumber (_defaultConfig >> "maxDose")); +private _maxDoseDeviation = GET_NUMBER(_medicationConfig >> "maxDoseDeviation",getNumber (_defaultConfig >> "maxDoseDeviation")); if (_maxDose > 0) then { - private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount); + private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount) select 1; // Because both {floor random 0} and {floor random 1} return 0 if (_maxDoseDeviation > 0) then { _maxDoseDeviation = _maxDoseDeviation + 1; @@ -34,7 +34,7 @@ if (_maxDose > 0) then { if (_currentDose > _maxDose + (floor random _maxDoseDeviation)) then { TRACE_1("exceeded max dose",_currentDose); - _overdosedMedications pushBackUnique _className; + [_target, _classname] call FUNC(onOverdose); }; }; @@ -43,26 +43,6 @@ if (_maxDose > 0) then { _x params ["_xMed", "_xLimit"]; private _inSystem = [_target, _xMed] call EFUNC(medical_status,getMedicationCount); if (_inSystem> _xLimit) then { - _overdosedMedications pushBackUnique _xMed; - }; -} forEach _incompatibleMedication; - -if (_overdosedMedications isNotEqualTo []) then { - private _medicationConfig = (configFile >> "ace_medical_treatment" >> "Medication"); - private _onOverDose = getText (_medicationConfig >> "onOverDose"); - if (isClass (_medicationConfig >> _className)) then { - _medicationConfig = (_medicationConfig >> _className); - if (isText (_medicationConfig >> "onOverDose")) then { _onOverDose = getText (_medicationConfig >> "onOverDose"); }; + [_target, _classname] call FUNC(onOverdose); }; - TRACE_2("overdose",_overdosedMedications,_onOverDose); - if (_onOverDose == "") exitWith { - TRACE_1("CriticalVitals Event",_target); // make unconscious - [QEGVAR(medical,CriticalVitals), _target] call CBA_fnc_localEvent; - }; - if (isNil _onOverDose) then { - _onOverDose = compile _onOverDose; - } else { - _onOverDose = missionNamespace getVariable _onOverDose; - }; - [_target, _className, _overdosedMedications] call _onOverDose; -}; +} forEach _incompatibleMedication; \ No newline at end of file diff --git a/addons/medical_treatment/functions/fnc_onOverdose.sqf b/addons/medical_treatment/functions/fnc_onOverdose.sqf new file mode 100644 index 00000000000..fa8c39d6a9d --- /dev/null +++ b/addons/medical_treatment/functions/fnc_onOverdose.sqf @@ -0,0 +1,36 @@ +#include "..\script_component.hpp" +/* + * Author: Cplhardcore + * Handles the overdose effects of a medication. + * + * Arguments: + * 0: The patient + * 1: Medication Treatment classname + * 2: Incompatable medication > + * + * Return Value: + * None + * + * Example: + * [player, "morphine"] call ace_medical_treatment_fnc_onOverDose + * Public: No + */ + + params ["_unit", "_classname"]; + +private _medicationConfig = (configFile >> "ace_medical_treatment" >> "_classname"); +private _onOverDoseCustom = getText (_medicationConfig >> "onOverDoseCustom"); +if (isClass (_medicationConfig >> _className)) then { + _medicationConfig = (_medicationConfig >> _className); + if (isText (_medicationConfig >> "onOverDoseCustom")) then { _onOverDoseCustom = getText (_medicationConfig >> "onOverDoseCustom"); }; +}; +TRACE_2("overdose",_classname,_onOverDoseCustom); +if (_onOverDoseCustom == "") exitWith { + TRACE_1("CriticalVitals Event",_target); // make unconscious + [QEGVAR(medical,CriticalVitals), _target] call CBA_fnc_localEvent; +}; +if (isNil _onOverDoseCustom) then { + _onOverDose = compile _onOverDoseCustom; +} else { + _onOverDoseCustom = missionNamespace getVariable _onOverDoseCustom; +}; \ No newline at end of file diff --git a/addons/medical_treatment/initSettings.inc.sqf b/addons/medical_treatment/initSettings.inc.sqf index 7f0fc06764c..a73ba29aa4e 100644 --- a/addons/medical_treatment/initSettings.inc.sqf +++ b/addons/medical_treatment/initSettings.inc.sqf @@ -154,6 +154,96 @@ true ] call CBA_fnc_addSetting; +[ + QGVAR(EpinephrineDoseLimit), + "SLIDER", + [LSTRING(DoseLimitEpinephrine_DisplayName), LSTRING(DoseLimitEpinephrine_DESC)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [1, 9, 3, 0], + true +] call CBA_fnc_addSetting; + +[ + QGVAR(EpinephrineDoseLimitDeviation), + "SLIDER", + [LSTRING(DoseLimitDeviationEpinephrine_DisplayName), LSTRING(DoseLimitDeviationEpinephrine_DESC)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [0, 3, 1, 0], + true +] call CBA_fnc_addSetting; + +[ + QGVAR(medicMorphine), + "LIST", + [LSTRING(MedicMorphine_DisplayName), LSTRING(MedicMorphine_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1, 2], [LSTRING(Anyone), LSTRING(Medics), LSTRING(Doctors)], 0], + true +] call CBA_fnc_addSetting; + +[ + QGVAR(locationMorphine), + "LIST", + [LSTRING(LocationMorphine_DisplayName), LSTRING(LocationMorphine_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1, 2, 3, 4], [ELSTRING(common,Anywhere), ELSTRING(common,Vehicle), LSTRING(MedicalFacilities), LSTRING(VehiclesAndFacilities), ELSTRING(common,Disabled)], 0], + true +] call CBA_fnc_addSetting; + +[ + QGVAR(MorphineDoseLimit), + "SLIDER", + [LSTRING(DoseLimitMorphine_DisplayName), LSTRING(DoseLimitMorphine_DESC)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [1, 9, 3, 0], + true +] call CBA_fnc_addSetting; + +[ + QGVAR(MorphineDoseLimitDeviation), + "SLIDER", + [LSTRING(DoseLimitDeviationMorphine_DisplayName), LSTRING(DoseLimitDeviationMorphine_DESC)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [0, 3, 1, 0], + true +] call CBA_fnc_addSetting; + +[ + QGVAR(medicAdenosine), + "LIST", + [LSTRING(MedicAdenosine_DisplayName), LSTRING(MedicAdenosine_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1, 2], [LSTRING(Anyone), LSTRING(Medics), LSTRING(Doctors)], 0], + true +] call CBA_fnc_addSetting; + +[ + QGVAR(locationAdenosine), + "LIST", + [LSTRING(LocationAdenosine_DisplayName), LSTRING(LocationAdenosine_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [[0, 1, 2, 3, 4], [ELSTRING(common,Anywhere), ELSTRING(common,Vehicle), LSTRING(MedicalFacilities), LSTRING(VehiclesAndFacilities), ELSTRING(common,Disabled)], 0], + true +] call CBA_fnc_addSetting; + +[ + QGVAR(AdenosineDoseLimit), + "SLIDER", + [LSTRING(DoseLimitAdenosine_DisplayName), LSTRING(DoseLimitAdenosine_DESC)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [1, 9, 3, 0], + true +] call CBA_fnc_addSetting; + +[ + QGVAR(AdenosineDoseLimitDeviation), + "SLIDER", + [LSTRING(DoseLimitDeviationAdenosine_DisplayName), LSTRING(DoseLimitDeviationAdenosine_DESC)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + [0, 3, 1, 0], + true +] call CBA_fnc_addSetting; + [ QGVAR(medicPAK), "LIST", diff --git a/addons/medical_treatment/script_component.hpp b/addons/medical_treatment/script_component.hpp index 6a334ed72a3..9f636b9909e 100644 --- a/addons/medical_treatment/script_component.hpp +++ b/addons/medical_treatment/script_component.hpp @@ -2,7 +2,7 @@ #define COMPONENT_BEAUTIFIED Medical Treatment #include "\z\ace\addons\main\script_mod.hpp" -// #define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index b0d140d8255..0ebf8bac7ab 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -546,6 +546,66 @@ Controla donde puede sr usada la Epinefrina. 에피네프린을 사용할 수 있는 장소를 정합니다. + + Maximum Dose of Epinephrine + + + The maximum Dose of Epinephrine you can give to a player + + + Maximum Dose Deviation of Epinephrine + + + The number of additional doses you may be able to give of Epinephrine, while risking overdose + + + Allow Morphine + + + Training level required to use Morphine. + + + Locations Morphine + + + Controls where Morphine can be used. + + + Maximum Dose of Morphine + + + The maximum Dose of Morphine you can give to a player + + + Maximum Dose Deviation of Morphine + + + The number of additional doses you may be able to give of Morphine, while risking overdose + + + Allow Adenosine + + + Training level required to use Adenosine. + + + Locations Adenosine + + + Controls where Adenosine can be used. + + + Maximum Dose of Adenosine + + + The maximum Dose of Adenosine you can give to a player + + + Maximum Dose Deviation of Adenosine + + + The number of additional doses you may be able to give of Adenosine, while risking overdose + Allow PAK Доступ к Аптечке diff --git a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf index 77aec7fd621..9dc4fb9a1c9 100644 --- a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf @@ -81,7 +81,7 @@ private _adjustments = _unit getVariable [VAR_MEDICATIONS,[]]; if (_adjustments isNotEqualTo []) then { private _deleted = false; { - _x params ["_medication", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"]; + _x params ["_medication", "_dose", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"]; private _timeInSystem = CBA_missionTime - _timeAdded; if (_timeInSystem >= _maxTimeInSystem) then { _deleted = true; From e8551a1415a39dcaabbeb8306359c5eca9c0eee2 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Fri, 11 Oct 2024 07:34:51 -0700 Subject: [PATCH 02/57] Small fix to get all medications --- .../functions/fnc_getAllMedicationCount.sqf | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf index afaeaf199bc..2e23a9ada6b 100644 --- a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -20,24 +20,38 @@ params ["_target", ["_getCount", true]]; -private _results = []; // Array to store medication info +private _medStack = []; // Array to store stacked medication info + { _x params ["_xMed", "_timeAdded", "_dose", "_timeTillMaxEffect", "_maxTimeInSystem"]; private _timeInSystem = CBA_missionTime - _timeAdded; - private _medDose = _dose; - private _medication = _xMed; - private _effectiveness = 0; - + private _effectiveness = 0; + if (_getCount) then { _effectiveness = linearConversion [_timeTillMaxEffect, _maxTimeInSystem, _timeInSystem, 1, 0, true]; } else { _effectiveness = (((_timeInSystem / _timeTillMaxEffect) ^ 2) min 1) * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem; }; - _results pushBack [_medication, _medDose, _effectiveness]; + + private _found = false; + { + _x params ["_existingMed", "_totalDose", "_totalEffectiveness"]; + + if (_existingMed isEqualTo _xMed) then { + _found = true; + _medStack set [_forEachIndex, [_existingMed, _totalDose + _dose, _totalEffectiveness + _effectiveness]]; // Stack dose and add effectiveness + true + } else { + false + }; + } forEach _medStack; + if (!_found) then { + _medStack pushBack [_xMed, _dose, _effectiveness]; + }; } forEach (_target getVariable [VAR_MEDICATIONS, []]); -TRACE_4("getMedicationCount",_target,_medication,_getCount,_results); +TRACE_3("getMedicationStack", _target, _medStack, _getCount); -_results \ No newline at end of file +_medStack \ No newline at end of file From d8f078139cd6237dd18e8c67b6f791a796e14c12 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Fri, 11 Oct 2024 07:37:23 -0700 Subject: [PATCH 03/57] Update launch.toml --- .hemtt/launch.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.hemtt/launch.toml b/.hemtt/launch.toml index 94623dcf996..d0726cbdded 100644 --- a/.hemtt/launch.toml +++ b/.hemtt/launch.toml @@ -1,8 +1,6 @@ [default] workshop = [ "450814997", # CBA_A3 - "2369477168", # Advanced Developer Tools's Workshop ID - "1779063631", # ZEN ] [spe] From c3af22315f84fffa1725acdb6bce988901159809 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Fri, 11 Oct 2024 07:39:51 -0700 Subject: [PATCH 04/57] Small fix and removal of medication dose variables --- .../functions/fnc_addMedicationAdjustment.sqf | 1 + addons/medical_treatment/initSettings.inc.sqf | 36 ------------------- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf index 514fd9c85a6..91ac01081cf 100644 --- a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf +++ b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf @@ -6,6 +6,7 @@ * Arguments: * 0: The Unit * 1: Medication + * 2: Dose of medication * 3: Time in system for the adjustment to reach its peak * 4: Duration the adjustment will have an effect * 5: Heart Rate Adjust diff --git a/addons/medical_treatment/initSettings.inc.sqf b/addons/medical_treatment/initSettings.inc.sqf index a73ba29aa4e..793a81972fb 100644 --- a/addons/medical_treatment/initSettings.inc.sqf +++ b/addons/medical_treatment/initSettings.inc.sqf @@ -190,24 +190,6 @@ true ] call CBA_fnc_addSetting; -[ - QGVAR(MorphineDoseLimit), - "SLIDER", - [LSTRING(DoseLimitMorphine_DisplayName), LSTRING(DoseLimitMorphine_DESC)], - [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], - [1, 9, 3, 0], - true -] call CBA_fnc_addSetting; - -[ - QGVAR(MorphineDoseLimitDeviation), - "SLIDER", - [LSTRING(DoseLimitDeviationMorphine_DisplayName), LSTRING(DoseLimitDeviationMorphine_DESC)], - [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], - [0, 3, 1, 0], - true -] call CBA_fnc_addSetting; - [ QGVAR(medicAdenosine), "LIST", @@ -226,24 +208,6 @@ true ] call CBA_fnc_addSetting; -[ - QGVAR(AdenosineDoseLimit), - "SLIDER", - [LSTRING(DoseLimitAdenosine_DisplayName), LSTRING(DoseLimitAdenosine_DESC)], - [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], - [1, 9, 3, 0], - true -] call CBA_fnc_addSetting; - -[ - QGVAR(AdenosineDoseLimitDeviation), - "SLIDER", - [LSTRING(DoseLimitDeviationAdenosine_DisplayName), LSTRING(DoseLimitDeviationAdenosine_DESC)], - [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], - [0, 3, 1, 0], - true -] call CBA_fnc_addSetting; - [ QGVAR(medicPAK), "LIST", From d6de590f4f65d7b49a542c44db10047b402d84fc Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Fri, 11 Oct 2024 07:41:27 -0700 Subject: [PATCH 05/57] Deleted old entries from stringtable --- addons/medical_treatment/stringtable.xml | 36 ------------------------ 1 file changed, 36 deletions(-) diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index 0ebf8bac7ab..8051b551fdb 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -546,18 +546,6 @@ Controla donde puede sr usada la Epinefrina. 에피네프린을 사용할 수 있는 장소를 정합니다. - - Maximum Dose of Epinephrine - - - The maximum Dose of Epinephrine you can give to a player - - - Maximum Dose Deviation of Epinephrine - - - The number of additional doses you may be able to give of Epinephrine, while risking overdose - Allow Morphine @@ -570,18 +558,6 @@ Controls where Morphine can be used. - - Maximum Dose of Morphine - - - The maximum Dose of Morphine you can give to a player - - - Maximum Dose Deviation of Morphine - - - The number of additional doses you may be able to give of Morphine, while risking overdose - Allow Adenosine @@ -594,18 +570,6 @@ Controls where Adenosine can be used. - - Maximum Dose of Adenosine - - - The maximum Dose of Adenosine you can give to a player - - - Maximum Dose Deviation of Adenosine - - - The number of additional doses you may be able to give of Adenosine, while risking overdose - Allow PAK Доступ к Аптечке From 42e2097ebf6294621c2db9f72f5259575c76b0c9 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Fri, 11 Oct 2024 07:54:18 -0700 Subject: [PATCH 06/57] Update addons/medical_treatment/script_component.hpp Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- addons/medical_treatment/script_component.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/script_component.hpp b/addons/medical_treatment/script_component.hpp index 9f636b9909e..6a334ed72a3 100644 --- a/addons/medical_treatment/script_component.hpp +++ b/addons/medical_treatment/script_component.hpp @@ -2,7 +2,7 @@ #define COMPONENT_BEAUTIFIED Medical Treatment #include "\z\ace\addons\main\script_mod.hpp" -#define DEBUG_MODE_FULL +// #define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS From e22e06b45ab9def59e42d96fc2649c5bf80fa676 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Fri, 11 Oct 2024 07:58:16 -0700 Subject: [PATCH 07/57] Fixed newline --- addons/medical_status/XEH_PREP.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_status/XEH_PREP.hpp b/addons/medical_status/XEH_PREP.hpp index 710c3c35b38..30a9142565e 100644 --- a/addons/medical_status/XEH_PREP.hpp +++ b/addons/medical_status/XEH_PREP.hpp @@ -18,4 +18,4 @@ PREP(setCardiacArrestState); PREP(setDead); PREP(setStatusEffects); PREP(setUnconsciousState); -PREP(updateWoundBloodLoss); \ No newline at end of file +PREP(updateWoundBloodLoss); From fff711a7b32ef77110ce1799c0f61af88f91200c Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Fri, 11 Oct 2024 08:22:10 -0700 Subject: [PATCH 08/57] Changes for backwards compatibility --- .../medical_treatment/ACE_Medical_Treatment.hpp | 2 +- addons/medical_treatment/XEH_PREP.hpp | 2 +- .../{fnc_onOverdose.sqf => fnc_Overdose.sqf} | 16 ++++++++-------- .../functions/fnc_onMedicationUsage.sqf | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) rename addons/medical_treatment/functions/{fnc_onOverdose.sqf => fnc_Overdose.sqf} (56%) diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index 01b734df122..144102efff2 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -571,7 +571,7 @@ class ADDON { // Example with maxDose = 4 and maxDoseDeviation = 2: Dose 4: Safe | Dose 5 and 6: Possible overdose | Dose 7: Guaranteed overdose maxDoseDeviation = 2; // Function to execute upon overdose. Arguments passed to call back are 0: unit , 1: medicationClassName - onOverDoseCustom = ""; + onOverDose = ""; // The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. For liquids, it corresponds to the informal concept of "thickness". This value will increase/decrease the viscoty of the blood with the percentage given. Where 100 = max. Using the minus will decrease viscosity viscosityChange = 0; diff --git a/addons/medical_treatment/XEH_PREP.hpp b/addons/medical_treatment/XEH_PREP.hpp index 0dd30bb31fb..1ce31a1d709 100644 --- a/addons/medical_treatment/XEH_PREP.hpp +++ b/addons/medical_treatment/XEH_PREP.hpp @@ -67,4 +67,4 @@ PREP(treatmentFailure); PREP(treatmentSuccess); PREP(unloadUnit); PREP(useItem); -PREP(onOverdose); +PREP(Overdose); diff --git a/addons/medical_treatment/functions/fnc_onOverdose.sqf b/addons/medical_treatment/functions/fnc_Overdose.sqf similarity index 56% rename from addons/medical_treatment/functions/fnc_onOverdose.sqf rename to addons/medical_treatment/functions/fnc_Overdose.sqf index fa8c39d6a9d..75eafe33043 100644 --- a/addons/medical_treatment/functions/fnc_onOverdose.sqf +++ b/addons/medical_treatment/functions/fnc_Overdose.sqf @@ -12,25 +12,25 @@ * None * * Example: - * [player, "morphine"] call ace_medical_treatment_fnc_onOverDose + * [player, "morphine"] call ace_medical_treatment_fnc_OverDose * Public: No */ params ["_unit", "_classname"]; private _medicationConfig = (configFile >> "ace_medical_treatment" >> "_classname"); -private _onOverDoseCustom = getText (_medicationConfig >> "onOverDoseCustom"); +private _onOverDose = getText (_medicationConfig >> "onOverDose"); if (isClass (_medicationConfig >> _className)) then { _medicationConfig = (_medicationConfig >> _className); - if (isText (_medicationConfig >> "onOverDoseCustom")) then { _onOverDoseCustom = getText (_medicationConfig >> "onOverDoseCustom"); }; + if (isText (_medicationConfig >> "onOverDose")) then { _onOverDose = getText (_medicationConfig >> "onOverDose"); }; }; -TRACE_2("overdose",_classname,_onOverDoseCustom); -if (_onOverDoseCustom == "") exitWith { +TRACE_2("overdose",_classname,_onOverDose); +if (_onOverDose == "") exitWith { TRACE_1("CriticalVitals Event",_target); // make unconscious [QEGVAR(medical,CriticalVitals), _target] call CBA_fnc_localEvent; }; -if (isNil _onOverDoseCustom) then { - _onOverDose = compile _onOverDoseCustom; +if (isNil _onOverDose) then { + _onOverDose = compile _onOverDose; } else { - _onOverDoseCustom = missionNamespace getVariable _onOverDoseCustom; + _onOverDose = missionNamespace getVariable _onOverDose; }; \ No newline at end of file diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index fb58e4069e5..b486ed0d5a6 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -34,7 +34,7 @@ if (_maxDose > 0) then { if (_currentDose > _maxDose + (floor random _maxDoseDeviation)) then { TRACE_1("exceeded max dose",_currentDose); - [_target, _classname] call FUNC(onOverdose); + [_target, _classname] call FUNC(Overdose); }; }; @@ -43,6 +43,6 @@ if (_maxDose > 0) then { _x params ["_xMed", "_xLimit"]; private _inSystem = [_target, _xMed] call EFUNC(medical_status,getMedicationCount); if (_inSystem> _xLimit) then { - [_target, _classname] call FUNC(onOverdose); + [_target, _classname] call FUNC(Overdose); }; } forEach _incompatibleMedication; \ No newline at end of file From 70f8f0dc45cb453e5ebba4b20ebc750b078b2fdf Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 08:22:16 -0700 Subject: [PATCH 09/57] Update addons/medical_status/functions/fnc_addMedicationAdjustment.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- addons/medical_status/functions/fnc_addMedicationAdjustment.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf index 91ac01081cf..39c7389a28d 100644 --- a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf +++ b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author: BaerMitUmlaut, PabstMirror modified by Cplhardcore + * Author: BaerMitUmlaut, PabstMirror, Cplhardcore * Adds a medication and it's effects * * Arguments: From 8c5716b8db3ccd8ad924c2f7fdc1ab11278ca837 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 08:22:26 -0700 Subject: [PATCH 10/57] Update addons/medical_status/functions/fnc_getAllMedicationCount.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- addons/medical_status/functions/fnc_getAllMedicationCount.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf index 2e23a9ada6b..ea9f0b7fe49 100644 --- a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -6,7 +6,7 @@ * * Arguments: * 0: The patient - * 1: Get raw count (true) or effect ratio (false) (default: true) + * 1: Get raw count (true) or effect ratio (false) (default: true) * * Return Value: * Dose Count From 684d8ec0bb183ba20b474cf7452206661cd16609 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 08:22:36 -0700 Subject: [PATCH 11/57] Update addons/medical_status/functions/fnc_getAllMedicationCount.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- addons/medical_status/functions/fnc_getAllMedicationCount.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf index ea9f0b7fe49..1bf51f0a0cf 100644 --- a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -52,6 +52,6 @@ private _medStack = []; // Array to store stacked medication info } forEach (_target getVariable [VAR_MEDICATIONS, []]); -TRACE_3("getMedicationStack", _target, _medStack, _getCount); +TRACE_3("getMedicationStack",_target,_medStack,_getCount); _medStack \ No newline at end of file From 2e227954e4d6b9b0896c06b5bf8e2f760a148e6b Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 08:55:56 -0700 Subject: [PATCH 12/57] Fixes, maybe? --- .../functions/fnc_addMedicationAdjustment.sqf | 7 +++--- .../functions/fnc_getAllMedicationCount.sqf | 15 +++++------- .../functions/fnc_getMedicationCount.sqf | 2 +- .../functions/fnc_Overdose.sqf | 24 ++++++++++--------- .../functions/fnc_medicationLocal.sqf | 2 +- .../functions/fnc_onMedicationUsage.sqf | 4 ++-- addons/medical_treatment/initSettings.inc.sqf | 18 -------------- .../functions/fnc_handleUnitVitals.sqf | 2 +- 8 files changed, 27 insertions(+), 47 deletions(-) diff --git a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf index 39c7389a28d..202bf86e321 100644 --- a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf +++ b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf @@ -21,8 +21,8 @@ * * Public: No */ -params ["_unit", "_medication", "_dose", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"]; -TRACE_8("addMedicationAdjustment",_unit,_medication,_dose,_timeToMaxEffect,_maxTimeInSystem,_hrAdjust,_painAdjust,_flowAdjust); +params ["_unit", "_medication", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust","_dose",]; +TRACE_8("addMedicationAdjustment",_unit,_medication,_timeToMaxEffect,_maxTimeInSystem,_hrAdjust,_painAdjust,_flowAdjust,_dose); if (_maxTimeInSystem <= 0) exitWith { WARNING_1("bad value for _maxTimeInSystem - %1",_this); }; _timeToMaxEffect = _timeToMaxEffect max 1; @@ -30,6 +30,5 @@ _timeToMaxEffect = _timeToMaxEffect max 1; private _adjustments = _unit getVariable [VAR_MEDICATIONS, []]; -_adjustments pushBack [_medication, CBA_missionTime, _dose, _timeToMaxEffect, _maxTimeInSystem, _hrAdjust, _painAdjust, _flowAdjust]; - +_adjustments pushBack [_medication, CBA_missionTime, _timeToMaxEffect, _maxTimeInSystem, _hrAdjust, _painAdjust, _flowAdjust, _dose]; _unit setVariable [VAR_MEDICATIONS, _adjustments, true]; diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf index 1bf51f0a0cf..cb89ddb1d79 100644 --- a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -15,15 +15,15 @@ * Example: * [player] call ace_medical_status_fnc_getAllMedicationCount * - * Public: No + * Public: Yes */ params ["_target", ["_getCount", true]]; -private _medStack = []; // Array to store stacked medication info +private _medStack = []; { - _x params ["_xMed", "_timeAdded", "_dose", "_timeTillMaxEffect", "_maxTimeInSystem"]; + _x params ["_xMed", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_dose"]; private _timeInSystem = CBA_missionTime - _timeAdded; private _effectiveness = 0; @@ -40,11 +40,8 @@ private _medStack = []; // Array to store stacked medication info if (_existingMed isEqualTo _xMed) then { _found = true; - _medStack set [_forEachIndex, [_existingMed, _totalDose + _dose, _totalEffectiveness + _effectiveness]]; // Stack dose and add effectiveness - true - } else { - false - }; + _medStack set [_forEachIndex, [_existingMed, _totalDose + _dose, _totalEffectiveness + _effectiveness]]; + } else {}; } forEach _medStack; if (!_found) then { _medStack pushBack [_xMed, _dose, _effectiveness]; @@ -54,4 +51,4 @@ private _medStack = []; // Array to store stacked medication info TRACE_3("getMedicationStack",_target,_medStack,_getCount); -_medStack \ No newline at end of file +_medStack diff --git a/addons/medical_status/functions/fnc_getMedicationCount.sqf b/addons/medical_status/functions/fnc_getMedicationCount.sqf index 2afe54d6ed0..60bcf721fd7 100644 --- a/addons/medical_status/functions/fnc_getMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getMedicationCount.sqf @@ -24,7 +24,7 @@ params ["_target", "_medication", ["_getCount", true]]; private _return = 0; private _medDose = 0; { - _x params ["_xMed", "_timeAdded", "_dose", "_timeTillMaxEffect", "_maxTimeInSystem"]; + _x params ["_xMed", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_dose"]; if (_xMed == _medication) then { private _timeInSystem = CBA_missionTime - _timeAdded; _medDose = _medDose + _dose; diff --git a/addons/medical_treatment/functions/fnc_Overdose.sqf b/addons/medical_treatment/functions/fnc_Overdose.sqf index 75eafe33043..b24a8d9a5d0 100644 --- a/addons/medical_treatment/functions/fnc_Overdose.sqf +++ b/addons/medical_treatment/functions/fnc_Overdose.sqf @@ -12,24 +12,26 @@ * None * * Example: - * [player, "morphine"] call ace_medical_treatment_fnc_OverDose + * [player, "morphine"] call ace_medical_treatment_fnc_overDose * Public: No */ - params ["_unit", "_classname"]; - -private _medicationConfig = (configFile >> "ace_medical_treatment" >> "_classname"); +params ["_unit", "_classname"]; +private _medicationConfig = (configFile >> "ace_medical_treatment" >> _classname); private _onOverDose = getText (_medicationConfig >> "onOverDose"); -if (isClass (_medicationConfig >> _className)) then { - _medicationConfig = (_medicationConfig >> _className); - if (isText (_medicationConfig >> "onOverDose")) then { _onOverDose = getText (_medicationConfig >> "onOverDose"); }; + +if (isClass (_medicationConfig)) then { + _medicationConfig = (_medicationConfig >> _classname); + if (isText (_medicationConfig >> "onOverDose")) then { + _onOverDose = getText (_medicationConfig >> "onOverDose"); + }; }; -TRACE_2("overdose",_classname,_onOverDose); +TRACE_2("overdose", _classname, _onOverDose); if (_onOverDose == "") exitWith { - TRACE_1("CriticalVitals Event",_target); // make unconscious - [QEGVAR(medical,CriticalVitals), _target] call CBA_fnc_localEvent; + TRACE_1("CriticalVitals Event", _unit); + [QEGVAR(medical, CriticalVitals), _unit] call CBA_fnc_localEvent; }; -if (isNil _onOverDose) then { +if (!isNil "_onOverDose" && {isText _onOverDose}) then { _onOverDose = compile _onOverDose; } else { _onOverDose = missionNamespace getVariable _onOverDose; diff --git a/addons/medical_treatment/functions/fnc_medicationLocal.sqf b/addons/medical_treatment/functions/fnc_medicationLocal.sqf index 52e08134b31..86a456a61aa 100644 --- a/addons/medical_treatment/functions/fnc_medicationLocal.sqf +++ b/addons/medical_treatment/functions/fnc_medicationLocal.sqf @@ -65,12 +65,12 @@ private _medicationConfig = _defaultConfig >> _classname; private _painReduce = GET_NUMBER(_medicationConfig >> "painReduce",getNumber (_defaultConfig >> "painReduce")); private _timeInSystem = GET_NUMBER(_medicationConfig >> "timeInSystem",getNumber (_defaultConfig >> "timeInSystem")); private _timeTillMaxEffect = GET_NUMBER(_medicationConfig >> "timeTillMaxEffect",getNumber (_defaultConfig >> "timeTillMaxEffect")); -private _dose = GET_NUMBER(_medicationConfig >> "dose",getNumber (_defaultConfig >> "dose")); private _viscosityChange = GET_NUMBER(_medicationConfig >> "viscosityChange",getNumber (_defaultConfig >> "viscosityChange")); private _hrIncreaseLow = GET_ARRAY(_medicationConfig >> "hrIncreaseLow",getArray (_defaultConfig >> "hrIncreaseLow")); private _hrIncreaseNormal = GET_ARRAY(_medicationConfig >> "hrIncreaseNormal",getArray (_defaultConfig >> "hrIncreaseNormal")); private _hrIncreaseHigh = GET_ARRAY(_medicationConfig >> "hrIncreaseHigh",getArray (_defaultConfig >> "hrIncreaseHigh")); private _incompatibleMedication = GET_ARRAY(_medicationConfig >> "incompatibleMedication",getArray (_defaultConfig >> "incompatibleMedication")); +private _dose = GET_NUMBER(_medicationConfig >> "dose",getNumber (_defaultConfig >> "dose")); private _heartRate = GET_HEART_RATE(_patient); private _hrIncrease = [_hrIncreaseLow, _hrIncreaseNormal, _hrIncreaseHigh] select (floor ((0 max _heartRate min 110) / 55)); diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index b486ed0d5a6..5d746d855cb 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -34,7 +34,7 @@ if (_maxDose > 0) then { if (_currentDose > _maxDose + (floor random _maxDoseDeviation)) then { TRACE_1("exceeded max dose",_currentDose); - [_target, _classname] call FUNC(Overdose); + [_target, _classname] call FUNC(overDose); }; }; @@ -43,6 +43,6 @@ if (_maxDose > 0) then { _x params ["_xMed", "_xLimit"]; private _inSystem = [_target, _xMed] call EFUNC(medical_status,getMedicationCount); if (_inSystem> _xLimit) then { - [_target, _classname] call FUNC(Overdose); + [_target, _classname] call FUNC(overDose); }; } forEach _incompatibleMedication; \ No newline at end of file diff --git a/addons/medical_treatment/initSettings.inc.sqf b/addons/medical_treatment/initSettings.inc.sqf index 793a81972fb..00bef17240f 100644 --- a/addons/medical_treatment/initSettings.inc.sqf +++ b/addons/medical_treatment/initSettings.inc.sqf @@ -154,24 +154,6 @@ true ] call CBA_fnc_addSetting; -[ - QGVAR(EpinephrineDoseLimit), - "SLIDER", - [LSTRING(DoseLimitEpinephrine_DisplayName), LSTRING(DoseLimitEpinephrine_DESC)], - [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], - [1, 9, 3, 0], - true -] call CBA_fnc_addSetting; - -[ - QGVAR(EpinephrineDoseLimitDeviation), - "SLIDER", - [LSTRING(DoseLimitDeviationEpinephrine_DisplayName), LSTRING(DoseLimitDeviationEpinephrine_DESC)], - [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], - [0, 3, 1, 0], - true -] call CBA_fnc_addSetting; - [ QGVAR(medicMorphine), "LIST", diff --git a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf index 9dc4fb9a1c9..2180467e3ba 100644 --- a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf @@ -81,7 +81,7 @@ private _adjustments = _unit getVariable [VAR_MEDICATIONS,[]]; if (_adjustments isNotEqualTo []) then { private _deleted = false; { - _x params ["_medication", "_dose", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"]; + _x params ["_medication", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust", ""]; private _timeInSystem = CBA_missionTime - _timeAdded; if (_timeInSystem >= _maxTimeInSystem) then { _deleted = true; From 40abd2a8ab7bb276a53cd9237b540dcc36de01e8 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 08:59:41 -0700 Subject: [PATCH 13/57] Overdose fixes --- addons/medical_treatment/functions/fnc_Overdose.sqf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_Overdose.sqf b/addons/medical_treatment/functions/fnc_Overdose.sqf index b24a8d9a5d0..8a14c9213e9 100644 --- a/addons/medical_treatment/functions/fnc_Overdose.sqf +++ b/addons/medical_treatment/functions/fnc_Overdose.sqf @@ -35,4 +35,5 @@ if (!isNil "_onOverDose" && {isText _onOverDose}) then { _onOverDose = compile _onOverDose; } else { _onOverDose = missionNamespace getVariable _onOverDose; -}; \ No newline at end of file +}; +[_target, _className] call _onOverDose; From 7c895ba159d32014f9b38eb464f3bbabb33101d8 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 12 Oct 2024 16:31:04 -0300 Subject: [PATCH 14/57] trailling comma --- addons/medical_status/functions/fnc_addMedicationAdjustment.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf index 202bf86e321..c894656832b 100644 --- a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf +++ b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf @@ -21,7 +21,7 @@ * * Public: No */ -params ["_unit", "_medication", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust","_dose",]; +params ["_unit", "_medication", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust","_dose"]; TRACE_8("addMedicationAdjustment",_unit,_medication,_timeToMaxEffect,_maxTimeInSystem,_hrAdjust,_painAdjust,_flowAdjust,_dose); if (_maxTimeInSystem <= 0) exitWith { WARNING_1("bad value for _maxTimeInSystem - %1",_this); }; From 768f9abdf4aee39be475e53ae16994f301764186 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 12 Oct 2024 16:31:29 -0300 Subject: [PATCH 15/57] Update addons/medical_vitals/functions/fnc_handleUnitVitals.sqf --- addons/medical_vitals/functions/fnc_handleUnitVitals.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf index 2180467e3ba..77aec7fd621 100644 --- a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf @@ -81,7 +81,7 @@ private _adjustments = _unit getVariable [VAR_MEDICATIONS,[]]; if (_adjustments isNotEqualTo []) then { private _deleted = false; { - _x params ["_medication", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust", ""]; + _x params ["_medication", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"]; private _timeInSystem = CBA_missionTime - _timeAdded; if (_timeInSystem >= _maxTimeInSystem) then { _deleted = true; From 8216db17212f14a38659ab3421dc2c382d3bd104 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:13:20 -0700 Subject: [PATCH 16/57] aa --- .../functions/{fnc_Overdose.sqf => fnc_zoverDose.sqf} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename addons/medical_treatment/functions/{fnc_Overdose.sqf => fnc_zoverDose.sqf} (100%) diff --git a/addons/medical_treatment/functions/fnc_Overdose.sqf b/addons/medical_treatment/functions/fnc_zoverDose.sqf similarity index 100% rename from addons/medical_treatment/functions/fnc_Overdose.sqf rename to addons/medical_treatment/functions/fnc_zoverDose.sqf From b5c3c5dd2a0679979ff83365edd27a92d7f18786 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:13:38 -0700 Subject: [PATCH 17/57] there we go --- .../functions/{fnc_zoverDose.sqf => fnc_overDose.sqf} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename addons/medical_treatment/functions/{fnc_zoverDose.sqf => fnc_overDose.sqf} (100%) diff --git a/addons/medical_treatment/functions/fnc_zoverDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf similarity index 100% rename from addons/medical_treatment/functions/fnc_zoverDose.sqf rename to addons/medical_treatment/functions/fnc_overDose.sqf From 8443181467e91ab38197ac13a165b449b6d61bcf Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:14:26 -0700 Subject: [PATCH 18/57] Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jouni Järvinen --- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index 5d746d855cb..31b5d4e69f6 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -6,7 +6,7 @@ * Arguments: * 0: The patient * 1: Medication Treatment classname - * 2: Incompatable medication > + * 2: Incompatible medication > * * Return Value: * None From 9abb145604329c21dfd4bcc1b9de67b416bbcc05 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:14:35 -0700 Subject: [PATCH 19/57] Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jouni Järvinen --- .../medical_treatment/functions/fnc_onMedicationUsage.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index 31b5d4e69f6..a13a263d498 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -21,10 +21,10 @@ params ["_target", "_className", "_incompatibleMedication"]; TRACE_3("onMedicationUsage",_target,_className,_incompatibleMedication); // Check for overdose from current medication -private _defaultConfig = configFile >> QUOTE(ADDON) >> "Medication"; +private _defaultConfig = configFile >> QUOTE(ADDON) >> "Medication"; private _medicationConfig = _defaultConfig >> _classname; -private _maxDose = GET_NUMBER(_medicationConfig >> "maxDose",getNumber (_defaultConfig >> "maxDose")); -private _maxDoseDeviation = GET_NUMBER(_medicationConfig >> "maxDoseDeviation",getNumber (_defaultConfig >> "maxDoseDeviation")); +private _maxDose = GET_NUMBER(_medicationConfig >> "maxDose",getNumber (_defaultConfig >> "maxDose")); +private _maxDoseDeviation = GET_NUMBER(_medicationConfig >> "maxDoseDeviation",getNumber (_defaultConfig >> "maxDoseDeviation")); if (_maxDose > 0) then { private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount) select 1; // Because both {floor random 0} and {floor random 1} return 0 From 01504ea72772922d4fe86c6a970e66cdba27325b Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:15:16 -0700 Subject: [PATCH 20/57] Update XEH_PREP.hpp --- addons/medical_treatment/XEH_PREP.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/XEH_PREP.hpp b/addons/medical_treatment/XEH_PREP.hpp index 1ce31a1d709..f2910f657ae 100644 --- a/addons/medical_treatment/XEH_PREP.hpp +++ b/addons/medical_treatment/XEH_PREP.hpp @@ -67,4 +67,4 @@ PREP(treatmentFailure); PREP(treatmentSuccess); PREP(unloadUnit); PREP(useItem); -PREP(Overdose); +PREP(overDose); From 2ab49a487815871efd4432c04ac527ffb8f0c157 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:16:56 -0700 Subject: [PATCH 21/57] Update addons/medical_status/functions/fnc_getAllMedicationCount.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- .../medical_status/functions/fnc_getAllMedicationCount.sqf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf index cb89ddb1d79..cf7a89c7148 100644 --- a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -9,8 +9,9 @@ * 1: Get raw count (true) or effect ratio (false) (default: true) * * Return Value: - * Dose Count - * Medication effectiveness (float) + * Array of medication counts : + * Dose Count + * Medication effectiveness (float) * * Example: * [player] call ace_medical_status_fnc_getAllMedicationCount From 594d02b7c93e5fe2c613586c4ebc7ad96ab19a7d Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:49:34 -0700 Subject: [PATCH 22/57] Grim Misc Fixes --- .../functions/fnc_getAllMedicationCount.sqf | 35 ++----------------- .../functions/fnc_getMedicationCount.sqf | 4 +-- addons/medical_status/script_component.hpp | 2 +- .../functions/fnc_medicationLocal.sqf | 2 +- .../functions/fnc_overDose.sqf | 6 ++-- addons/medical_treatment/script_component.hpp | 2 +- 6 files changed, 11 insertions(+), 40 deletions(-) diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf index cb89ddb1d79..58fe0ad5752 100644 --- a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -20,35 +20,6 @@ params ["_target", ["_getCount", true]]; -private _medStack = []; - -{ - _x params ["_xMed", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_dose"]; - - private _timeInSystem = CBA_missionTime - _timeAdded; - private _effectiveness = 0; - - if (_getCount) then { - _effectiveness = linearConversion [_timeTillMaxEffect, _maxTimeInSystem, _timeInSystem, 1, 0, true]; - } else { - _effectiveness = (((_timeInSystem / _timeTillMaxEffect) ^ 2) min 1) * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem; - }; - - private _found = false; - { - _x params ["_existingMed", "_totalDose", "_totalEffectiveness"]; - - if (_existingMed isEqualTo _xMed) then { - _found = true; - _medStack set [_forEachIndex, [_existingMed, _totalDose + _dose, _totalEffectiveness + _effectiveness]]; - } else {}; - } forEach _medStack; - if (!_found) then { - _medStack pushBack [_xMed, _dose, _effectiveness]; - }; - -} forEach (_target getVariable [VAR_MEDICATIONS, []]); - -TRACE_3("getMedicationStack",_target,_medStack,_getCount); - -_medStack +private _medicationClasses = (_target getVariable [VAR_MEDICATIONS, []]) apply {_x select 0}; +_medicationClasses = _medicationClasses arrayIntersect _medicationClasses; +_medicationClasses apply {[_target, _x, _getCount] call FUNC(getMedicationCount)} // return \ No newline at end of file diff --git a/addons/medical_status/functions/fnc_getMedicationCount.sqf b/addons/medical_status/functions/fnc_getMedicationCount.sqf index 60bcf721fd7..58f0aa95697 100644 --- a/addons/medical_status/functions/fnc_getMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getMedicationCount.sqf @@ -24,7 +24,7 @@ params ["_target", "_medication", ["_getCount", true]]; private _return = 0; private _medDose = 0; { - _x params ["_xMed", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_dose"]; + _x params ["_xMed", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "", "", "", "_dose"]; if (_xMed == _medication) then { private _timeInSystem = CBA_missionTime - _timeAdded; _medDose = _medDose + _dose; @@ -40,4 +40,4 @@ private _medDose = 0; TRACE_5("getMedicationCount",_target,_medication,_getCount,_return,_medDose); -[_medDose, _return] +[_medication, _medDose, _return] diff --git a/addons/medical_status/script_component.hpp b/addons/medical_status/script_component.hpp index 324fb88078b..817ec494907 100644 --- a/addons/medical_status/script_component.hpp +++ b/addons/medical_status/script_component.hpp @@ -2,7 +2,7 @@ #define COMPONENT_BEAUTIFIED Medical Status #include "\z\ace\addons\main\script_mod.hpp" -// #define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS diff --git a/addons/medical_treatment/functions/fnc_medicationLocal.sqf b/addons/medical_treatment/functions/fnc_medicationLocal.sqf index 86a456a61aa..b5a44051f07 100644 --- a/addons/medical_treatment/functions/fnc_medicationLocal.sqf +++ b/addons/medical_treatment/functions/fnc_medicationLocal.sqf @@ -79,7 +79,7 @@ private _heartRateChange = _minIncrease + random (_maxIncrease - _minIncrease); // Adjust the medication effects and add the medication to the list TRACE_3("adjustments",_heartRateChange,_painReduce,_viscosityChange); -[_patient, _className, _dose, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange] call EFUNC(medical_status,addMedicationAdjustment); +[_patient, _className, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange, _dose] call EFUNC(medical_status,addMedicationAdjustment); // Check for medication compatiblity [_patient, _className, _incompatibleMedication] call FUNC(onMedicationUsage); diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index 8a14c9213e9..53966e4120e 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -26,10 +26,10 @@ if (isClass (_medicationConfig)) then { _onOverDose = getText (_medicationConfig >> "onOverDose"); }; }; -TRACE_2("overdose", _classname, _onOverDose); +TRACE_2("overdose",_classname,_onOverDose); if (_onOverDose == "") exitWith { - TRACE_1("CriticalVitals Event", _unit); - [QEGVAR(medical, CriticalVitals), _unit] call CBA_fnc_localEvent; + TRACE_1("CriticalVitals Event",_unit); + [QEGVAR(medical,CriticalVitals), _unit] call CBA_fnc_localEvent; }; if (!isNil "_onOverDose" && {isText _onOverDose}) then { _onOverDose = compile _onOverDose; diff --git a/addons/medical_treatment/script_component.hpp b/addons/medical_treatment/script_component.hpp index 6a334ed72a3..9f636b9909e 100644 --- a/addons/medical_treatment/script_component.hpp +++ b/addons/medical_treatment/script_component.hpp @@ -2,7 +2,7 @@ #define COMPONENT_BEAUTIFIED Medical Treatment #include "\z\ace\addons\main\script_mod.hpp" -// #define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS From 8e916cd00806961dcab5c845d4e27ace9b1b59ba Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:51:19 -0700 Subject: [PATCH 23/57] Remove debug --- addons/medical_status/script_component.hpp | 2 +- addons/medical_treatment/script_component.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical_status/script_component.hpp b/addons/medical_status/script_component.hpp index 817ec494907..324fb88078b 100644 --- a/addons/medical_status/script_component.hpp +++ b/addons/medical_status/script_component.hpp @@ -2,7 +2,7 @@ #define COMPONENT_BEAUTIFIED Medical Status #include "\z\ace\addons\main\script_mod.hpp" -#define DEBUG_MODE_FULL +// #define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS diff --git a/addons/medical_treatment/script_component.hpp b/addons/medical_treatment/script_component.hpp index 9f636b9909e..6a334ed72a3 100644 --- a/addons/medical_treatment/script_component.hpp +++ b/addons/medical_treatment/script_component.hpp @@ -2,7 +2,7 @@ #define COMPONENT_BEAUTIFIED Medical Treatment #include "\z\ace\addons\main\script_mod.hpp" -#define DEBUG_MODE_FULL +// #define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS From d0a14d86f404c55a33dd9cc030272c4db5a3d23a Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 12 Oct 2024 20:56:49 -0700 Subject: [PATCH 24/57] Small fixes --- .../functions/fnc_addMedicationAdjustment.sqf | 14 +++++++------- .../functions/fnc_handleUnitVitals.sqf | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf index c894656832b..0b4db589343 100644 --- a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf +++ b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf @@ -5,13 +5,13 @@ * * Arguments: * 0: The Unit - * 1: Medication - * 2: Dose of medication - * 3: Time in system for the adjustment to reach its peak - * 4: Duration the adjustment will have an effect - * 5: Heart Rate Adjust - * 6: Pain Suppress Adjust - * 7: Flow Adjust + * 1: Medication + * 2: Time in system for the adjustment to reach its peak + * 3: Duration the adjustment will have an effect + * 4: Heart Rate Adjust + * 5: Pain Suppress Adjust + * 6: Flow Adjust + * 7: Dose of medication * * Return Value: * None diff --git a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf index 77aec7fd621..05aeba5036f 100644 --- a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf @@ -81,7 +81,7 @@ private _adjustments = _unit getVariable [VAR_MEDICATIONS,[]]; if (_adjustments isNotEqualTo []) then { private _deleted = false; { - _x params ["_medication", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"]; + _x params ["_medication", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust", "_dose"]; private _timeInSystem = CBA_missionTime - _timeAdded; if (_timeInSystem >= _maxTimeInSystem) then { _deleted = true; From 528345655fcdd2bab9d65598a0a14b5336416bed Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 19 Oct 2024 01:59:46 -0300 Subject: [PATCH 25/57] newline --- addons/medical_status/functions/fnc_getAllMedicationCount.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf index f062372ff0a..f10388dcff6 100644 --- a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -23,4 +23,4 @@ params ["_target", ["_getCount", true]]; private _medicationClasses = (_target getVariable [VAR_MEDICATIONS, []]) apply {_x select 0}; _medicationClasses = _medicationClasses arrayIntersect _medicationClasses; -_medicationClasses apply {[_target, _x, _getCount] call FUNC(getMedicationCount)} // return \ No newline at end of file +_medicationClasses apply {[_target, _x, _getCount] call FUNC(getMedicationCount)} // return From 383a87be4873b10fd1e2221ce77e6e6172d09c90 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:08:46 -0300 Subject: [PATCH 26/57] headers --- addons/medical_status/functions/fnc_getAllMedicationCount.sqf | 2 +- addons/medical_status/functions/fnc_getMedicationCount.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf index f10388dcff6..a412211c9f4 100644 --- a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -11,7 +11,7 @@ * Return Value: * Array of medication counts : * Dose Count - * Medication effectiveness (float) + * Medication effectiveness (0-1) * * Example: * [player] call ace_medical_status_fnc_getAllMedicationCount diff --git a/addons/medical_status/functions/fnc_getMedicationCount.sqf b/addons/medical_status/functions/fnc_getMedicationCount.sqf index 58f0aa95697..a0505337237 100644 --- a/addons/medical_status/functions/fnc_getMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getMedicationCount.sqf @@ -11,7 +11,7 @@ * * Return Value: * Dose Count - * Medication effectiveness (float) + * Medication effectiveness (0-1) * * Example: * [player, "Epinephrine"] call ace_medical_status_fnc_getMedicationCount From 90dbb850a76c641a26e59255734d98306f671d42 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:10:49 -0300 Subject: [PATCH 27/57] code cleanup --- .../medical_treatment/functions/fnc_medicationLocal.sqf | 2 +- .../medical_treatment/functions/fnc_onMedicationUsage.sqf | 2 +- addons/medical_treatment/functions/fnc_overDose.sqf | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_medicationLocal.sqf b/addons/medical_treatment/functions/fnc_medicationLocal.sqf index b5a44051f07..5add34104b9 100644 --- a/addons/medical_treatment/functions/fnc_medicationLocal.sqf +++ b/addons/medical_treatment/functions/fnc_medicationLocal.sqf @@ -70,7 +70,7 @@ private _hrIncreaseLow = GET_ARRAY(_medicationConfig >> "hrIncreaseLow" private _hrIncreaseNormal = GET_ARRAY(_medicationConfig >> "hrIncreaseNormal",getArray (_defaultConfig >> "hrIncreaseNormal")); private _hrIncreaseHigh = GET_ARRAY(_medicationConfig >> "hrIncreaseHigh",getArray (_defaultConfig >> "hrIncreaseHigh")); private _incompatibleMedication = GET_ARRAY(_medicationConfig >> "incompatibleMedication",getArray (_defaultConfig >> "incompatibleMedication")); -private _dose = GET_NUMBER(_medicationConfig >> "dose",getNumber (_defaultConfig >> "dose")); +private _dose = GET_NUMBER(_medicationConfig >> "dose",getNumber (_defaultConfig >> "dose")); private _heartRate = GET_HEART_RATE(_patient); private _hrIncrease = [_hrIncreaseLow, _hrIncreaseNormal, _hrIncreaseHigh] select (floor ((0 max _heartRate min 110) / 55)); diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index a13a263d498..c79680ace1d 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -45,4 +45,4 @@ if (_maxDose > 0) then { if (_inSystem> _xLimit) then { [_target, _classname] call FUNC(overDose); }; -} forEach _incompatibleMedication; \ No newline at end of file +} forEach _incompatibleMedication; diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index 53966e4120e..6535e4110cc 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -17,11 +17,11 @@ */ params ["_unit", "_classname"]; -private _medicationConfig = (configFile >> "ace_medical_treatment" >> _classname); +private _medicationConfig = configFile >> "ace_medical_treatment" >> _classname; private _onOverDose = getText (_medicationConfig >> "onOverDose"); -if (isClass (_medicationConfig)) then { - _medicationConfig = (_medicationConfig >> _classname); +if (isClass _medicationConfig) then { + _medicationConfig = _medicationConfig >> _classname; if (isText (_medicationConfig >> "onOverDose")) then { _onOverDose = getText (_medicationConfig >> "onOverDose"); }; @@ -36,4 +36,4 @@ if (!isNil "_onOverDose" && {isText _onOverDose}) then { } else { _onOverDose = missionNamespace getVariable _onOverDose; }; -[_target, _className] call _onOverDose; +[_target, _className] call _onOverDose From 522a496c8fca183b2bd6e059544034da135560e9 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:11:28 -0300 Subject: [PATCH 28/57] more headers --- addons/medical_status/functions/fnc_getAllMedicationCount.sqf | 2 +- addons/medical_status/functions/fnc_getMedicationCount.sqf | 2 +- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf index a412211c9f4..250f4958ae2 100644 --- a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author: PabstMirror, modified by Cplhardcore + * Author: PabstMirror, Cplhardcore * Gets effective count of all medications in a unit's system * (each medication dose is scaled from 0..1 based on time till max effect and max time in system) * diff --git a/addons/medical_status/functions/fnc_getMedicationCount.sqf b/addons/medical_status/functions/fnc_getMedicationCount.sqf index a0505337237..bdb0b529c3d 100644 --- a/addons/medical_status/functions/fnc_getMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getMedicationCount.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author: PabstMirror modified by Cplhardcore + * Author: PabstMirror, Cplhardcore * Gets effective count of medications in a unit's system * (each medication dose is scaled from 0..1 based on time till max effect and max time in system) * diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index c79680ace1d..c9662c92f32 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author: Glowbal, modified by Cplhardcore + * Author: Glowbal, Cplhardcore * Handles the medication given to a patient. * * Arguments: From a5b65224fd8361992efaa072cfaa3b0007aeb8df Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:11:43 -0300 Subject: [PATCH 29/57] drop unneeded _dose --- addons/medical_vitals/functions/fnc_handleUnitVitals.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf index 05aeba5036f..77aec7fd621 100644 --- a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf @@ -81,7 +81,7 @@ private _adjustments = _unit getVariable [VAR_MEDICATIONS,[]]; if (_adjustments isNotEqualTo []) then { private _deleted = false; { - _x params ["_medication", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust", "_dose"]; + _x params ["_medication", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"]; private _timeInSystem = CBA_missionTime - _timeAdded; if (_timeInSystem >= _maxTimeInSystem) then { _deleted = true; From 7703596971c2f4661a0485a1efb6933ac48e135f Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:12:22 -0300 Subject: [PATCH 30/57] last header --- addons/medical_treatment/functions/fnc_medicationLocal.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_medicationLocal.sqf b/addons/medical_treatment/functions/fnc_medicationLocal.sqf index 5add34104b9..b48d7f3be4f 100644 --- a/addons/medical_treatment/functions/fnc_medicationLocal.sqf +++ b/addons/medical_treatment/functions/fnc_medicationLocal.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author: Glowbal, mharis001, modified by Cplhardcore + * Author: Glowbal, mharis001, Cplhardcore * Local callback for administering medication to a patient. * * Arguments: From 7e1e45ff4ed5e6203bade35c9573ae37f7b7c49c Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:18:09 -0300 Subject: [PATCH 31/57] fix getting overdose func/code --- addons/medical_treatment/functions/fnc_overDose.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index 6535e4110cc..a40a50fc1b5 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -31,7 +31,7 @@ if (_onOverDose == "") exitWith { TRACE_1("CriticalVitals Event",_unit); [QEGVAR(medical,CriticalVitals), _unit] call CBA_fnc_localEvent; }; -if (!isNil "_onOverDose" && {isText _onOverDose}) then { +if (isNil _onOverDose) then { _onOverDose = compile _onOverDose; } else { _onOverDose = missionNamespace getVariable _onOverDose; From 85a51058f28d38dbe5106694f1b23e0b5d36cf6d Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:21:19 -0300 Subject: [PATCH 32/57] whitespace --- addons/medical_treatment/functions/fnc_overDose.sqf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index a40a50fc1b5..bfb67cb1fb8 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -17,6 +17,7 @@ */ params ["_unit", "_classname"]; + private _medicationConfig = configFile >> "ace_medical_treatment" >> _classname; private _onOverDose = getText (_medicationConfig >> "onOverDose"); @@ -27,13 +28,16 @@ if (isClass _medicationConfig) then { }; }; TRACE_2("overdose",_classname,_onOverDose); + if (_onOverDose == "") exitWith { TRACE_1("CriticalVitals Event",_unit); [QEGVAR(medical,CriticalVitals), _unit] call CBA_fnc_localEvent; }; + if (isNil _onOverDose) then { _onOverDose = compile _onOverDose; } else { _onOverDose = missionNamespace getVariable _onOverDose; }; + [_target, _className] call _onOverDose From 31afab74f1dc869e4f102e7fe6a7d260dec252cb Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:22:38 -0300 Subject: [PATCH 33/57] now the last header --- addons/medical_treatment/functions/fnc_overDose.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index bfb67cb1fb8..c078bebdc3c 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -5,8 +5,8 @@ * * Arguments: * 0: The patient - * 1: Medication Treatment classname - * 2: Incompatable medication > + * 1: Medication classname + * 2: Incompatible medication * * Return Value: * None From b6d1635fe42c28d88c14feccddf0a4ac25d44715 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 19 Oct 2024 15:18:32 -0700 Subject: [PATCH 34/57] Update addons/medical_treatment/functions/fnc_overDose.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- addons/medical_treatment/functions/fnc_overDose.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index c078bebdc3c..6d9a3149201 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -18,7 +18,7 @@ params ["_unit", "_classname"]; -private _medicationConfig = configFile >> "ace_medical_treatment" >> _classname; +private _medicationConfig = configFile >> "ace_medical_treatment" >> "Medication"; private _onOverDose = getText (_medicationConfig >> "onOverDose"); if (isClass _medicationConfig) then { From cc0f11605b653f3bb73bd53832aa7ef3a06bcccc Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sun, 20 Oct 2024 18:26:32 -0300 Subject: [PATCH 35/57] fix compiling nil --- addons/medical_treatment/functions/fnc_overDose.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index 6d9a3149201..8a2eed98976 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -34,7 +34,7 @@ if (_onOverDose == "") exitWith { [QEGVAR(medical,CriticalVitals), _unit] call CBA_fnc_localEvent; }; -if (isNil _onOverDose) then { +if (!isNil _onOverDose) then { _onOverDose = compile _onOverDose; } else { _onOverDose = missionNamespace getVariable _onOverDose; From 0898ae90d6995a8a96afc1c09e24c8597ac5be80 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Tue, 22 Oct 2024 18:40:44 -0700 Subject: [PATCH 36/57] Update addons/medical_status/functions/fnc_addMedicationAdjustment.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_status/functions/fnc_addMedicationAdjustment.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf index 0b4db589343..992e4773b52 100644 --- a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf +++ b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf @@ -21,7 +21,7 @@ * * Public: No */ -params ["_unit", "_medication", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust","_dose"]; +params ["_unit", "_medication", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust", "_dose"]; TRACE_8("addMedicationAdjustment",_unit,_medication,_timeToMaxEffect,_maxTimeInSystem,_hrAdjust,_painAdjust,_flowAdjust,_dose); if (_maxTimeInSystem <= 0) exitWith { WARNING_1("bad value for _maxTimeInSystem - %1",_this); }; From 8453797a2d229ef658a8edc1d2e9c41310efa463 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Tue, 22 Oct 2024 19:57:54 -0700 Subject: [PATCH 37/57] Fixes --- addons/medical_status/XEH_PREP.hpp | 2 +- .../functions/fnc_getAllMedicationCount.sqf | 5 +++-- .../functions/fnc_getMedicationCount.sqf | 20 ++++++++++--------- addons/medical_treatment/XEH_PREP.hpp | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/addons/medical_status/XEH_PREP.hpp b/addons/medical_status/XEH_PREP.hpp index 30a9142565e..56572cd9ba5 100644 --- a/addons/medical_status/XEH_PREP.hpp +++ b/addons/medical_status/XEH_PREP.hpp @@ -5,8 +5,8 @@ PREP(getBloodLoss); PREP(getBloodPressure); PREP(getBloodVolumeChange); PREP(getCardiacOutput); -PREP(getMedicationCount); PREP(getAllMedicationCount); +PREP(getMedicationCount); PREP(handleKilled); PREP(handleKilledMission); PREP(hasStableVitals); diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf index 250f4958ae2..2c0adb5baf9 100644 --- a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -10,8 +10,9 @@ * * Return Value: * Array of medication counts : - * Dose Count - * Medication effectiveness (0-1) + * 0: Medication Name + * 1: Dose Count + * 2: Medication effectiveness (0-1) * * Example: * [player] call ace_medical_status_fnc_getAllMedicationCount diff --git a/addons/medical_status/functions/fnc_getMedicationCount.sqf b/addons/medical_status/functions/fnc_getMedicationCount.sqf index bdb0b529c3d..8b44dad4b30 100644 --- a/addons/medical_status/functions/fnc_getMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getMedicationCount.sqf @@ -9,9 +9,11 @@ * 1: Medication (not case sensitive) * 2: Get raw count (true) or effect ratio (false) (default: true) * - * Return Value: - * Dose Count - * Medication effectiveness (0-1) + * Returns Value: + * 0: Medication Name + * 1: Dose Count + * 2: Medication effectiveness (0-1) + * * * Example: * [player, "Epinephrine"] call ace_medical_status_fnc_getMedicationCount @@ -21,7 +23,7 @@ params ["_target", "_medication", ["_getCount", true]]; -private _return = 0; +private _effectivness = 0; private _medDose = 0; { _x params ["_xMed", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "", "", "", "_dose"]; @@ -29,15 +31,15 @@ private _medDose = 0; private _timeInSystem = CBA_missionTime - _timeAdded; _medDose = _medDose + _dose; if (_getCount) then { - // just return effective count, a medication will always start at 1 and only drop after reaching timeTilMaxEffect - _return = _return + linearConversion [_timeTillMaxEffect, _maxTimeInSystem, _timeInSystem, 1, 0, true]; + // just effectivness effective count, a medication will always start at 1 and only drop after reaching timeTilMaxEffect + _effectivness = _effectivness + linearConversion [_timeTillMaxEffect, _maxTimeInSystem, _timeInSystem, 1, 0, true]; } else { // as used in handleUnitVitals, a medication effectiveness will start low, ramp up to timeTillMaxEffect, and then drop off - _return = _return + (((_timeInSystem / _timeTillMaxEffect) ^ 2) min 1) * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem; + _effectivness = _effectivness + (((_timeInSystem / _timeTillMaxEffect) ^ 2) min 1) * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem; }; }; } forEach (_target getVariable [VAR_MEDICATIONS, []]); -TRACE_5("getMedicationCount",_target,_medication,_getCount,_return,_medDose); +TRACE_5("getMedicationCount",_target,_medication,_getCount,_effectivness,_medDose); -[_medication, _medDose, _return] +[_medication, _medDose, _effectivness] diff --git a/addons/medical_treatment/XEH_PREP.hpp b/addons/medical_treatment/XEH_PREP.hpp index f2910f657ae..d7165b59705 100644 --- a/addons/medical_treatment/XEH_PREP.hpp +++ b/addons/medical_treatment/XEH_PREP.hpp @@ -48,6 +48,7 @@ PREP(loadUnit); PREP(medication); PREP(medicationLocal); PREP(onMedicationUsage); +PREP(overDose); PREP(placeBodyBagInGrave); PREP(placeInBodyBag); PREP(placeInBodyBagOrGrave); @@ -67,4 +68,3 @@ PREP(treatmentFailure); PREP(treatmentSuccess); PREP(unloadUnit); PREP(useItem); -PREP(overDose); From 47c155f19330eafedc4703dd9fdbd5ff47e86fdf Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Wed, 23 Oct 2024 01:07:53 -0700 Subject: [PATCH 38/57] Update addons/medical_treatment/functions/fnc_overDose.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_treatment/functions/fnc_overDose.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index 8a2eed98976..e5027ea2615 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -18,7 +18,7 @@ params ["_unit", "_classname"]; -private _medicationConfig = configFile >> "ace_medical_treatment" >> "Medication"; +private _medicationConfig = configFile >> QUOTE(ADDON) >> "Medication"; private _onOverDose = getText (_medicationConfig >> "onOverDose"); if (isClass _medicationConfig) then { From b653251715345aafe6c9c4f8fa83015d883400b0 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Wed, 23 Oct 2024 01:16:01 -0700 Subject: [PATCH 39/57] Update fnc_overDose.sqf --- addons/medical_treatment/functions/fnc_overDose.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index e5027ea2615..b18cf2a3e3c 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -34,7 +34,7 @@ if (_onOverDose == "") exitWith { [QEGVAR(medical,CriticalVitals), _unit] call CBA_fnc_localEvent; }; -if (!isNil _onOverDose) then { +if (isNil _onOverDose) then { _onOverDose = compile _onOverDose; } else { _onOverDose = missionNamespace getVariable _onOverDose; From d0e5ab4130e822eb9e565711a926e224d74e222c Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:51:00 -0700 Subject: [PATCH 40/57] Update addons/medical_status/functions/fnc_addMedicationAdjustment.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_status/functions/fnc_addMedicationAdjustment.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf index 992e4773b52..6dd96252f32 100644 --- a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf +++ b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf @@ -17,7 +17,7 @@ * None * * Example: - * [player, "Morphine", 1, 120, 60, -10, 0.8, -10] call ace_medical_status_fnc_addMedicationAdjustment + * [player, "Morphine", 120, 60, -10, 0.8, -10, 1] call ace_medical_status_fnc_addMedicationAdjustment * * Public: No */ From 6f1a5d94c717b0d3707eaecd2a7454ac2ca68d4d Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:51:14 -0700 Subject: [PATCH 41/57] Update addons/medical_treatment/functions/fnc_overDose.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_treatment/functions/fnc_overDose.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index b18cf2a3e3c..9eff02ce6e8 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -13,6 +13,7 @@ * * Example: * [player, "morphine"] call ace_medical_treatment_fnc_overDose + * * Public: No */ From e21c4b90d45a08135f59300cc123ce293720d687 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:51:37 -0700 Subject: [PATCH 42/57] Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index c9662c92f32..fa394528ea9 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -6,7 +6,7 @@ * Arguments: * 0: The patient * 1: Medication Treatment classname - * 2: Incompatible medication > + * 2: Incompatible medication * * Return Value: * None From abe46c425c17b7e12f14d6e4ef38ec1cad3868de Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:56:48 -0700 Subject: [PATCH 43/57] Update addons/medical_status/functions/fnc_addMedicationAdjustment.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_status/functions/fnc_addMedicationAdjustment.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf index 6dd96252f32..b49da8cd131 100644 --- a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf +++ b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf @@ -5,7 +5,7 @@ * * Arguments: * 0: The Unit - * 1: Medication + * 1: Medication * 2: Time in system for the adjustment to reach its peak * 3: Duration the adjustment will have an effect * 4: Heart Rate Adjust From fd78fd7726e1bb5403932f7f01e2c62676894e47 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:57:09 -0700 Subject: [PATCH 44/57] Update addons/medical_status/functions/fnc_getMedicationCount.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_status/functions/fnc_getMedicationCount.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_status/functions/fnc_getMedicationCount.sqf b/addons/medical_status/functions/fnc_getMedicationCount.sqf index 8b44dad4b30..dfe08a2eea0 100644 --- a/addons/medical_status/functions/fnc_getMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getMedicationCount.sqf @@ -23,7 +23,7 @@ params ["_target", "_medication", ["_getCount", true]]; -private _effectivness = 0; +private _effectiveness = 0; private _medDose = 0; { _x params ["_xMed", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "", "", "", "_dose"]; From d951f223a715777f2d09115a9603d70416ad21af Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:01:14 -0700 Subject: [PATCH 45/57] Fixes --- addons/medical_status/XEH_PREP.hpp | 2 +- addons/medical_status/functions/fnc_getAllMedicationCount.sqf | 2 +- addons/medical_status/functions/fnc_getMedicationCount.sqf | 4 ++-- addons/medical_treatment/functions/fnc_overDose.sqf | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/medical_status/XEH_PREP.hpp b/addons/medical_status/XEH_PREP.hpp index 56572cd9ba5..967332da2e2 100644 --- a/addons/medical_status/XEH_PREP.hpp +++ b/addons/medical_status/XEH_PREP.hpp @@ -1,11 +1,11 @@ PREP(addInventoryActions); PREP(addMedicationAdjustment); PREP(adjustPainLevel); +PREP(getAllMedicationCount); PREP(getBloodLoss); PREP(getBloodPressure); PREP(getBloodVolumeChange); PREP(getCardiacOutput); -PREP(getAllMedicationCount); PREP(getMedicationCount); PREP(handleKilled); PREP(handleKilledMission); diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf index 2c0adb5baf9..5df0dcdb436 100644 --- a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -24,4 +24,4 @@ params ["_target", ["_getCount", true]]; private _medicationClasses = (_target getVariable [VAR_MEDICATIONS, []]) apply {_x select 0}; _medicationClasses = _medicationClasses arrayIntersect _medicationClasses; -_medicationClasses apply {[_target, _x, _getCount] call FUNC(getMedicationCount)} // return +_medicationClasses apply [_x] + ([_target, _x, _getCount] call FUNC(getMedicationCount)) // return diff --git a/addons/medical_status/functions/fnc_getMedicationCount.sqf b/addons/medical_status/functions/fnc_getMedicationCount.sqf index dfe08a2eea0..98378a52654 100644 --- a/addons/medical_status/functions/fnc_getMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getMedicationCount.sqf @@ -31,7 +31,7 @@ private _medDose = 0; private _timeInSystem = CBA_missionTime - _timeAdded; _medDose = _medDose + _dose; if (_getCount) then { - // just effectivness effective count, a medication will always start at 1 and only drop after reaching timeTilMaxEffect + // returns effective count, a medication will always start at 1 and only drop after reaching timeTilMaxEffect _effectivness = _effectivness + linearConversion [_timeTillMaxEffect, _maxTimeInSystem, _timeInSystem, 1, 0, true]; } else { // as used in handleUnitVitals, a medication effectiveness will start low, ramp up to timeTillMaxEffect, and then drop off @@ -42,4 +42,4 @@ private _medDose = 0; TRACE_5("getMedicationCount",_target,_medication,_getCount,_effectivness,_medDose); -[_medication, _medDose, _effectivness] +[_medDose, _effectivness] diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index 9eff02ce6e8..a300ea6671b 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -6,7 +6,6 @@ * Arguments: * 0: The patient * 1: Medication classname - * 2: Incompatible medication * * Return Value: * None From 91a36ae1ef51fa26c1d7572f91aba26ed8835eff Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:10:23 -0700 Subject: [PATCH 46/57] Moving med settings to different PR --- .../ACE_Medical_Treatment_Actions.hpp | 4 --- addons/medical_treatment/initSettings.inc.sqf | 36 ------------------- 2 files changed, 40 deletions(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp index b9d376b60e4..4553bd149eb 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp @@ -130,18 +130,14 @@ class GVAR(actions) { class Adenosine: Morphine { displayName = CSTRING(Inject_Adenosine); displayNameProgress = CSTRING(Injecting_Adenosine); - medicRequired = QGVAR(medicAdenosine); condition = QGVAR(advancedMedication); items[] = {"ACE_adenosine"}; - treatmentLocations = QGVAR(locationAdenosine); litter[] = {{"ACE_MedicalLitter_adenosine"}}; }; class Epinephrine: Morphine { displayName = CSTRING(Inject_Epinephrine); displayNameProgress = CSTRING(Injecting_Epinephrine); - medicRequired = QGVAR(medicEpinephrine); items[] = {"ACE_epinephrine"}; - treatmentLocations = QGVAR(locationEpinephrine); litter[] = {{"ACE_MedicalLitter_epinephrine"}}; }; diff --git a/addons/medical_treatment/initSettings.inc.sqf b/addons/medical_treatment/initSettings.inc.sqf index 00bef17240f..7f0fc06764c 100644 --- a/addons/medical_treatment/initSettings.inc.sqf +++ b/addons/medical_treatment/initSettings.inc.sqf @@ -154,42 +154,6 @@ true ] call CBA_fnc_addSetting; -[ - QGVAR(medicMorphine), - "LIST", - [LSTRING(MedicMorphine_DisplayName), LSTRING(MedicMorphine_Description)], - [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], - [[0, 1, 2], [LSTRING(Anyone), LSTRING(Medics), LSTRING(Doctors)], 0], - true -] call CBA_fnc_addSetting; - -[ - QGVAR(locationMorphine), - "LIST", - [LSTRING(LocationMorphine_DisplayName), LSTRING(LocationMorphine_Description)], - [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], - [[0, 1, 2, 3, 4], [ELSTRING(common,Anywhere), ELSTRING(common,Vehicle), LSTRING(MedicalFacilities), LSTRING(VehiclesAndFacilities), ELSTRING(common,Disabled)], 0], - true -] call CBA_fnc_addSetting; - -[ - QGVAR(medicAdenosine), - "LIST", - [LSTRING(MedicAdenosine_DisplayName), LSTRING(MedicAdenosine_Description)], - [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], - [[0, 1, 2], [LSTRING(Anyone), LSTRING(Medics), LSTRING(Doctors)], 0], - true -] call CBA_fnc_addSetting; - -[ - QGVAR(locationAdenosine), - "LIST", - [LSTRING(LocationAdenosine_DisplayName), LSTRING(LocationAdenosine_Description)], - [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], - [[0, 1, 2, 3, 4], [ELSTRING(common,Anywhere), ELSTRING(common,Vehicle), LSTRING(MedicalFacilities), LSTRING(VehiclesAndFacilities), ELSTRING(common,Disabled)], 0], - true -] call CBA_fnc_addSetting; - [ QGVAR(medicPAK), "LIST", From 5ff69a799414bf6d108e546ddebe3d4015992e1c Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:12:02 -0700 Subject: [PATCH 47/57] oopps --- addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp index 4553bd149eb..4058132e3db 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp @@ -114,12 +114,10 @@ class GVAR(actions) { class Morphine: FieldDressing { displayName = CSTRING(Inject_Morphine); displayNameProgress = CSTRING(Injecting_Morphine); - medicRequired = QGVAR(medicMorphine); icon = QPATHTOEF(medical_gui,ui\auto_injector.paa); allowedSelections[] = {"LeftArm", "RightArm", "LeftLeg", "RightLeg"}; category = "medication"; items[] = {"ACE_morphine"}; - treatmentLocations = QGVAR(locationMorphine); condition = ""; treatmentTime = QGVAR(treatmentTimeAutoinjector); callbackSuccess = QFUNC(medication); @@ -137,7 +135,9 @@ class GVAR(actions) { class Epinephrine: Morphine { displayName = CSTRING(Inject_Epinephrine); displayNameProgress = CSTRING(Injecting_Epinephrine); + medicRequired = QGVAR(medicEpinephrine); items[] = {"ACE_epinephrine"}; + treatmentLocations = QGVAR(locationEpinephrine); litter[] = {{"ACE_MedicalLitter_epinephrine"}}; }; From f69227172630a37abbcbe1c3d0fb024f93635e39 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Wed, 23 Oct 2024 21:55:40 -0700 Subject: [PATCH 48/57] Stringtable --- addons/medical_treatment/stringtable.xml | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index 8051b551fdb..b0d140d8255 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -546,30 +546,6 @@ Controla donde puede sr usada la Epinefrina. 에피네프린을 사용할 수 있는 장소를 정합니다. - - Allow Morphine - - - Training level required to use Morphine. - - - Locations Morphine - - - Controls where Morphine can be used. - - - Allow Adenosine - - - Training level required to use Adenosine. - - - Locations Adenosine - - - Controls where Adenosine can be used. - Allow PAK Доступ к Аптечке From 876485ddb31eca92e481f6a934b45c3e65dc28fe Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Thu, 24 Oct 2024 07:59:11 +0200 Subject: [PATCH 49/57] Misc fixes & cleanup --- .../functions/fnc_getAllMedicationCount.sqf | 2 +- .../functions/fnc_getMedicationCount.sqf | 17 ++++++++--------- .../functions/fnc_overDose.sqf | 6 +++--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf index 5df0dcdb436..2ee4989c2c8 100644 --- a/addons/medical_status/functions/fnc_getAllMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getAllMedicationCount.sqf @@ -24,4 +24,4 @@ params ["_target", ["_getCount", true]]; private _medicationClasses = (_target getVariable [VAR_MEDICATIONS, []]) apply {_x select 0}; _medicationClasses = _medicationClasses arrayIntersect _medicationClasses; -_medicationClasses apply [_x] + ([_target, _x, _getCount] call FUNC(getMedicationCount)) // return +_medicationClasses apply {[_x] + ([_target, _x, _getCount] call FUNC(getMedicationCount))} // return diff --git a/addons/medical_status/functions/fnc_getMedicationCount.sqf b/addons/medical_status/functions/fnc_getMedicationCount.sqf index 98378a52654..85b14982e39 100644 --- a/addons/medical_status/functions/fnc_getMedicationCount.sqf +++ b/addons/medical_status/functions/fnc_getMedicationCount.sqf @@ -7,12 +7,11 @@ * Arguments: * 0: The patient * 1: Medication (not case sensitive) - * 2: Get raw count (true) or effect ratio (false) (default: true) + * 2: Get raw count (true) or effect ratio (false) (default: true) * * Returns Value: - * 0: Medication Name - * 1: Dose Count - * 2: Medication effectiveness (0-1) + * 0: Dose Count + * 1: Medication effectiveness (0-1) * * * Example: @@ -30,16 +29,16 @@ private _medDose = 0; if (_xMed == _medication) then { private _timeInSystem = CBA_missionTime - _timeAdded; _medDose = _medDose + _dose; - if (_getCount) then { + _effectiveness = if (_getCount) then { // returns effective count, a medication will always start at 1 and only drop after reaching timeTilMaxEffect - _effectivness = _effectivness + linearConversion [_timeTillMaxEffect, _maxTimeInSystem, _timeInSystem, 1, 0, true]; + _effectiveness + linearConversion [_timeTillMaxEffect, _maxTimeInSystem, _timeInSystem, 1, 0, true] } else { // as used in handleUnitVitals, a medication effectiveness will start low, ramp up to timeTillMaxEffect, and then drop off - _effectivness = _effectivness + (((_timeInSystem / _timeTillMaxEffect) ^ 2) min 1) * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem; + _effectiveness + (((_timeInSystem / _timeTillMaxEffect) ^ 2) min 1) * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem }; }; } forEach (_target getVariable [VAR_MEDICATIONS, []]); -TRACE_5("getMedicationCount",_target,_medication,_getCount,_effectivness,_medDose); +TRACE_5("getMedicationCount",_target,_medication,_getCount,_effectiveness,_medDose); -[_medDose, _effectivness] +[_medDose, _effectiveness] // return diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index a300ea6671b..a1900899c22 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -4,7 +4,7 @@ * Handles the overdose effects of a medication. * * Arguments: - * 0: The patient + * 0: Patient * 1: Medication classname * * Return Value: @@ -23,8 +23,8 @@ private _onOverDose = getText (_medicationConfig >> "onOverDose"); if (isClass _medicationConfig) then { _medicationConfig = _medicationConfig >> _classname; - if (isText (_medicationConfig >> "onOverDose")) then { - _onOverDose = getText (_medicationConfig >> "onOverDose"); + if (isText (_medicationConfig >> "onOverDose")) then { + _onOverDose = getText (_medicationConfig >> "onOverDose"); }; }; TRACE_2("overdose",_classname,_onOverDose); From bb3da049efb4880ad1c5335716c30e3796305b61 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Thu, 24 Oct 2024 23:28:11 +0200 Subject: [PATCH 50/57] Update fnc_onMedicationUsage.sqf --- .../medical_treatment/functions/fnc_onMedicationUsage.sqf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index fa394528ea9..d4772fac152 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -4,7 +4,7 @@ * Handles the medication given to a patient. * * Arguments: - * 0: The patient + * 0: Patient * 1: Medication Treatment classname * 2: Incompatible medication * @@ -24,8 +24,9 @@ TRACE_3("onMedicationUsage",_target,_className,_incompatibleMedication); private _defaultConfig = configFile >> QUOTE(ADDON) >> "Medication"; private _medicationConfig = _defaultConfig >> _classname; private _maxDose = GET_NUMBER(_medicationConfig >> "maxDose",getNumber (_defaultConfig >> "maxDose")); -private _maxDoseDeviation = GET_NUMBER(_medicationConfig >> "maxDoseDeviation",getNumber (_defaultConfig >> "maxDoseDeviation")); + if (_maxDose > 0) then { + private _maxDoseDeviation = GET_NUMBER(_medicationConfig >> "maxDoseDeviation",getNumber (_defaultConfig >> "maxDoseDeviation")); private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount) select 1; // Because both {floor random 0} and {floor random 1} return 0 if (_maxDoseDeviation > 0) then { @@ -42,7 +43,7 @@ if (_maxDose > 0) then { { _x params ["_xMed", "_xLimit"]; private _inSystem = [_target, _xMed] call EFUNC(medical_status,getMedicationCount); - if (_inSystem> _xLimit) then { + if (_inSystem > _xLimit) then { [_target, _classname] call FUNC(overDose); }; } forEach _incompatibleMedication; From 4cfbc8a9c2b61e5f7f0b1e607d1a0cdff1c1865d Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Thu, 24 Oct 2024 23:29:34 +0200 Subject: [PATCH 51/57] Fix nonsensical code --- addons/medical_treatment/functions/fnc_overDose.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index a1900899c22..2a4701284c7 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -34,10 +34,10 @@ if (_onOverDose == "") exitWith { [QEGVAR(medical,CriticalVitals), _unit] call CBA_fnc_localEvent; }; -if (isNil _onOverDose) then { - _onOverDose = compile _onOverDose; +_onOverDose = if (missionNamespace isNil _onOverDose) then { + compile _onOverDose } else { - _onOverDose = missionNamespace getVariable _onOverDose; + missionNamespace getVariable _onOverDose }; [_target, _className] call _onOverDose From 7f2fa8a9c86dd277a2e2cde0ef1f26d4f7e66c7f Mon Sep 17 00:00:00 2001 From: LinkIsGrim <69561145+LinkIsGrim@users.noreply.github.com> Date: Thu, 24 Oct 2024 21:17:57 -0300 Subject: [PATCH 52/57] add API event and doc --- .../functions/fnc_onMedicationUsage.sqf | 9 +++++---- addons/medical_treatment/functions/fnc_overDose.sqf | 11 ++++++++--- docs/wiki/framework/events-framework.md | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index d4772fac152..8ea4827543e 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -6,7 +6,7 @@ * Arguments: * 0: Patient * 1: Medication Treatment classname - * 2: Incompatible medication + * 2: Incompatible medication > * * Return Value: * None @@ -33,9 +33,10 @@ if (_maxDose > 0) then { _maxDoseDeviation = _maxDoseDeviation + 1; }; - if (_currentDose > _maxDose + (floor random _maxDoseDeviation)) then { + private _limit = _maxDose + (floor random _maxDoseDeviation); + if (_currentDose > _limit) then { TRACE_1("exceeded max dose",_currentDose); - [_target, _classname] call FUNC(overDose); + [_target, _classname, _currentDose, _limit, _classname] call FUNC(overDose); }; }; @@ -44,6 +45,6 @@ if (_maxDose > 0) then { _x params ["_xMed", "_xLimit"]; private _inSystem = [_target, _xMed] call EFUNC(medical_status,getMedicationCount); if (_inSystem > _xLimit) then { - [_target, _classname] call FUNC(overDose); + [_target, _classname, _inSystem, _xLimit, _xMed] call FUNC(overDose); }; } forEach _incompatibleMedication; diff --git a/addons/medical_treatment/functions/fnc_overDose.sqf b/addons/medical_treatment/functions/fnc_overDose.sqf index 2a4701284c7..d7c03f8269d 100644 --- a/addons/medical_treatment/functions/fnc_overDose.sqf +++ b/addons/medical_treatment/functions/fnc_overDose.sqf @@ -6,17 +6,20 @@ * Arguments: * 0: Patient * 1: Medication classname + * 2: Medication dosage + * 3: Overdose threshold + * 4: Incompatible medication that caused overdose (can be the medication itself) (default: "") * * Return Value: * None * * Example: - * [player, "morphine"] call ace_medical_treatment_fnc_overDose + * [player, "morphine", 5, 3, "morphine"] call ace_medical_treatment_fnc_overDose * * Public: No */ -params ["_unit", "_classname"]; +params ["_unit", "_classname", "_dose", "_limit", "_incompatibleMed"]; private _medicationConfig = configFile >> QUOTE(ADDON) >> "Medication"; private _onOverDose = getText (_medicationConfig >> "onOverDose"); @@ -29,6 +32,8 @@ if (isClass _medicationConfig) then { }; TRACE_2("overdose",_classname,_onOverDose); +[QEGVAR(medical,overdose), [_unit, _classname, _dose, _limit, _incompatibleMed]] call CBA_fnc_localEvent; + if (_onOverDose == "") exitWith { TRACE_1("CriticalVitals Event",_unit); [QEGVAR(medical,CriticalVitals), _unit] call CBA_fnc_localEvent; @@ -40,4 +45,4 @@ _onOverDose = if (missionNamespace isNil _onOverDose) then { missionNamespace getVariable _onOverDose }; -[_target, _className] call _onOverDose +[_unit, _classname, _dose, _limit, _incompatibleMed] call _onOverDose diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index bcbbb6283ef..8d1940a1213 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -45,6 +45,7 @@ The vehicle events will also have the following local variables available `_gunn |`ace_treatmentFailed` | [_caller, _target, _selectionName, _className, _itemUser, _usedItem, _createLitter] | Local | Listen | Treatment action has been interrupted (local on the _caller) | |`ace_medical_handleUnitVitals` | [_unit, _deltaT] | Local | Listen | Vitals update ran for unit, _deltaT is the time elapsed since the previous vitals update (local to _unit) | |`ace_medical_treatment_bandaged` | [_medic, _patient, _bodyPart, _className, _itemUser, _usedItem, _createLitter, _bandageEffectiveness] | Local | Listen | _medic has bandaged _patient, the array can be modified to change treatment parameters (local to _medic) | +|`ace_medical_overdose` | [_unit, _medication, _medicationDose, _overdoseThreshold, _incompatibleMed] | Local | Listen | _unit has overdosed on _medication by _overdoseThreshold - _medicationDose, overdoseThreshold was determined by _incompatibleMed (can be _medication itself or mixed incompatible medication) | ### 2.3 Interaction Menu (`ace_interact_menu`) MenuType: 0 = Interaction, 1 = Self Interaction From ec44aab17c12737d2e45e42bb702037b7c37c452 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 26 Oct 2024 04:18:49 -0700 Subject: [PATCH 53/57] Misc fixes --- addons/medical/dev/watchVariable.sqf | 4 ++-- .../functions/fnc_handleStateUnconscious.sqf | 2 +- addons/medical_treatment/ACE_Medical_Treatment.hpp | 2 ++ addons/medical_treatment/functions/fnc_onMedicationUsage.sqf | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/medical/dev/watchVariable.sqf b/addons/medical/dev/watchVariable.sqf index a0e064595ab..bd97e5b3057 100644 --- a/addons/medical/dev/watchVariable.sqf +++ b/addons/medical/dev/watchVariable.sqf @@ -150,8 +150,8 @@ GVAR(dev_watchVariableRunning) = true; }; _return pushBack format ["Adjusts: [HR %1][PS %2][PR %3]", _hrTargetAdjustment toFixed 2, _painSupressAdjustment toFixed 2, _peripheralResistanceAdjustment toFixed 2]; { - private _medicationCount = [_unit, _x, true] call EFUNC(medical_status,getMedicationCount); - private _medicationEffectiveness = [_unit, _x, false] call EFUNC(medical_status,getMedicationCount); + private _medicationCount = ([_unit, _x, true] call EFUNC(medical_status,getMedicationCount)) select 0; + private _medicationEffectiveness = ([_unit, _x, false] call EFUNC(medical_status,getMedicationCount)) select 1; _return pushBack format ["-%1: C: %2 - E: %3", _x, _medicationCount toFixed 2, _medicationEffectiveness toFixed 2]; } forEach _uniqueMedications; _return pushBack "------- Medications Raw: -------"; diff --git a/addons/medical_statemachine/functions/fnc_handleStateUnconscious.sqf b/addons/medical_statemachine/functions/fnc_handleStateUnconscious.sqf index aa93d449329..a9a20ec91c7 100644 --- a/addons/medical_statemachine/functions/fnc_handleStateUnconscious.sqf +++ b/addons/medical_statemachine/functions/fnc_handleStateUnconscious.sqf @@ -36,7 +36,7 @@ if (EGVAR(medical,spontaneousWakeUpChance) > 0) then { private _wakeUpCheckInterval = SPONTANEOUS_WAKE_UP_INTERVAL; if (EGVAR(medical,spontaneousWakeUpEpinephrineBoost) > 1) then { - private _epiEffectiveness = [_unit, "Epinephrine", false] call EFUNC(medical_status,getMedicationCount); + private _epiEffectiveness = ([_unit, "Epinephrine", false] call EFUNC(medical_status,getMedicationCount)) select 1; _wakeUpCheckInterval = _wakeUpCheckInterval * linearConversion [0, 1, _epiEffectiveness, 1, 1 / EGVAR(medical,spontaneousWakeUpEpinephrineBoost), true]; TRACE_2("epiBoost",_epiEffectiveness,_wakeUpCheckInterval); }; diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index 144102efff2..97d50c5726f 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -570,6 +570,8 @@ class ADDON { // The number of doses over maxDose where there is a chance to overdose. // Example with maxDose = 4 and maxDoseDeviation = 2: Dose 4: Safe | Dose 5 and 6: Possible overdose | Dose 7: Guaranteed overdose maxDoseDeviation = 2; + // The dose of the medication, to allow for multiple dose types of the same medication + dose = 1; // Function to execute upon overdose. Arguments passed to call back are 0: unit , 1: medicationClassName onOverDose = ""; // The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. For liquids, it corresponds to the informal concept of "thickness". This value will increase/decrease the viscoty of the blood with the percentage given. Where 100 = max. Using the minus will decrease viscosity diff --git a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf index 8ea4827543e..668e353f60c 100644 --- a/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical_treatment/functions/fnc_onMedicationUsage.sqf @@ -27,7 +27,7 @@ private _maxDose = GET_NUMBER(_medicationConfig >> "maxDose",getNumber if (_maxDose > 0) then { private _maxDoseDeviation = GET_NUMBER(_medicationConfig >> "maxDoseDeviation",getNumber (_defaultConfig >> "maxDoseDeviation")); - private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount) select 1; + private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount) select 0; // Because both {floor random 0} and {floor random 1} return 0 if (_maxDoseDeviation > 0) then { _maxDoseDeviation = _maxDoseDeviation + 1; @@ -43,7 +43,7 @@ if (_maxDose > 0) then { // Check incompatible medication (format [med,limit]) { _x params ["_xMed", "_xLimit"]; - private _inSystem = [_target, _xMed] call EFUNC(medical_status,getMedicationCount); + private _inSystem = ([_target, _xMed] call EFUNC(medical_status,getMedicationCount)) select 0; if (_inSystem > _xLimit) then { [_target, _classname, _inSystem, _xLimit, _xMed] call FUNC(overDose); }; From de9ac5d427c3d0bb9894ec2006439d30518859fa Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 26 Oct 2024 14:39:15 +0200 Subject: [PATCH 54/57] Update ACE_Medical_Treatment.hpp --- addons/medical_treatment/ACE_Medical_Treatment.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index 97d50c5726f..348d435be11 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -572,7 +572,7 @@ class ADDON { maxDoseDeviation = 2; // The dose of the medication, to allow for multiple dose types of the same medication dose = 1; - // Function to execute upon overdose. Arguments passed to call back are 0: unit , 1: medicationClassName + // Function to execute upon overdose. Arguments passed to call back are 0: Patient , 1: Medication classname , 2: Medication dosage , 3: Overdose threshold , 4: Incompatible medication that caused overdose (can be the medication itself) (default: "") onOverDose = ""; // The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. For liquids, it corresponds to the informal concept of "thickness". This value will increase/decrease the viscoty of the blood with the percentage given. Where 100 = max. Using the minus will decrease viscosity viscosityChange = 0; From dd81004ffb33c342559e90976077538504519b53 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 26 Oct 2024 14:42:33 +0200 Subject: [PATCH 55/57] Update watchVariable.sqf --- addons/medical/dev/watchVariable.sqf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/medical/dev/watchVariable.sqf b/addons/medical/dev/watchVariable.sqf index bd97e5b3057..7684c1a17d9 100644 --- a/addons/medical/dev/watchVariable.sqf +++ b/addons/medical/dev/watchVariable.sqf @@ -150,9 +150,8 @@ GVAR(dev_watchVariableRunning) = true; }; _return pushBack format ["Adjusts: [HR %1][PS %2][PR %3]", _hrTargetAdjustment toFixed 2, _painSupressAdjustment toFixed 2, _peripheralResistanceAdjustment toFixed 2]; { - private _medicationCount = ([_unit, _x, true] call EFUNC(medical_status,getMedicationCount)) select 0; - private _medicationEffectiveness = ([_unit, _x, false] call EFUNC(medical_status,getMedicationCount)) select 1; - _return pushBack format ["-%1: C: %2 - E: %3", _x, _medicationCount toFixed 2, _medicationEffectiveness toFixed 2]; + ([_unit, _x, false] call EFUNC(medical_status,getMedicationCount)) params ["_medicationDose", "_medicationEffectiveness"]; + _return pushBack format ["-%1: D: %2 - E: %3", _x, _medicationDose toFixed 2, _medicationEffectiveness toFixed 2]; } forEach _uniqueMedications; _return pushBack "------- Medications Raw: -------"; _return append _rawMedications; From 88a17c7a3ef25fd617a24423f38b7a8cc8e59750 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sun, 3 Nov 2024 10:22:26 -0800 Subject: [PATCH 56/57] Update addons/medical_treatment/ACE_Medical_Treatment.hpp Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_treatment/ACE_Medical_Treatment.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index 348d435be11..bbffd114e67 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -570,7 +570,7 @@ class ADDON { // The number of doses over maxDose where there is a chance to overdose. // Example with maxDose = 4 and maxDoseDeviation = 2: Dose 4: Safe | Dose 5 and 6: Possible overdose | Dose 7: Guaranteed overdose maxDoseDeviation = 2; - // The dose of the medication, to allow for multiple dose types of the same medication + // The dose of the medication, to allow for different dose amounts of the same medication dose = 1; // Function to execute upon overdose. Arguments passed to call back are 0: Patient , 1: Medication classname , 2: Medication dosage , 3: Overdose threshold , 4: Incompatible medication that caused overdose (can be the medication itself) (default: "") onOverDose = ""; From 38cd859d7f5c13842903f5d60ea942f16a6fd83d Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sun, 3 Nov 2024 10:24:18 -0800 Subject: [PATCH 57/57] Update ACE_Medical_Treatment.hpp --- addons/medical_treatment/ACE_Medical_Treatment.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index bbffd114e67..0ac0c454a3b 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -565,7 +565,7 @@ class ADDON { timeInSystem = 120; // How long until the maximum effect is reached timeTillMaxEffect = 30; - // How many of this type of medication can be in the system before the patient can possibly overdose? + // How many doses of this medication can be in the system before the patient can possibly overdose? maxDose = 4; // The number of doses over maxDose where there is a chance to overdose. // Example with maxDose = 4 and maxDoseDeviation = 2: Dose 4: Safe | Dose 5 and 6: Possible overdose | Dose 7: Guaranteed overdose