Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 7 additions & 4 deletions addons/medical_treatment/ACE_Medical_Treatment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,11 @@ 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 overdoses?
// How many of this type of 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
maxDoseDeviation = 2;
// Function to execute upon overdose. Arguments passed to call back are 0: unit <OBJECT>, 1: medicationClassName <STRING>
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
Expand All @@ -591,7 +594,7 @@ class ADDON {
hrIncreaseHigh[] = {10, 40};
timeInSystem = 120;
timeTillMaxEffect = 10;
maxDose = 10;
maxDose = 9;
incompatibleMedication[] = {};
};
class Adenosine {
Expand All @@ -601,7 +604,7 @@ class ADDON {
hrIncreaseHigh[] = {-15, -35};
timeInSystem = 120;
timeTillMaxEffect = 15;
maxDose = 6;
maxDose = 5;
incompatibleMedication[] = {};
};
class PainKillers {
Expand All @@ -611,7 +614,7 @@ class ADDON {
hrIncreaseHigh[] = {-5, -17};
timeInSystem = 420;
timeTillMaxEffect = 60;
maxDose = 6;
maxDose = 5;
incompatibleMedication[] = {};
viscosityChange = 5;
};
Expand Down
3 changes: 2 additions & 1 deletion addons/medical_treatment/functions/fnc_medicationLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private _painReduce = GET_NUMBER(_medicationConfig >> "painReduce",g
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"));
Expand All @@ -75,4 +76,4 @@ TRACE_3("adjustments",_heartRateChange,_painReduce,_viscosityChange);
[_patient, _className, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange] call EFUNC(medical_status,addMedicationAdjustment);

// Check for medication compatiblity
[_patient, _className, _maxDose, _incompatibleMedication] call FUNC(onMedicationUsage);
[_patient, _className, _maxDose, _maxDoseDeviation, _incompatibleMedication] call FUNC(onMedicationUsage);
18 changes: 12 additions & 6 deletions addons/medical_treatment/functions/fnc_onMedicationUsage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,33 @@
* Arguments:
* 0: The patient <OBJECT>
* 1: Medication Treatment classname <STRING>
* 2: Max dosage (0 to ignore) <NUMBER>
* 2: Max dose (0 to ignore) <NUMBER>
* 3: Max dose deviation <NUMBER>
* 3: Incompatable medication <ARRAY<STRING>>
*
* Return Value:
* None
*
* Example:
* [player, "morphine", 4, [["x", 1]]] call ace_medical_treatment_fnc_onMedicationUsage
* [player, "morphine", 4, 2, [["x", 1]]] call ace_medical_treatment_fnc_onMedicationUsage
*
* Public: No
*/

params ["_target", "_className", "_maxDosage", "_incompatibleMedication"];
TRACE_4("onMedicationUsage",_target,_className,_maxDosage,_incompatibleMedication);
params ["_target", "_className", "_maxDose", "_maxDoseDeviation", "_incompatibleMedication"];
TRACE_5("onMedicationUsage",_target,_className,_maxDose,_maxDoseDeviation,_incompatibleMedication);

private _overdosedMedications = [];

// Check for overdose from current medication
if (_maxDosage > 0) then {
if (_maxDose > 0) then {
private _currentDose = [_target, _className] call EFUNC(medical_status,getMedicationCount);
if (_currentDose >= floor (_maxDosage + round(random(2)))) then {
// 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 {
Comment thread
LinkIsGrim marked this conversation as resolved.
TRACE_1("exceeded max dose",_currentDose);
_overdosedMedications pushBackUnique _className;
};
Expand Down