Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical - Add medication dosage support & improve overdose #10393

Merged
merged 60 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
28a1aa4
Initial Commit
Cplhardcore Oct 11, 2024
e8551a1
Small fix to get all medications
Cplhardcore Oct 11, 2024
d8f0781
Update launch.toml
Cplhardcore Oct 11, 2024
c3af223
Small fix and removal of medication dose variables
Cplhardcore Oct 11, 2024
d6de590
Deleted old entries from stringtable
Cplhardcore Oct 11, 2024
42e2097
Update addons/medical_treatment/script_component.hpp
Cplhardcore Oct 11, 2024
e22e06b
Fixed newline
Cplhardcore Oct 11, 2024
eaf2e3f
Merge branch 'Overdose-Rework' of https://github.com/Cplhardcore/ACE3…
Cplhardcore Oct 11, 2024
fff711a
Changes for backwards compatibility
Cplhardcore Oct 11, 2024
70f8f0d
Update addons/medical_status/functions/fnc_addMedicationAdjustment.sqf
Cplhardcore Oct 12, 2024
8c5716b
Update addons/medical_status/functions/fnc_getAllMedicationCount.sqf
Cplhardcore Oct 12, 2024
684d8ec
Update addons/medical_status/functions/fnc_getAllMedicationCount.sqf
Cplhardcore Oct 12, 2024
2e22795
Fixes, maybe?
Cplhardcore Oct 12, 2024
40abd2a
Overdose fixes
Cplhardcore Oct 12, 2024
7c895ba
trailling comma
LinkIsGrim Oct 12, 2024
768f9ab
Update addons/medical_vitals/functions/fnc_handleUnitVitals.sqf
LinkIsGrim Oct 12, 2024
8216db1
aa
Cplhardcore Oct 13, 2024
b5c3c5d
there we go
Cplhardcore Oct 13, 2024
8443181
Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf
Cplhardcore Oct 13, 2024
9abb145
Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf
Cplhardcore Oct 13, 2024
01504ea
Update XEH_PREP.hpp
Cplhardcore Oct 13, 2024
eaa8702
Merge branch 'Overdose-Rework' of https://github.com/Cplhardcore/ACE3…
Cplhardcore Oct 13, 2024
2ab49a4
Update addons/medical_status/functions/fnc_getAllMedicationCount.sqf
Cplhardcore Oct 13, 2024
594d02b
Grim Misc Fixes
Cplhardcore Oct 13, 2024
194bf50
Merge branch 'Overdose-Rework' of https://github.com/Cplhardcore/ACE3…
Cplhardcore Oct 13, 2024
8e916cd
Remove debug
Cplhardcore Oct 13, 2024
d0a14d8
Small fixes
Cplhardcore Oct 13, 2024
5283456
newline
LinkIsGrim Oct 19, 2024
383a87b
headers
LinkIsGrim Oct 19, 2024
90dbb85
code cleanup
LinkIsGrim Oct 19, 2024
522a496
more headers
LinkIsGrim Oct 19, 2024
a5b6522
drop unneeded _dose
LinkIsGrim Oct 19, 2024
7703596
last header
LinkIsGrim Oct 19, 2024
7e1e45f
fix getting overdose func/code
LinkIsGrim Oct 19, 2024
85a5105
whitespace
LinkIsGrim Oct 19, 2024
31afab7
now the last header
LinkIsGrim Oct 19, 2024
b6d1635
Update addons/medical_treatment/functions/fnc_overDose.sqf
Cplhardcore Oct 19, 2024
cc0f116
fix compiling nil
LinkIsGrim Oct 20, 2024
0898ae9
Update addons/medical_status/functions/fnc_addMedicationAdjustment.sqf
Cplhardcore Oct 23, 2024
8453797
Fixes
Cplhardcore Oct 23, 2024
47c155f
Update addons/medical_treatment/functions/fnc_overDose.sqf
Cplhardcore Oct 23, 2024
b653251
Update fnc_overDose.sqf
Cplhardcore Oct 23, 2024
d0e5ab4
Update addons/medical_status/functions/fnc_addMedicationAdjustment.sqf
Cplhardcore Oct 24, 2024
6f1a5d9
Update addons/medical_treatment/functions/fnc_overDose.sqf
Cplhardcore Oct 24, 2024
e21c4b9
Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf
Cplhardcore Oct 24, 2024
abe46c4
Update addons/medical_status/functions/fnc_addMedicationAdjustment.sqf
Cplhardcore Oct 24, 2024
fd78fd7
Update addons/medical_status/functions/fnc_getMedicationCount.sqf
Cplhardcore Oct 24, 2024
d951f22
Fixes
Cplhardcore Oct 24, 2024
91a36ae
Moving med settings to different PR
Cplhardcore Oct 24, 2024
5ff69a7
oopps
Cplhardcore Oct 24, 2024
f692271
Stringtable
Cplhardcore Oct 24, 2024
876485d
Misc fixes & cleanup
johnb432 Oct 24, 2024
bb3da04
Update fnc_onMedicationUsage.sqf
johnb432 Oct 24, 2024
4cfbc8a
Fix nonsensical code
johnb432 Oct 24, 2024
7f2fa8a
add API event and doc
LinkIsGrim Oct 25, 2024
ec44aab
Misc fixes
Cplhardcore Oct 26, 2024
de9ac5d
Update ACE_Medical_Treatment.hpp
johnb432 Oct 26, 2024
dd81004
Update watchVariable.sqf
johnb432 Oct 26, 2024
88a17c7
Update addons/medical_treatment/ACE_Medical_Treatment.hpp
Cplhardcore Nov 3, 2024
38cd859
Update ACE_Medical_Treatment.hpp
Cplhardcore Nov 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/medical_status/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PREP(getBloodLoss);
PREP(getBloodPressure);
PREP(getBloodVolumeChange);
PREP(getCardiacOutput);
PREP(getAllMedicationCount);
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
PREP(getMedicationCount);
PREP(handleKilled);
PREP(handleKilledMission);
Expand Down
14 changes: 7 additions & 7 deletions addons/medical_status/functions/fnc_addMedicationAdjustment.sqf
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut, PabstMirror
* Author: BaerMitUmlaut, PabstMirror, Cplhardcore
* Adds a medication and it's effects
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Medication <STRING>
* 1: Medication <STRING>
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
* 2: Time in system for the adjustment to reach its peak <NUMBER>
* 3: Duration the adjustment will have an effect <NUMBER>
* 4: Heart Rate Adjust <NUMBER>
* 5: Pain Suppress Adjust <NUMBER>
* 6: Flow Adjust <NUMBER>
* 7: Dose of medication <NUMBER>
*
* 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
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
*
* Public: No
*/
params ["_unit", "_medication", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"];
TRACE_7("addMedicationAdjustment",_unit,_medication,_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;


private _adjustments = _unit getVariable [VAR_MEDICATIONS, []];

_adjustments pushBack [_medication, CBA_missionTime, _timeToMaxEffect, _maxTimeInSystem, _hrAdjust, _painAdjust, _flowAdjust];

_adjustments pushBack [_medication, CBA_missionTime, _timeToMaxEffect, _maxTimeInSystem, _hrAdjust, _painAdjust, _flowAdjust, _dose];
_unit setVariable [VAR_MEDICATIONS, _adjustments, true];
27 changes: 27 additions & 0 deletions addons/medical_status/functions/fnc_getAllMedicationCount.sqf
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "..\script_component.hpp"
/*
* 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)
*
* Arguments:
* 0: The patient <OBJECT>
* 1: Get raw count (true) or effect ratio (false) <BOOL> (default: true)
*
* Return Value:
* Array of medication counts <ARRAY of ARRAY>:
* 0: Medication Name <String>
* 1: Dose Count <NUMBER>
* 2: Medication effectiveness (0-1) <NUMBER>
*
* Example:
* [player] call ace_medical_status_fnc_getAllMedicationCount
*
* Public: Yes
*/

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
26 changes: 16 additions & 10 deletions addons/medical_status/functions/fnc_getMedicationCount.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* 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)
*
Expand All @@ -9,8 +9,11 @@
* 1: Medication (not case sensitive) <STRING>
* 2: Get raw count (true) or effect ratio (false) <BOOL>(default: true)
*
* Return Value:
* Medication count (float) <NUMBER>
* Returns Value:
* 0: Medication Name <String>
* 1: Dose Count <NUMBER>
* 2: Medication effectiveness (0-1) <NUMBER>
*
*
* Example:
* [player, "Epinephrine"] call ace_medical_status_fnc_getMedicationCount
Expand All @@ -20,20 +23,23 @@

params ["_target", "_medication", ["_getCount", true]];

private _return = 0;
private _effectivness = 0;
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
private _medDose = 0;
{
_x params ["_xMed", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem"];
_x params ["_xMed", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "", "", "", "_dose"];
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];
// just effectivness effective count, a medication will always start at 1 and only drop after reaching timeTilMaxEffect
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
_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_4("getMedicationCount",_target,_medication,_getCount,_return);
_return
TRACE_5("getMedicationCount",_target,_medication,_getCount,_effectivness,_medDose);

[_medication, _medDose, _effectivness]
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions addons/medical_treatment/ACE_Medical_Treatment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ class ADDON {
timeInSystem = 1800;
timeTillMaxEffect = 30;
maxDose = 4;
dose = 1;
incompatibleMedication[] = {};
viscosityChange = -10;
};
Expand All @@ -595,6 +596,7 @@ class ADDON {
timeInSystem = 120;
timeTillMaxEffect = 10;
maxDose = 9;
dose = 1;
incompatibleMedication[] = {};
};
class Adenosine {
Expand All @@ -605,6 +607,7 @@ class ADDON {
timeInSystem = 120;
timeTillMaxEffect = 15;
maxDose = 5;
dose = 1;
incompatibleMedication[] = {};
};
class PainKillers {
Expand All @@ -615,6 +618,7 @@ class ADDON {
timeInSystem = 420;
timeTillMaxEffect = 60;
maxDose = 5;
dose = 1;
incompatibleMedication[] = {};
viscosityChange = 5;
};
Expand Down
4 changes: 4 additions & 0 deletions addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions addons/medical_treatment/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ PREP(loadUnit);
PREP(medication);
PREP(medicationLocal);
PREP(onMedicationUsage);
PREP(overDose);
PREP(placeBodyBagInGrave);
PREP(placeInBodyBag);
PREP(placeInBodyBagOrGrave);
Expand Down
9 changes: 4 additions & 5 deletions addons/medical_treatment/functions/fnc_medicationLocal.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "..\script_component.hpp"
/*
* Author: Glowbal, mharis001
* Author: Glowbal, mharis001, Cplhardcore
* Local callback for administering medication to a patient.
*
* Arguments:
Expand Down Expand Up @@ -65,13 +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 _maxDose = GET_NUMBER(_medicationConfig >> "maxDose",getNumber (_defaultConfig >> "maxDose"));
private _maxDoseDeviation = GET_NUMBER(_medicationConfig >> "maxDoseDeviation",getNumber (_defaultConfig >> "maxDoseDeviation"));
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));
Expand All @@ -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, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange, _dose] call EFUNC(medical_status,addMedicationAdjustment);

// Check for medication compatiblity
[_patient, _className, _maxDose, _maxDoseDeviation, _incompatibleMedication] call FUNC(onMedicationUsage);
[_patient, _className, _incompatibleMedication] call FUNC(onMedicationUsage);
44 changes: 12 additions & 32 deletions addons/medical_treatment/functions/fnc_onMedicationUsage.sqf
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
#include "..\script_component.hpp"
/*
* Author: Glowbal
* Author: Glowbal, Cplhardcore
* Handles the medication given to a patient.
*
* Arguments:
* 0: The patient <OBJECT>
* 1: Medication Treatment classname <STRING>
* 2: Max dose (0 to ignore) <NUMBER>
* 3: Max dose deviation <NUMBER>
* 3: Incompatable medication <ARRAY<STRING>>
* 2: Incompatible medication <ARRAY<STRING>>
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
*
* 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"];
johnb432 marked this conversation as resolved.
Show resolved Hide resolved
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;
};

if (_currentDose > _maxDose + (floor random _maxDoseDeviation)) then {
TRACE_1("exceeded max dose",_currentDose);
_overdosedMedications pushBackUnique _className;
[_target, _classname] call FUNC(overDose);
};
};

Expand All @@ -43,26 +43,6 @@ if (_maxDose > 0) then {
_x params ["_xMed", "_xLimit"];
private _inSystem = [_target, _xMed] call EFUNC(medical_status,getMedicationCount);
johnb432 marked this conversation as resolved.
Show resolved Hide resolved
if (_inSystem> _xLimit) then {
_overdosedMedications pushBackUnique _xMed;
[_target, _classname] call FUNC(overDose);
};
} forEach _incompatibleMedication;

if (_overdosedMedications isNotEqualTo []) then {
private _medicationConfig = (configFile >> "ace_medical_treatment" >> "Medication");
private _onOverDose = getText (_medicationConfig >> "onOverDose");
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
if (isClass (_medicationConfig >> _className)) then {
_medicationConfig = (_medicationConfig >> _className);
if (isText (_medicationConfig >> "onOverDose")) then { _onOverDose = getText (_medicationConfig >> "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;
};
43 changes: 43 additions & 0 deletions addons/medical_treatment/functions/fnc_overDose.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "..\script_component.hpp"
/*
* Author: Cplhardcore
* Handles the overdose effects of a medication.
*
* Arguments:
* 0: The patient <OBJECT>
* 1: Medication classname <STRING>
* 2: Incompatible medication <ARRAY of STRING>
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
*
* Return Value:
* None
*
* Example:
* [player, "morphine"] call ace_medical_treatment_fnc_overDose
* Public: No
Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
*/

params ["_unit", "_classname"];
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved

private _medicationConfig = configFile >> QUOTE(ADDON) >> "Medication";
private _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);
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved

if (_onOverDose == "") exitWith {
TRACE_1("CriticalVitals Event",_unit);
[QEGVAR(medical,CriticalVitals), _unit] call CBA_fnc_localEvent;
};
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved

if (isNil _onOverDose) then {
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved
_onOverDose = compile _onOverDose;
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved
} else {
_onOverDose = missionNamespace getVariable _onOverDose;
};
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved

[_target, _className] call _onOverDose
36 changes: 36 additions & 0 deletions addons/medical_treatment/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,42 @@
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;

Cplhardcore marked this conversation as resolved.
Show resolved Hide resolved
[
QGVAR(medicPAK),
"LIST",
Expand Down
Loading