mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added onOverDose callback. Allows for medication specific side effects.
This commit is contained in:
parent
7750f2d1b2
commit
7f2d41b1a8
@ -640,7 +640,8 @@ class ACE_Medical_Advanced {
|
||||
timeInSystem = 120;
|
||||
// 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>
|
||||
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
|
||||
viscosityChange = 0;
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_classNamesUsed", "_decreaseAmount", "_viscosityChange", "_viscosityAdjustment"];
|
||||
private ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_classNamesUsed", "_decreaseAmount", "_viscosityChange", "_viscosityAdjustment", "_medicationConfig", "_onOverDose"];
|
||||
_target = _this select 0;
|
||||
_className = _this select 1;
|
||||
_variable = _this select 2;
|
||||
@ -65,6 +65,21 @@ _hasOverDosed = 0;
|
||||
}foreach _allUsedMedication;
|
||||
}foreach _incompatabileMeds;
|
||||
|
||||
if (_hasOverDosed > 0) then {
|
||||
_medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication");
|
||||
_onOverDose = getText (_medicationConfig >> "onOverDose");
|
||||
if (isClass (_medicationConfig >> _className)) then {
|
||||
_medicationConfig = (_medicationConfig >> _className);
|
||||
if (isText (_medicationConfig >> "onOverDose")) then { _onOverDose = getText (_medicationConfig >> "onOverDose"); };
|
||||
};
|
||||
if (isNil _onOverDose) then {
|
||||
_onOverDose = compile _onOverDose;
|
||||
} else {
|
||||
_onOverDose = missionNamespace getvariable _onOverDose;
|
||||
};
|
||||
[_target, _className] call _onOverDose;
|
||||
};
|
||||
|
||||
_decreaseAmount = 1 / _timeInSystem;
|
||||
_viscosityAdjustment = _viscosityChange / _timeInSystem;
|
||||
|
||||
|
@ -52,7 +52,7 @@ if (isClass (_medicationConfig >> _className)) then {
|
||||
if (isNil _hrCallback) then {
|
||||
_hrCallback = compile _hrCallback;
|
||||
} else {
|
||||
_hrCallback = missionNamespace getvariable [_hrCallback, {}];
|
||||
_hrCallback = missionNamespace getvariable _hrCallback;
|
||||
};
|
||||
|
||||
// Adjust the heart rate based upon config entry
|
||||
|
Loading…
Reference in New Issue
Block a user