mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added support for viscosity adjustment from medication
This commit is contained in:
parent
39be8ffbe7
commit
f8421b2589
@ -637,18 +637,23 @@ class ACE_Medical_Advanced {
|
||||
timeInSystem = 120;
|
||||
// How many of this type of medication can be in the system before the patient overdoses?
|
||||
maxDose = 4;
|
||||
// specific details for the ACE_Morphine treatment action.
|
||||
|
||||
// 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;
|
||||
|
||||
// specific details for the ACE_Morphine treatment action
|
||||
class Morphine {
|
||||
painReduce = 1;
|
||||
painReduce = 0.7;
|
||||
hrIncreaseLow[] = {-10, -30, 35};
|
||||
hrIncreaseNormal[] = {-10, -50, 40};
|
||||
hrIncreaseHigh[] = {-10, -40, 50};
|
||||
timeInSystem = 120;
|
||||
timeInSystem = 500;
|
||||
maxDose = 4;
|
||||
inCompatableMedication[] = {};
|
||||
viscosityChange = 10;
|
||||
};
|
||||
class Epinephrine {
|
||||
painReduce = 1;
|
||||
painReduce = 0;
|
||||
hrIncreaseLow[] = {10, 20, 30};
|
||||
hrIncreaseNormal[] = {10, 50, 20};
|
||||
hrIncreaseHigh[] = {10, 40, 10};
|
||||
@ -657,8 +662,8 @@ class ACE_Medical_Advanced {
|
||||
inCompatableMedication[] = {};
|
||||
};
|
||||
class Atropine {
|
||||
painReduce = 1;
|
||||
hrIncreaseLow[] = {-10, -20, 15};
|
||||
painReduce = 0;
|
||||
hrIncreaseLow[] = {20, 30, 15};
|
||||
hrIncreaseNormal[] = {-10, -50, 20};
|
||||
hrIncreaseHigh[] = {-10, -40, 10};
|
||||
timeInSystem = 120;
|
||||
|
@ -18,13 +18,14 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_classNamesUsed", "_decreaseAmount"];
|
||||
private ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_classNamesUsed", "_decreaseAmount", "_viscosityChange", "_viscosityAdjustment"];
|
||||
_target = _this select 0;
|
||||
_className = _this select 1;
|
||||
_variable = _this select 2;
|
||||
_maxDosage = _this select 3;
|
||||
_timeInSystem = _this select 4;
|
||||
_incompatabileMeds = _this select 5;
|
||||
_viscosityChange = _this select 6;
|
||||
|
||||
_foundEntry = false;
|
||||
_allUsedMedication = _target getvariable [QGVAR(allUsedMedication), []];
|
||||
@ -65,14 +66,17 @@ _hasOverDosed = 0;
|
||||
}foreach _incompatabileMeds;
|
||||
|
||||
_decreaseAmount = 1 / _timeInSystem;
|
||||
_viscosityAdjustment = _viscosityChange / _timeInSystem;
|
||||
|
||||
[{
|
||||
private ["_args", "_target", "_timeInSystem", "_variable", "_amountDecreased","_decreaseAmount", "_usedMeds"];
|
||||
private ["_args", "_target", "_timeInSystem", "_variable", "_amountDecreased","_decreaseAmount", "_usedMeds", "_viscosityAdjustment"];
|
||||
_args = _this select 0;
|
||||
_target = _args select 0;
|
||||
_timeInSystem = _args select 1;
|
||||
_variable = _args select 2;
|
||||
_amountDecreased = _args select 3;
|
||||
_decreaseAmount = _args select 4;
|
||||
_viscosityAdjustment = _args select 5;
|
||||
|
||||
_usedMeds = _target getvariable [_variable, 0];
|
||||
_usedMeds = _usedMeds - _decreaseAmount;
|
||||
@ -80,8 +84,11 @@ _decreaseAmount = 1 / _timeInSystem;
|
||||
|
||||
_amountDecreased = _amountDecreased + _decreaseAmount;
|
||||
|
||||
if (_amountDecreased >= 1 || (_usedMeds <= 0)) then {
|
||||
// Restoring the viscosity while the medication is leaving the system
|
||||
_target setvariable [QGVAR(peripheralResistance), (_target getvariable [QGVAR(peripheralResistance), 100]) - _viscosityAdjustment];
|
||||
|
||||
if (_amountDecreased >= 1 || (_usedMeds <= 0) || !alive _target) then {
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
_args set [3, _amountDecreased];
|
||||
}, 1, [_target, _timeInSystem, _variable, 0, _decreaseAmount] ] call CBA_fnc_addPerFrameHandler;
|
||||
}, 1, [_target, _timeInSystem, _variable, 0, _decreaseAmount, _viscosityAdjustment] ] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_target", "_className", "_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain"];
|
||||
private ["_target", "_className", "_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain", "_resistance"];
|
||||
_target = _this select 0;
|
||||
_className = _this select 1;
|
||||
|
||||
@ -33,6 +33,8 @@ _hrIncreaseNorm = getArray (_medicationConfig >> "hrIncreaseNormal");
|
||||
_hrIncreaseHigh = getArray (_medicationConfig >> "hrIncreaseHigh");
|
||||
_timeInSystem = getNumber (_medicationConfig >> "timeInSystem");
|
||||
_maxDose = getNumber (_medicationConfig >> "maxDose");
|
||||
_viscosityChange = getNumber (_medicationConfig >> "viscosityChange");
|
||||
|
||||
_inCompatableMedication = [];
|
||||
if (isClass (_medicationConfig >> _className)) then {
|
||||
_medicationConfig = (_medicationConfig >> _className);
|
||||
@ -43,6 +45,7 @@ if (isClass (_medicationConfig >> _className)) then {
|
||||
if (isNumber (_medicationConfig >> "timeInSystem")) then { _timeInSystem = getNumber (_medicationConfig >> "timeInSystem"); };
|
||||
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
|
||||
@ -69,7 +72,11 @@ if (_pain <= 0) then {
|
||||
};
|
||||
_target setvariable [QGVAR(pain), _pain];
|
||||
|
||||
_resistance = _unit getvariable [QGVAR(peripheralResistance), 100];
|
||||
_resistance = _resistance + _viscosityChange;
|
||||
_unit setvariable [QGVAR(peripheralResistance), _resistance];
|
||||
|
||||
// Call back to ensure that the medication is decreased over time
|
||||
[_target, _classname, _varName, _maxDose, _timeInSystem, _inCompatableMedication] call FUNC(onMedicationUsage);
|
||||
[_target, _classname, _varName, _maxDose, _timeInSystem, _inCompatableMedication, _viscosityChange] call FUNC(onMedicationUsage);
|
||||
|
||||
true
|
||||
|
Loading…
Reference in New Issue
Block a user