Skip to content

Commit

Permalink
More stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Cplhardcore committed Dec 1, 2024
1 parent 40f97ed commit 196f6fd
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 4 deletions.
36 changes: 36 additions & 0 deletions addons/circulation/ACE_Medical_Treatment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ class ACE_Medical_Treatment {
ratio[] = {};
type = "Blood";
viscosity = 0.9;
painReduce = 0;
hrIncreaseLow[] = {0, 0};
hrIncreaseNormal[] = {0, 0};
hrIncreaseHigh[] = {0, 0};
timeInSystem = 120;
timeTillMaxEffect = 30;
onOverDose = "";
viscosityChange = 0;
alphaFactor = 0;
maxRelief = 0;
opioidRelief = 0;
opioidEffect = 0;
class BloodIV {
volume = 1000;
ratio[] = {"Plasma", 1};
Expand Down Expand Up @@ -217,5 +229,29 @@ class ACE_Medical_Treatment {
viscosity = 0.7;
type = "PackedRBC";
};
class MorphineInfusion_IV: SalineIV_500 {
volume = 500;
viscosity = 1.3;
type = "MorphineInfusion";
};
class EpinephrineInfusion_IV: SalineIV_500 {
volume = 500;
viscosity = 1.3;
type = "EpinephrineInfusion";
};
class EtomidateInfusion_IV: SalineIV_500 {
painReduce = 0.2;
hrIncreaseLow[] = {-3, -7};
hrIncreaseNormal[] = {-6, -13};
hrIncreaseHigh[] = {-10, -20};
timeInSystem = 7;
timeTillMaxEffect = 1;
dose = 0.1
incompatibleMedication[] = {};
viscosityChange = 0;
volume = 500;
viscosity = 1.3;
type = "EtomidateInfusion";
};
};
};
5 changes: 3 additions & 2 deletions addons/pharma/functions/fnc_fluidLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ private _current = _patient getVariable [QGVAR(externalPh), 0];
private _fluidVolume = GET_BODY_FLUID(_unit);

_patient setVariable [QGVAR(externalPh), ((_current + _ph) max 0), true];
_fluidVolume params ["_ECB","_ECP","_SRBC","_ISP","_fullVolume","_ECS"];
_fluidVolume params ["_ECB","_ECP","_SRBC","_ISP","_fullVolume"];

