Overhauled the medication system:

* Refactored the old code
* Introduced 'timeTillMaxEffect' config entry for medication
This commit is contained in:
ulteq 2016-12-06 20:42:10 +01:00
parent b2838557fa
commit ab7af04530
15 changed files with 199 additions and 184 deletions

View File

@ -12,7 +12,6 @@ PREP(getBloodLoss);
PREP(getBloodPressure);
PREP(getBloodVolumeChange);
PREP(getCardiacOutput);
PREP(getHeartRateChange);
PREP(getPainLevel);
PREP(handleIncapacitation);
PREP(handleKilled);
@ -41,3 +40,6 @@ PREP(setDead);
PREP(setUnconscious);
PREP(showBloodEffect);
PREP(transitionSecondChance);
PREP(updateHeartRate);
PREP(updatePainSuppress);
PREP(updatePeripheralResistance);

View File

@ -21,15 +21,6 @@ GVAR(STATE_MACHINE) = (configFile >> "ACE_Medical_StateMachine") call CBA_statem
true
] call CBA_Settings_fnc_init;
[
QGVAR(advancedIVBags),
"CHECKBOX",
["Advanced IV Bags", "IV Bags will slowly fill up lost blood."], //@todo
"ACE Medical", // @todo
false,
true
] call CBA_Settings_fnc_init;
[
QGVAR(advancedMedication),
"CHECKBOX",

View File

@ -25,19 +25,14 @@ if (!isNil {_unit getVariable QGVAR(ivBags)}) then {
_bloodBags = _bloodBags apply {
_x params ["_bagVolumeRemaining"];
if (GVAR(advancedIVBags)) then {
private _bagChange = _deltaT * (IV_CHANGE_PER_SECOND min _bagVolumeRemaining); // absolute value of the change in miliLiters
_bagVolumeRemaining = _bagVolumeRemaining - _bagChange;
_bloodVolumeChange = _bloodVolumeChange + (_bagChange / 1000);
private _bagChange = _deltaT * (IV_CHANGE_PER_SECOND min _bagVolumeRemaining); // absolute value of the change in miliLiters
_bagVolumeRemaining = _bagVolumeRemaining - _bagChange;
_bloodVolumeChange = _bloodVolumeChange + (_bagChange / 1000);
if (_bagVolumeRemaining < 0.01) then {
[]
} else {
[_bagVolumeRemaining]
};
} else {
_bloodVolumeChange = _bloodVolumeChange + (_bagVolumeRemaining / 1000);
if (_bagVolumeRemaining < 0.01) then {
[]
} else {
[_bagVolumeRemaining]
};
};

View File

@ -82,8 +82,11 @@ private _oldTourniquets = (_unit getVariable [QGVAR(tourniquets), []]) select {_
// Increase pain at a rate of 0.001 units/s per old tourniquet
_pain = _pain + (count _oldTourniquets) * 0.001 * _deltaT;
private _heartRate = (_unit getVariable [QGVAR(heartRate), 80]) + ([_unit, _deltaT] call FUNC(getHeartRateChange));
_unit setVariable [QGVAR(heartRate), 0 max _heartRate, _syncValues];
[_unit, _deltaT, _syncValues] call FUNC(updateHeartRate);
[_unit, _deltaT, _syncValues] call FUNC(updatePainSuppress);
[_unit, _deltaT, _syncValues] call FUNC(updatePeripheralResistance);
private _heartRate = _unit getVariable [QGVAR(heartRate), 80];
private _bloodPressure = [_unit] call FUNC(getBloodPressure);
_unit setVariable [QGVAR(bloodPressure), _bloodPressure, _syncValues];

View File

@ -33,10 +33,11 @@ _unit setVariable [QGVAR(bandagedWounds), [], true];
_unit setVariable [QGVAR(stitchedWounds), [], true];
// vitals
_unit setVariable [QGVAR(heartRate), 80];
_unit setVariable [QGVAR(heartRateAdjustments), []];
_unit setVariable [QGVAR(bloodPressure), [80, 120]];
_unit setVariable [QGVAR(peripheralResistance), 100];
_unit setVariable [QGVAR(heartRate), 80, true];
_unit setVariable [QGVAR(heartRateAdjustments), [], true];
_unit setVariable [QGVAR(bloodPressure), [80, 120], true];
_unit setVariable [QGVAR(peripheralResistance), 100, true];
_unit setVariable [QGVAR(peripheralResistanceAdjustments), [], true];
// triage card and logs
_unit setVariable [QGVAR(triageLevel), 0, true];
@ -55,6 +56,7 @@ _unit setVariable [QGVAR(isBleeding), false, true];
_unit setVariable [QGVAR(hasPain), false, true];
_unit setVariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true];
_unit setVariable [QGVAR(painSuppress), 0, true];
_unit setVariable [QGVAR(painSuppressAdjustments), [], true];
private ["_allUsedMedication", "_logs"];

View File

@ -1,51 +1,52 @@
/*
* Author: Glowbal
* Get the change in the heart rate. Used for the vitals calculations. Calculated in one seconds.
* Update the heart rate
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Time since last update <NUMBER>
* 2: Sync value? <BOOL>
*
* ReturnValue:
* Change in heart Rate <NUMBER>
* nothing
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_deltaT"];
private _hrIncrease = 0;
params ["_unit", "_deltaT", "_syncValue"];
private _hrTargetAdjustment = 0;
private _adjustment = _unit getVariable [QGVAR(heartRateAdjustments), []];
{
_x params ["_value", "_timeTillMaxEffect", "_maxTimeInSystem", "_timeInSystem", "_callBack"];
if (abs _value > 0 && {_maxTimeInSystem > 0}) then {
if (_timeInSystem >= _maxTimeInSystem) then {
_adjustment set [_forEachIndex, ObjNull];
[_unit] call _callBack;
} else {
_timeInSystem = _timeInSystem + _deltaT;
private _effectRatio = ((_timeInSystem / (1 max _timeTillMaxEffect)) ^ 2) min 1;
_hrTargetAdjustment = _hrTargetAdjustment + _value * _effectRatio * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem;
_x set [3, _timeInSystem];
};
} else {
_adjustment set [_forEachIndex, ObjNull];
[_unit] call _callBack;
};
} forEach _adjustment;
_adjustment = _adjustment - [ObjNull];
_unit setVariable [QGVAR(heartRateAdjustments), _adjustment];
if (!(_adjustment isEqualTo [])) then {
{
_x params ["_value", "_timeTillMaxEffect", "_maxTimeInSystem", "_timeInSystem"];
if (abs _value > 0 && {_maxTimeInSystem > 0}) then {
if (_timeInSystem >= _maxTimeInSystem) then {
_adjustment set [_forEachIndex, ObjNull];
} else {
_timeInSystem = _timeInSystem + _deltaT;
private _effectRatio = ((_timeInSystem / (1 max _timeTillMaxEffect)) ^ 2) min 1;
_hrTargetAdjustment = _hrTargetAdjustment + _value * _effectRatio * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem;
_x set [3, _timeInSystem];
};
} else {
_adjustment set [_forEachIndex, ObjNull];
};
} forEach _adjustment;
_adjustment = _adjustment - [ObjNull];
_unit setVariable [QGVAR(heartRateAdjustments), _adjustment, _syncValue];
};
private _heartRate = _unit getVariable [QGVAR(heartRate), 80];
if (!(_unit getVariable [QGVAR(inCardiacArrest), false])) then {
private _heartRate = (_unit getVariable [QGVAR(heartRate), 80]);
private _hrChange = 0;
private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), DEFAULT_BLOOD_VOLUME];
if (_bloodVolume > BLOOD_VOLUME_CLASS_4_HEMORRHAGE) then {
private _hrChange = 0;
([_unit] call FUNC(getBloodPressure)) params ["_bloodPressureL", "_bloodPressureH"];
private _meanBP = (2/3) * _bloodPressureH + (1/3) * _bloodPressureL;
private _painLevel = [_unit] call FUNC(getPainLevel);
@ -65,14 +66,10 @@ if (!(_unit getVariable [QGVAR(inCardiacArrest), false])) then {
_targetHR = _targetHR + _hrTargetAdjustment;
_hrChange = round(_targetHR - _heartRate) / 2;
if (_hrChange < 0) then {
_hrChange = _hrChange / 20;
};
_hrIncrease = _hrIncrease + _hrChange;
} else {
_hrIncrease = _hrIncrease - round(_heartRate / 10);
_hrChange = -round(_heartRate / 10);
};
_heartRate = _heartRate + _deltaT * _hrChange;
};
(_deltaT * _hrIncrease)
_unit setVariable [QGVAR(heartRate), 0 max _heartRate, _syncValue];

View File

@ -0,0 +1,44 @@
/*
* Author: Glowbal
* Update the pain suppression
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Time since last update <NUMBER>
* 2: Sync value? <BOOL>
*
* ReturnValue:
* nothing
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_deltaT", "_syncValue"];
private _painSupressAdjustment = 0;
private _adjustment = _unit getVariable [QGVAR(painSupressAdjustments), []];
if (!(_adjustment isEqualTo [])) then {
{
_x params ["_value", "_timeTillMaxEffect", "_maxTimeInSystem", "_timeInSystem"];
if (abs _value > 0 && {_maxTimeInSystem > 0}) then {
if (_timeInSystem >= _maxTimeInSystem) then {
_adjustment set [_forEachIndex, ObjNull];
} else {
_timeInSystem = _timeInSystem + _deltaT;
private _effectRatio = ((_timeInSystem / (1 max _timeTillMaxEffect)) ^ 2) min 1;
_painSupressAdjustment = _painSupressAdjustment + _value * _effectRatio * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem;
_x set [3, _timeInSystem];
};
} else {
_adjustment set [_forEachIndex, ObjNull];
};
} forEach _adjustment;
_adjustment = _adjustment - [ObjNull];
_unit setVariable [QGVAR(painSupressAdjustments), _adjustment, _syncValue];
_unit setVariable [QGVAR(painSuppress), 0 max _painSupressAdjustment, _syncValue];
};

View File

@ -0,0 +1,44 @@
/*
* Author: Glowbal
* Update the peripheral resistance
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Time since last update <NUMBER>
* 2: Sync value? <BOOL>
*
* ReturnValue:
* nothing
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_deltaT", "_syncValue"];
private _peripheralResistanceAdjustment = 0;
private _adjustment = _unit getVariable [QGVAR(peripheralResistanceAdjustments), []];
if (!(_adjustment isEqualTo [])) then {
{
_x params ["_value", "_timeTillMaxEffect", "_maxTimeInSystem", "_timeInSystem"];
if (abs _value > 0 && {_maxTimeInSystem > 0}) then {
if (_timeInSystem >= _maxTimeInSystem) then {
_adjustment set [_forEachIndex, ObjNull];
} else {
_timeInSystem = _timeInSystem + _deltaT;
private _effectRatio = ((_timeInSystem / (1 max _timeTillMaxEffect)) ^ 2) min 1;
_peripheralResistanceAdjustment = _peripheralResistanceAdjustment + _value * _effectRatio * (_maxTimeInSystem - _timeInSystem) / _maxTimeInSystem;
_x set [3, _timeInSystem];
};
} else {
_adjustment set [_forEachIndex, ObjNull];
};
} forEach _adjustment;
_adjustment = _adjustment - [ObjNull];
_unit setVariable [QGVAR(peripheralResistanceAdjustments), _adjustment, _syncValue];
_unit SetVariable [QGVAR(peripheralResistance), 0 max (100 + _peripheralResistanceAdjustment), _syncValue];
};

View File

@ -557,13 +557,15 @@ class ADDON {
class Medication {
// How much does the pain get reduced?
painReduce = 0;
// How much will the heart rate be increased when the HR is low (below 55)? {minIncrease, maxIncrease, seconds until max. effect}
hrIncreaseLow[] = {0, 0, 0};
hrIncreaseNormal[] = {0, 0, 0};
hrIncreaseHigh[] = {0, 0, 0};
// How much will the heart rate be increased when the HR is low (below 55)? {minIncrease, maxIncrease}
hrIncreaseLow[] = {0, 0}; // _heartRate < 55
hrIncreaseNormal[] = {0, 0}; // 55 <= _heartRate <= 110
hrIncreaseHigh[] = {0, 0}; // 110 < _heartRate
// How long until this medication has disappeared
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 overdoses?
maxDose = 4;
// Function to execute upon overdose. Arguments passed to call back are 0: unit <OBJECT>, 1: medicationClassName <STRING>
@ -573,45 +575,50 @@ class ADDON {
// specific details for the ACE_Morphine treatment action
class Morphine {
painReduce = 15;
hrIncreaseLow[] = {-10, -20, 35};
hrIncreaseNormal[] = {-10, -30, 35};
hrIncreaseHigh[] = {-10, -35, 50};
painReduce = 1.0;
hrIncreaseLow[] = {-10, -20};
hrIncreaseNormal[] = {-10, -30};
hrIncreaseHigh[] = {-10, -35};
timeInSystem = 900;
timeTillMaxEffect = 30;
maxDose = 4;
inCompatableMedication[] = {};
viscosityChange = -10;
};
class Epinephrine {
painReduce = 0;
hrIncreaseLow[] = {10, 20, 15};
hrIncreaseNormal[] = {10, 50, 10};
hrIncreaseHigh[] = {10, 40, 5};
hrIncreaseLow[] = {10, 20};
hrIncreaseNormal[] = {10, 50};
hrIncreaseHigh[] = {10, 40};
timeInSystem = 120;
timeTillMaxEffect = 10;
maxDose = 10;
inCompatableMedication[] = {};
};
class Adenosine {
painReduce = 0;
hrIncreaseLow[] = {-7, -10, 15};
hrIncreaseNormal[] = {-15, -30, 20};
hrIncreaseHigh[] = {-15, -35, 10};
hrIncreaseLow[] = {-7, -10};
hrIncreaseNormal[] = {-15, -30};
hrIncreaseHigh[] = {-15, -35};
timeInSystem = 120;
timeTillMaxEffect = 15;
maxDose = 6;
inCompatableMedication[] = {};
};
class Atropine {
painReduce = 0;
hrIncreaseLow[] = {-2, -5, 15};
hrIncreaseNormal[] = {-10, -15, 20};
hrIncreaseHigh[] = {-5, -20, 10};
hrIncreaseLow[] = {-2, -5};
hrIncreaseNormal[] = {-10, -15};
hrIncreaseHigh[] = {-5, -20};
timeInSystem = 120;
timeTillMaxEffect = 15;
maxDose = 6;
inCompatableMedication[] = {};
};
class PainKillers {
painReduce = 0.7;
timeInSystem = 120;
painReduce = 0.1;
timeInSystem = 600;
timeTillMaxEffect = 60;
maxDose = 10;
inCompatableMedication[] = {};
viscosityChange = 5;

View File

@ -34,7 +34,6 @@ PREP(treatmentFullHealTreatmentTime);
PREP(treatmentSurgicalKit_onProgress);
// misc
PREP(addHeartRateAdjustment);
PREP(addToLog);
PREP(addToTriageCard);
PREP(addUnloadPatientActions);
@ -44,7 +43,6 @@ PREP(getTriageStatus);
PREP(handleBandageOpening);
PREP(isBeingCarried);
PREP(isBeingDragged);
PREP(medicationEffectLoop);
PREP(onMedicationUsage);
// items

View File

@ -1,26 +0,0 @@
/*
* Author: Glowbal, KoffeinFlummi
* Increase the heart rate target of a local unit by given number during the given amount of seconds.
*
* Arguments:
* 0: The unit <OBJECT>
* 1: value <NUMBER>
* 2: time until max. effect (seconds) <NUMBER>
* 3: time in system (seconds) <NUMBER>
* 4: callback <CODE>
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
params [["_unit", objNull, [objNull]], ["_value", 0, [0]], ["_timeTillMaxEffect", 1, [0]], ["_timeInSystem", 1, [0]]];
private _adjustment = _unit getVariable [QEGVAR(medical,heartRateAdjustments), []];
_adjustment pushBack [_value, _timeTillMaxEffect, _timeInSystem, 0];
_unit setVariable [QEGVAR(medical,heartRateAdjustments), _adjustment];
["ace_heartRateAdjustmentAdded", [_unit, _value, _time]] call CBA_fnc_localEvent;

View File

@ -1,42 +0,0 @@
/*
* Author: Glowbal, esteldunedain
* Medication effect loop for an injection.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Name of the Variable that is affected <STRING>
* 2: Proportion of the effect applied <NUMBER>
* 3: Rate at which the effect is applied <NUMBER>
* 4: Viscosity adjustment rate <NUMBER>
* 5: Pain reduction rate <NUMBER>
*
* ReturnValue:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit", "_variableName", "_amountDecreased", "_decreaseRate", "_viscosityAdjustmentRate", "_painReduceRate"];
// If the unit died the loop is finished
if (!alive _unit) exitWith {};
// If locality changed finish the local loop
if (!local _unit) exitWith {};
// Apply medicinal effect
private _usedMeds = (_unit getVariable [_variableName, 0]) - _decreaseRate;
_unit setVariable [_variableName, _usedMeds];
// Restore the viscosity while the medication is leaving the system
_unit setVariable [QEGVAR(medical,peripheralResistance), ((_unit getVariable [QEGVAR(medical,peripheralResistance), 100]) - _viscosityAdjustmentRate) max 0];
_unit setVariable [QEGVAR(medical,painSuppress), ((_unit getVariable [QEGVAR(medical,painSuppress), 0]) - _painReduceRate) max 0];
// Exit if the medication has finished it's effect
_amountDecreased = _amountDecreased + _decreaseRate;
if (_amountDecreased >= 1 || (_usedMeds <= 0) || !alive _unit) exitWith {};
// Schedule the loop to be executed again 1 sec later
[DFUNC(medicationEffectLoop), [_unit, _variableName, _amountDecreased, _decreaseRate, _viscosityAdjustmentRate, _painReduceRate], 1] call CBA_fnc_waitAndExecute;

View File

@ -7,8 +7,7 @@
* 1: Medication Treatment classname <STRING>
* 2: The medication treatment variablename <STRING>
* 3: Max dosage <NUMBER>
* 4: The time in the system <NUMBER>
* 5: Incompatable medication <ARRAY<STRING>>
* 4: Incompatable medication <ARRAY<STRING>>
*
* Return Value:
* None
@ -18,8 +17,8 @@
#include "script_component.hpp"
params ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_viscosityChange", "_painReduce"];
TRACE_8("params",_target,_className,_variable,_maxDosage,_timeInSystem,_incompatabileMeds,_viscosityChange,_painReduce);
params ["_target", "_className", "_variable", "_maxDosage", "_incompatabileMeds"];
TRACE_5("params",_target,_className,_variable,_maxDosage,_incompatabileMeds);
private _foundEntry = false;
private _allUsedMedication = _target getVariable [QEGVAR(medical,allUsedMedication), []];
@ -71,6 +70,3 @@ if (_hasOverDosed > 0) then {
};
[_target, _className] call _onOverDose;
};
// Run the loop that computes the effect of the medication over time
[_target, _variable, 0, (1 / _timeInSystem), (_viscosityChange / _timeInSystem), (_painReduce / _timeInSystem)] call FUNC(medicationEffectLoop);

View File

@ -63,10 +63,11 @@ if (_partialHeal) then {
_target setVariable [QEGVAR(medical,stitchedWounds), [], true];
// vitals
_target setVariable [QEGVAR(medical,heartRate), 80];
_target setVariable [QEGVAR(medical,heartRateAdjustments), []];
_target setVariable [QEGVAR(medical,bloodPressure), [80, 120]];
_target setVariable [QEGVAR(medical,peripheralResistance), 100];
_target setVariable [QEGVAR(medical,heartRate), 80, true];
_target setVariable [QEGVAR(medical,heartRateAdjustments), [], true];
_target setVariable [QEGVAR(medical,bloodPressure), [80, 120], true];
_target setVariable [QEGVAR(medical,peripheralResistance), 100, true];
_target setVariable [QGVAR(peripheralResistanceAdjustments), [], true];
// IVs
_target setVariable [QEGVAR(medical,ivBags), nil, true];
@ -81,6 +82,7 @@ if (_partialHeal) then {
_target setVariable [QEGVAR(medical,isBleeding), false, true];
_target setVariable [QEGVAR(medical,hasPain), false, true];
_target setVariable [QEGVAR(medical,painSuppress), 0, true];
_target setVariable [QGVAR(painSuppressAdjustments), [], true];
_target setVariable [QGVAR(partialHealCounter), 0, true];
// medication

View File

@ -53,6 +53,7 @@ private _hrIncreaseLow = getArray (_medicationConfig >> "hrIncreaseLow");
private _hrIncreaseNorm = getArray (_medicationConfig >> "hrIncreaseNormal");
private _hrIncreaseHigh = getArray (_medicationConfig >> "hrIncreaseHigh");
private _timeInSystem = getNumber (_medicationConfig >> "timeInSystem");
private _timeTillMaxEffect = getNumber (_medicationConfig >> "timeTillMaxEffect");
private _maxDose = getNumber (_medicationConfig >> "maxDose");
private _viscosityChange = getNumber (_medicationConfig >> "viscosityChange");
@ -65,37 +66,38 @@ if (isClass (_medicationConfig >> _className)) then {
if (isArray (_medicationConfig >> "hrIncreaseNormal")) then { _hrIncreaseNorm = getArray (_medicationConfig >> "hrIncreaseNormal"); };
if (isArray (_medicationConfig >> "hrIncreaseHigh")) then { _hrIncreaseHigh = getArray (_medicationConfig >> "hrIncreaseHigh"); };
if (isNumber (_medicationConfig >> "timeInSystem")) then { _timeInSystem = getNumber (_medicationConfig >> "timeInSystem"); };
if (isNumber (_medicationConfig >> "timeTillMaxEffect")) then { _timeTillMaxEffect = getNumber (_medicationConfig >> "timeTillMaxEffect"); };
if (isNumber (_medicationConfig >> "maxDose")) then { _maxDose = getNumber (_medicationConfig >> "maxDose"); };
if (isArray (_medicationConfig >> "inCompatableMedication")) then { _inCompatableMedication = getArray (_medicationConfig >> "inCompatableMedication"); };
if (isNumber (_medicationConfig >> "viscosityChange")) then { _viscosityChange = getNumber (_medicationConfig >> "viscosityChange"); };
};
// Adjust the heart rate based upon config entry
private _heartRate = _target getVariable [QEGVAR(medical,heartRate), 80];
if (alive _target) then {
if (_heartRate > 0) then {
if (_heartRate <= 45) then {
[_target, ((_hrIncreaseLow select 0) + random ((_hrIncreaseLow select 1) - (_hrIncreaseLow select 0))), (_hrIncreaseLow select 2), _timeInSystem] call FUNC(addHeartRateAdjustment);
} else {
if (_heartRate > 120) then {
[_target, ((_hrIncreaseHigh select 0) + random ((_hrIncreaseHigh select 1) - (_hrIncreaseHigh select 0))), (_hrIncreaseHigh select 2), _timeInSystem] call FUNC(addHeartRateAdjustment);
} else {
[_target, ((_hrIncreaseNorm select 0) + random ((_hrIncreaseNorm select 1) - (_hrIncreaseNorm select 0))), (_hrIncreaseNorm select 2), _timeInSystem] call FUNC(addHeartRateAdjustment);
};
};
private _heartRate = _target getVariable [QEGVAR(medical,heartRate), 80];
private _hrIncrease = [_hrIncreaseLow, _hrIncreaseNorm, _hrIncreaseHigh] select (floor ((0 max _heartRate min 110) / 55));
_hrIncrease params ["_minIncrease", "_maxIncrease"];
_heartRateChange = _minIncrease + random (_maxIncrease - _minIncrease);
// Adjust the heart rate based upon config entry
if (_heartRateChange != 0) then {
private _heartRateAdjustments = _target getVariable [QEGVAR(medical,heartRateAdjustments), []];
_heartRateAdjustments pushBack [_heartRateChange, _timeTillMaxEffect, _timeInSystem, 0];
_target setVariable [QEGVAR(medical,heartRateAdjustments), _heartRateAdjustments];
};
// Adjust the pain suppression based upon config entry
if (_painReduce > 0) then {
private _painSupressAdjustments = _target getVariable [QEGVAR(medical,painSupressAdjustments), []];
_painSupressAdjustments pushBack [_painReduce, _timeTillMaxEffect, _timeInSystem, 0];
_target setVariable [QEGVAR(medical,painSupressAdjustments), _painSupressAdjustments];
};
// Adjust the peripheral resistance based upon config entry
if (_viscosityChange != 0) then {
private _peripheralResistanceAdjustments = _target getVariable [QEGVAR(medical,peripheralResistanceAdjustments), []];
_peripheralResistanceAdjustments pushBack [_viscosityChange, _timeTillMaxEffect, _timeInSystem, 0];
_target setVariable [QEGVAR(medical,peripheralResistanceAdjustments), _peripheralResistanceAdjustments];
};
};
if (_painReduce > 0) then {
private _painSuppress = _target getVariable [QEGVAR(medical,painSuppress), 0];
_target setVariable [QEGVAR(medical,painSuppress), (_painSuppress + _painReduce) max 0];
};
private _resistance = _target getVariable [QEGVAR(medical,peripheralResistance), 100];
_target setVariable [QEGVAR(medical,peripheralResistance), (_resistance + _viscosityChange) max 0];
// Call back to ensure that the medication is decreased over time
[_target, _className, _varName, _maxDose, _timeInSystem, _inCompatableMedication, _viscosityChange, _painReduce] call FUNC(onMedicationUsage);
true