diff --git a/addons/medical/dev/watchVariable.sqf b/addons/medical/dev/watchVariable.sqf
index 44eca21b95a..94c4c80c55d 100644
--- a/addons/medical/dev/watchVariable.sqf
+++ b/addons/medical/dev/watchVariable.sqf
@@ -127,17 +127,11 @@ GVAR(dev_watchVariableRunning) = true;
private _hrTargetAdjustment = 0;
private _painSupressAdjustment = 0;
private _peripheralResistanceAdjustment = 0;
- private _medicationCounts = [];
+ private _uniqueMedications = [];
private _rawMedications = (_unit getVariable [VAR_MEDICATIONS, []]) apply {
_x params ["_medication", "_timeAdded", "_timeTillMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"];
+ _uniqueMedications pushBackUnique _medication;
private _timeInSystem = CBA_missionTime - _timeAdded;
- private _index = _medicationCounts find _medication;
- if (_index < 0) then {
- _index = _medicationCounts pushBack _medication;
- _medicationCounts pushBack 0
- };
- _medicationCounts set [(_index + 1), (_medicationCounts select (_index + 1)) + linearConversion [_timeTillMaxEffect, _maxTimeInSystem, _timeInSystem, 1, 0, true]];
-
private _effectRatio = (((_timeInSystem / _timeTillMaxEffect) ^ 2) min 1) * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem;
_hrTargetAdjustment = _hrTargetAdjustment + _hrAdjust * _effectRatio;
_painSupressAdjustment = _painSupressAdjustment + _painAdjust * _effectRatio;
@@ -145,9 +139,11 @@ GVAR(dev_watchVariableRunning) = true;
format ["%1 [%2 / %3][%4][%5,%6,%7]",_medication,_timeInSystem toFixed 0,_maxTimeInSystem toFixed 0, _effectRatio toFixed 2, _hrAdjust toFixed 1, _painAdjust toFixed 2, _flowAdjust toFixed 1];
};
_return pushBack format ["Adjusts: [HR %1][PS %2][PR %3]", _hrTargetAdjustment toFixed 2, _painSupressAdjustment toFixed 2, _peripheralResistanceAdjustment toFixed 2];
- for "_i" from 0 to (count _medicationCounts) - 1 step 2 do {
- _return pushBack format ["-%1: %2", _medicationCounts select _i, _medicationCounts select _i + 1];
- };
+ {
+ private _medicationCount = [_unit, _x, true] call EFUNC(medical_status,getMedicationCount);
+ private _medicationEffectiveness = [_unit, _x, false] call EFUNC(medical_status,getMedicationCount);
+ _return pushBack format ["-%1: C: %2 - E: %3", _x, _medicationCount toFixed 2, _medicationEffectiveness toFixed 2];
+ } forEach _uniqueMedications;
_return pushBack "------- Medications Raw: -------";
_return append _rawMedications;
diff --git a/addons/medical/initSettings.sqf b/addons/medical/initSettings.sqf
index 9b1aee84640..6eaed9623a7 100644
--- a/addons/medical/initSettings.sqf
+++ b/addons/medical/initSettings.sqf
@@ -28,3 +28,12 @@
[0, 1, 0.05, 2],
true
] call CBA_settings_fnc_init;
+
+[
+ QGVAR(spontaneousWakeUpEpinephrineBoost),
+ "SLIDER",
+ [LSTRING(spontaneousWakeUpEpinephrineBoost_DisplayName), LSTRING(spontaneousWakeUpEpinephrineBoost_Description)],
+ LSTRING(Category),
+ [1, 30, 1, 1],
+ true
+] call CBA_settings_fnc_init;
diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml
index da4684dfa9a..39bcf9b56a6 100644
--- a/addons/medical/stringtable.xml
+++ b/addons/medical/stringtable.xml
@@ -33,6 +33,12 @@
La probabilité pour qu'une unité en état stable puisse reprendre conscience (état vérifié toutes les 15 secondes).
A probabilidade que uma unidade com vitais estabilizados possa recuperar consciências (verificado a cada 15 segundos)
+
+ Epinephrine Increases Wake Up Chance
+
+
+ Increases how often spontaneous wake up checks happen when patient has Epinephrine in their system.
+
Limping
Хромота
diff --git a/addons/medical_statemachine/functions/fnc_handleStateUnconscious.sqf b/addons/medical_statemachine/functions/fnc_handleStateUnconscious.sqf
index 9968e266457..5fb94333c27 100644
--- a/addons/medical_statemachine/functions/fnc_handleStateUnconscious.sqf
+++ b/addons/medical_statemachine/functions/fnc_handleStateUnconscious.sqf
@@ -39,7 +39,13 @@ if (EGVAR(medical,spontaneousWakeUpChance) > 0) then {
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), CBA_missionTime];
};
- if (CBA_missionTime - _lastWakeUpCheck > SPONTANEOUS_WAKE_UP_INTERVAL) then {
+ private _wakeUpCheckInterval = SPONTANEOUS_WAKE_UP_INTERVAL;
+ if (EGVAR(medical,spontaneousWakeUpEpinephrineBoost) > 1) then {
+ private _epiEffectiveness = [_unit, "Epinephrine", false] call EFUNC(medical_status,getMedicationCount);
+ _wakeUpCheckInterval = _wakeUpCheckInterval * linearConversion [0, 1, _epiEffectiveness, 1, 1 / EGVAR(medical,spontaneousWakeUpEpinephrineBoost), true];
+ TRACE_2("epiBoost",_epiEffectiveness,_wakeUpCheckInterval);
+ };
+ if (CBA_missionTime - _lastWakeUpCheck > _wakeUpCheckInterval) then {
TRACE_2("Checking for wake up",_unit,EGVAR(medical,spontaneousWakeUpChance));
_unit setVariable [QEGVAR(medical,lastWakeUpCheck), CBA_missionTime];
diff --git a/addons/medical_status/XEH_PREP.hpp b/addons/medical_status/XEH_PREP.hpp
index 18f5ee699ac..5d5f2f464cb 100644
--- a/addons/medical_status/XEH_PREP.hpp
+++ b/addons/medical_status/XEH_PREP.hpp
@@ -4,6 +4,7 @@ PREP(getBloodLoss);
PREP(getBloodPressure);
PREP(getBloodVolumeChange);
PREP(getCardiacOutput);
+PREP(getMedicationCount);
PREP(handleKilled);
PREP(hasStableVitals);
PREP(initUnit);
diff --git a/addons/medical_status/functions/fnc_getMedicationCount.sqf b/addons/medical_status/functions/fnc_getMedicationCount.sqf
new file mode 100644
index 00000000000..5c8b3bfd57b
--- /dev/null
+++ b/addons/medical_status/functions/fnc_getMedicationCount.sqf
@@ -0,0 +1,39 @@
+#include "script_component.hpp"
+/*
+ * Author: PabstMirror
+ * 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)
+ *
+ * Arguments:
+ * 0: The patient