Fix morphine when advanced medication is disabled

This commit is contained in:
ulteq 2016-12-15 12:58:06 +01:00
parent 65f0f56474
commit 0de405fe2a
4 changed files with 20 additions and 9 deletions

View File

@ -86,10 +86,6 @@ private _tourniquets = _unit getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
} forEach _tourniquets;
[_unit, _tourniquetPain] call FUNC(adjustPainLevel);
// Handle continuous pain reduction
private _pain = _unit getVariable [QGVAR(pain), 0];
_unit setVariable [QGVAR(pain), 0 max (_pain - _deltaT * PAIN_REDUCTION_SPEED), _syncValues];
[_unit, _deltaT, _syncValues] call FUNC(updateHeartRate);
[_unit, _deltaT, _syncValues] call FUNC(updatePainSuppress);
[_unit, _deltaT, _syncValues] call FUNC(updatePeripheralResistance);

View File

@ -42,3 +42,14 @@ if (!(_adjustment isEqualTo [])) then {
_unit setVariable [QGVAR(painSuppress), 0 max _painSupressAdjustment, _syncValue];
};
// Handle continuous pain reduction
private _pain = _unit getVariable [QGVAR(pain), 0];
_unit setVariable [QGVAR(pain), 0 max (_pain - _deltaT / PAIN_FADE_TIME), _syncValues];
// Handles simple medication
if (!GVAR(advancedMedication)) then {
private _painSupress = _unit getVariable [QGVAR(painSuppress), 0];
_painSupress = _painSupress - _deltaT / PAIN_SUPPRESSION_FADE_TIME;
_unit setVariable [QGVAR(painSuppress), 0 max _painSupress, true];
};

View File

@ -37,8 +37,12 @@
// --- pain
#define PAIN_UNCONSCIOUS 0.5
// Pain reduction per second
#define PAIN_REDUCTION_SPEED 0.001
// Pain fade out time (time it takes until pain is guaranteed to be completly gone)
#define PAIN_FADE_TIME 900
// Only relevant when advanced medication is disabled
// Morphine pain suppression fade out time (time it takes until pain suppression is guaranteed to be completly gone)
#define PAIN_SUPPRESSION_FADE_TIME 1800
// Chance to wake up when vitals are stable (checked once every SPONTANEOUS_WAKE_UP_INTERVAL seconds)
#define SPONTANEOUS_WAKE_UP_CHANCE 0.2

View File

@ -19,9 +19,9 @@ TRACE_3("params",_target,_className,_partIndex);
if (!EGVAR(medical,advancedMedication)) exitWith {
if (_className == "Morphine") exitWith {
#define MORPHINEHEAL 0.8
private _pain = 0 max ((_target getVariable [QEGVAR(medical,pain), 0]) - MORPHINEHEAL);
_target setVariable [QEGVAR(medical,pain), _pain, true];
#define MORPHINE_PAIN_SUPPRESSION 0.6
private _painSupress = _target getVariable [QEGVAR(medical,painSuppress), 0];
_target setVariable [QEGVAR(medical,painSuppress), (_painSupress + MORPHINE_PAIN_SUPPRESSION) min 1, true];
};
if (_className == "Epinephrine") exitWith {