if (_classname in ["PackedRBCIV_500", "PackedRBCIV_250"]) then {
private _plasma = (_fluidVolume select 1);
private _ph = GET_PH(_patient);

if _plasma <= 2000 then {
if (_plasma <= 2000) && (_ph > 6.5) && (_ph < 8) then {
private _coagFactorMax = missionNamespace getVariable [QGVAR(coagulation_factor_limit), 60];
private _factor = _patient getVariable [QGVAR(coagulationFactor), 30];
private _final2 = (_factor + _coagulation) min _coagFactorMax;
Expand Down
62 changes: 60 additions & 2 deletions addons/pharma/functions/fnc_getBloodVolumeChange.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if (!isNil {_unit getVariable [QACEGVAR(medical,ivBags),[]]}) then {

private _tourniquets = GET_TOURNIQUETS(_unit);

if ((_tourniquets select _bodyPart isEqualTo 0) && (_IVarray select _bodyPart isNotEqualTo 3)) then {
if ((_tourniquets select _bodyPart isEqualTo 0) && (_IVarray select _bodyPart isNotEqualTo 3) && (!(_type in ["Ringers Lactate", "Blood"]))) then {
private _IVflow = _unit getVariable [QGVAR(IVflow), [0,0,0,0,0,0]];
private _viscosity = getNumber (configFile >> "ACE_Medical_Treatment" >> "IV" >> _className >> "viscosity");
private _bagChange = (_flowCalculation * (_IVflow select _bodyPart) * _viscosity) min _bagVolumeRemaining; // absolute value of the change in miliLiters
Expand Down Expand Up @@ -107,7 +107,65 @@ if (!isNil {_unit getVariable [QACEGVAR(medical,ivBags),[]]}) then {
};
};
};
};
} else {
private _className = format {%1_IV, _type};

Check failure on line 111 in addons/pharma/functions/fnc_getBloodVolumeChange.sqf

View workflow job for this annotation

GitHub Actions / build

invalid token

invalid token
private _IVflow = _unit getVariable [QGVAR(IVflow), [0,0,0,0,0,0]];
private _defaultConfig = configFile >> QUOTE(ACE_ADDON(Medical_Treatment)) >> "IV";
private _ivConfig = _defaultConfig >> _className;
private _painReduce = GET_NUMBER(_ivConfig >> "painReduce",getNumber (_defaultConfig >> "painReduce") * _IVflow);
private _timeInSystem = GET_NUMBER(_ivConfig >> "timeInSystem",getNumber (_defaultConfig >> "timeInSystem") * _IVflow);
private _timeTillMaxEffect = GET_NUMBER(_ivConfig >> "timeTillMaxEffect",getNumber (_defaultConfig >> "timeTillMaxEffect") * _IVflow);
private _viscosityChange = GET_NUMBER(_ivConfig >> "viscosityChange",getNumber (_defaultConfig >> "viscosityChange") * _IVflow);
private _hrIncreaseLow = GET_ARRAY(_ivConfig >> "hrIncreaseLow",getArray (_defaultConfig >> "hrIncreaseLow") * _IVflow);
private _hrIncreaseNormal = GET_ARRAY(_ivConfig >> "hrIncreaseNormal",getArray (_defaultConfig >> "hrIncreaseNormal") * _IVflow);
private _hrIncreaseHigh = GET_ARRAY(_ivConfig >> "hrIncreaseHigh",getArray (_defaultConfig >> "hrIncreaseHigh") * _IVflow);
private _alphaFactor = GET_NUMBER(_ivConfig >> "alphaFactor",getNumber (_defaultConfig >> "alphaFactor") * _IVflow);
private _maxRelief = GET_NUMBER(_ivConfig >> "maxRelief",getNumber (_defaultConfig >> "maxRelief") * _IVflow);
private _opioidRelief = GET_NUMBER(_ivConfig >> "opioidRelief",getNumber (_defaultConfig >> "opioidRelief") * _IVflow);
private _opioidEffect = GET_NUMBER(_ivConfig >> "opioidEffect",getNumber (_defaultConfig >> "opioidEffect") * _IVflow);
private _viscosity = GET_NUMBER(_ivConfig >> "viscosity",getNumber (_defaultConfig >> "viscosity"));
private _heartRate = GET_HEART_RATE(_patient);
private _hrIncrease = [_hrIncreaseLow, _hrIncreaseNormal, _hrIncreaseHigh] select (floor ((0 max _heartRate min 110) / 55));
_hrIncrease params ["_minIncrease", "_maxIncrease"];
private _heartRateChange = _minIncrease + random (_maxIncrease - _minIncrease);

private _presentPain = GET_PAIN(_patient);
private _presentReduce = 0;
if (_maxRelief > 0) then {
if (_presentPain > _maxRelief) then {
_painReduce = _painReduce / 4;
};
};
private _medicationParts = _className splitString "_";
private _baseName = (_medicationParts select 0);
private _medicationName = (_baseName splitString "Infusion") select 0;
TRACE_3("adjustments",_heartRateChange,_painReduce,_viscosityChange);
[_patient, _medicationName, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange, _dose, _alphaFactor, _opioidRelief, _opioidEffect, _opioidDepression, _respiratoryRate] call EFUNC(vitals,addMedicationAdjustment);
[_patient, _medicationName, _incompatibleMedication] call ACEFUNC(medical_treatment,onMedicationUsage);
private _bagChange = (_flowCalculation * (_IVflow select _bodyPart) * _viscosity) min _bagVolumeRemaining; // absolute value of the change in miliLiters
_bagVolumeRemaining = _bagVolumeRemaining - _bagChange;
_incomingFlowAmount set [_bodyPart, ((_incomingFlowAmount select _bodyPart) + _bagChange)];

private _incomingFlowDifference = _incomingFlowAmount - 10;

if ((_incomingFlowAmount select _bodyPart) > (10 * _vasoconstriction)) then {[_unit, _bodyPart , _incomingFlowDifference] call FUNC(handleLimbIVComplications)};

if (_hypothermia) then {
if (_fluidWarmer select _bodyPart == 1) then {
_incomingVolumeChange set [_bodyPart, ((_incomingVolumeChange select _bodyPart) + _bagChange)];
} else {
_incomingVolumeChange set [_bodyPart, ((_incomingVolumeChange select _bodyPart) - _bagChange)];
};
};
if (_enableFluidShift) then {
_ECP = _ECP + _bagChange / 2;
_ISP = _ISP + _bagChange / 2;
_lossVolumeChange = _lossVolumeChange + (_bagChange / 2000);
} else {
{ _ECP = _ECP + _bagChange; _lossVolumeChange = _lossVolumeChange + (_bagChange / ML_TO_LITERS); };
};
};
}

if (_bagVolumeRemaining < 0.01) then {
[]
Expand Down

0 comments on commit 196f6fd

Please sign in to comment.