diff --git a/.hemtt/launch.toml b/.hemtt/launch.toml index 599ddc3f4..7de216440 100644 --- a/.hemtt/launch.toml +++ b/.hemtt/launch.toml @@ -10,3 +10,10 @@ extends = "default" workshop = [ "843577117", # RHS USAF Workshop ID ] + +[anrop] +workshop = [ + "450814997", # CBA_A3's Workshop ID + "1882627645", # Anrop ACE3's Workshop ID + "2369477168" # Advanced Developer Tools's Workshop ID +] diff --git a/addons/gui/functions/fnc_menuPFH.sqf b/addons/gui/functions/fnc_menuPFH.sqf index ee3949318..76739dadd 100644 --- a/addons/gui/functions/fnc_menuPFH.sqf +++ b/addons/gui/functions/fnc_menuPFH.sqf @@ -25,6 +25,7 @@ if !( // Show hint if distance condition failed if ((ACE_player distance ACEGVAR(medical_gui,target) > ACEGVAR(medical_gui,maxDistance)) && {vehicle ACE_player != vehicle ACEGVAR(medical_gui,target)}) then { if (((getPosATL ACEGVAR(medical_gui,target)) # 2) < -9) exitWith {}; // handle dragging corpse/clone + [[ACELSTRING(medical,DistanceToFar), ACEGVAR(medical_gui,target) call ACEFUNC(common,getName)], 2] call ACEFUNC(common,displayTextStructured); }; }; diff --git a/addons/gui/functions/fnc_updateBodyImage.sqf b/addons/gui/functions/fnc_updateBodyImage.sqf index b21a3332c..604bf9aca 100644 --- a/addons/gui/functions/fnc_updateBodyImage.sqf +++ b/addons/gui/functions/fnc_updateBodyImage.sqf @@ -78,12 +78,22 @@ private _surgicalBlock = GET_SURGICAL_TOURNIQUETS(_target); [_bloodLoss] call ACEFUNC(medical_gui,bloodLossToRGBA); } else { private _damage = _bodyPartDamage select _forEachIndex; + // _damageThreshold here indicates how close unit is to guaranteed death via sum of trauma, so use the same multipliers used in medical_damage/functions/fnc_determineIfFatal.sqf + // TODO: make multipliers for head and torso a macro in medical_engine/script_macros_medical.hpp switch (true) do { // torso damage threshold doesn't need scaling case (_forEachIndex > 3): { // legs: index 4 & 5 - _damageThreshold = LIMPING_DAMAGE_THRESHOLD * 4; + if (ACEGVAR(medical,limbDamageThreshold) != 0 && {[false, !isPlayer _target, true] select ACEGVAR(medical,useLimbDamage)}) then { // Just indicate how close to the limping threshold we are + _damageThreshold = _damageThreshold * EGVAR(medical,limbDamageThreshold); + } else { + _damageThreshold = LIMPING_DAMAGE_THRESHOLD * 4; + }; }; case (_forEachIndex > 1): { // arms: index 2 & 3 - _damageThreshold = FRACTURE_DAMAGE_THRESHOLD * 4; + if (ACEGVAR(medical,limbDamageThreshold) != 0 && {[false, !isPlayer _target, true] select ACEGVAR(medical,useLimbDamage)}) then { // Just indicate how close to the fracture threshold we are + _damageThreshold = _damageThreshold * ACEGVAR(medical,limbDamageThreshold); + } else { + _damageThreshold = FRACTURE_DAMAGE_THRESHOLD * 4; + }; }; case (_forEachIndex == 0): { // head: index 0 _damageThreshold = _damageThreshold * 1.25; @@ -107,4 +117,4 @@ private _surgicalBlock = GET_SURGICAL_TOURNIQUETS(_target); [IDC_BODY_LEGRIGHT, IDC_BODY_LEGRIGHT_S, IDC_BODY_LEGRIGHT_T, IDC_BODY_LEGRIGHT_B] ]; -[QACEGVAR(medical_gui,updateBodyImage), [_ctrlGroup, _target, _selectionN]] call CBA_fnc_localEvent; \ No newline at end of file +[QACEGVAR(medical_gui,updateBodyImage), [_ctrlGroup, _target, _selectionN]] call CBA_fnc_localEvent; diff --git a/addons/gui/functions/fnc_updateInjuryList.sqf b/addons/gui/functions/fnc_updateInjuryList.sqf index 55511183e..3efb0d8d4 100644 --- a/addons/gui/functions/fnc_updateInjuryList.sqf +++ b/addons/gui/functions/fnc_updateInjuryList.sqf @@ -167,10 +167,18 @@ if (ACEGVAR(medical_gui,showDamageEntry)) then { private _damageThreshold = GET_DAMAGE_THRESHOLD(_target); switch (true) do { case (_selectionN > 3): { // legs: index 4 & 5 - _damageThreshold = LIMPING_DAMAGE_THRESHOLD_DEFAULT * 4; + if (ACEGVAR(medical,limbDamageThreshold) != 0 && {[false, !isPlayer _target, true] select ACEGVAR(medical,useLimbDamage)}) then { // Just indicate how close to the limping threshold we are + _damageThreshold = _damageThreshold * ACEGVAR(medical,limbDamageThreshold); + } else { + _damageThreshold = FRACTURE_DAMAGE_THRESHOLD * 4; + }; }; case (_selectionN > 1): { // arms: index 2 & 3 - _damageThreshold = FRACTURE_DAMAGE_THRESHOLD_DEFAULT * 4; + if (ACEGVAR(medical,limbDamageThreshold) != 0 && {[false, !isPlayer _target, true] select ACEGVAR(medical,useLimbDamage)}) then { // Just indicate how close to the fracture threshold we are + _damageThreshold = _damageThreshold * ACEGVAR(medical,limbDamageThreshold); + } else { + _damageThreshold = FRACTURE_DAMAGE_THRESHOLD * 4; + }; }; case (_selectionN == 0): { // head: index 0 _damageThreshold = _damageThreshold * 1.25; diff --git a/addons/misc/functions/fnc_treatment.sqf b/addons/misc/functions/fnc_treatment.sqf index 8fb36e982..7f9882115 100644 --- a/addons/misc/functions/fnc_treatment.sqf +++ b/addons/misc/functions/fnc_treatment.sqf @@ -51,7 +51,7 @@ if (_treatmentTime == 0) exitWith {false}; private _userAndItem = if (GET_NUMBER_ENTRY(_config >> "consumeItem") == 1) then { [_medic, _patient, getArray (_config >> "items")] call ACEFUNC(medical_treatment,useItem); } else { - [objNull, ""]; // Treatment does not require items to be consumed + [objNull, "", false]; // Treatment does not require items to be consumed }; // Patient Animation Added from Old Ace diff --git a/addons/misc/functions/fnc_treatmentIV.sqf b/addons/misc/functions/fnc_treatmentIV.sqf index 67009af14..32bc9d9af 100644 --- a/addons/misc/functions/fnc_treatmentIV.sqf +++ b/addons/misc/functions/fnc_treatmentIV.sqf @@ -32,4 +32,4 @@ switch (_className) do { }; [_player, _value] call FUNC(removeIVbag); -[_player, _target, _bodyPart, _className, objNull, _item] call ACEFUNC(medical_treatment,ivBag); +[_player, _target, _bodyPart, _className, _player, _item] call ACEFUNC(medical_treatment,ivBag); diff --git a/addons/misc/functions/fnc_useItem.sqf b/addons/misc/functions/fnc_useItem.sqf index 74abae626..8f8b9ff55 100644 --- a/addons/misc/functions/fnc_useItem.sqf +++ b/addons/misc/functions/fnc_useItem.sqf @@ -21,12 +21,17 @@ params ["_medic", "_patient", "_items"]; if (_medic isEqualTo player && {!isNull findDisplay 312}) exitWith { - [_medic, _items select 0] + [_medic, _items select 0, false] }; scopeName "Main"; -private _sharedUseOrder = [[_patient, _medic], [_medic, _patient], [_medic]] select ACEGVAR(medical_treatment,allowSharedEquipment); +private _sharedUseOrder = [[_patient, _medic], + [_medic, _patient], + [_medic], + ([[_patient, _medic],[_medic, _patient]] select ([_medic] call ACEFUNC(medical_treatment,isMedic))) +] select ACEGVAR(medical_treatment,allowSharedEquipment); + private _useOrder = []; private _vehicle = objectParent _medic; diff --git a/addons/pharma/ACE_Medical_Treatment.hpp b/addons/pharma/ACE_Medical_Treatment.hpp index eb0689565..d34f94e7a 100644 --- a/addons/pharma/ACE_Medical_Treatment.hpp +++ b/addons/pharma/ACE_Medical_Treatment.hpp @@ -16,6 +16,8 @@ class ACE_ADDON(Medical_Treatment) { // 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; + // The dose of the medication, to allow for different dose amounts of the same medication + dose = 1; // 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 diff --git a/addons/pharma/functions/fnc_applyIV.sqf b/addons/pharma/functions/fnc_applyIV.sqf index e491ed6bc..53b0bc254 100644 --- a/addons/pharma/functions/fnc_applyIV.sqf +++ b/addons/pharma/functions/fnc_applyIV.sqf @@ -49,13 +49,41 @@ if (_usedItem isEqualTo "kat_IV_16") then { _IVarray set [_partIndex, 1]; _patient setVariable [QGVAR(IV), _IVarray, true]; - private _lidocaineCount = [_patient, "Lidocaine", false] call ACEFUNC(medical_status,getMedicationCount); - private _morphineCount = [_patient, "Morphine", false] call ACEFUNC(medical_status,getMedicationCount); - private _nalbuphineCount = [_patient, "Nalbuphine", false] call ACEFUNC(medical_status,getMedicationCount); - private _fentanylCount = [_patient, "Fentanyl", false] call ACEFUNC(medical_status,getMedicationCount); - private _ketamineCount = [_patient, "Ketamine", false] call ACEFUNC(medical_status,getMedicationCount); - if (_lidocaineCount <= 0.6 && _morphineCount <= 0.6 && _nalbuphineCount <= 0.6 && _fentanylCount <= 0.6 && _ketamineCount <= 0.6) then {[_patient, 0.8] call ACEFUNC(medical_status,adjustPainLevel)}; - + private _medStack = _patient call ACEFUNC(medical_treatment,getAllMedicationCount); + private _medsToCheck = ["fentanyl", "ketamine", "nalbuphine", "morphine", "lidocaine"]; + private _fentanylEffectiveness = 0; + private _ketamineEffectiveness = 0; + private _nalbuphineEffectiveness = 0; + private _morphineEffectiveness = 0; + private _lidocaineEffectiveness = 0; + { + private _medName = toLower (_x select 0); + private _effectiveness = _x select 2; + if ("fentanyl" in _medName) then { + _fentanylEffectiveness = _fentanylEffectiveness max _effectiveness; + }; + if ("ketamine" in _medName) then { + _ketamineEffectiveness = _ketamineEffectiveness max _effectiveness; + }; + if ("nalbuphine" in _medName) then { + _nalbuphineEffectiveness = _nalbuphineEffectiveness max _effectiveness; + }; + if ("morphine" in _medName) then { + _morphineEffectiveness = _morphineEffectiveness max _effectiveness; + }; + if ("lidocaine" in _medName) then { + _lidocaineEffectiveness = _lidocaineEffectiveness max _effectiveness; + }; + } forEach _medStack; + if ( + _fentanylEffectiveness <= 0.6 && + _ketamineEffectiveness <= 0.6 && + _nalbuphineEffectiveness <= 0.6 && + _lidocaineEffectiveness <= 0.6 && + _morphineEffectiveness <= 0.6 + ) then { + [_patient, [0.6, 0.7, 0.8] select (floor random 3)] call ACEFUNC(medical_status,adjustPainLevel); + }; [_patient, "activity", LSTRING(iv_log), [[_medic] call ACEFUNC(common,getName), "FAST IO"]] call ACEFUNC(medical_treatment,addToLog); [_patient, "FAST IO"] call ACEFUNC(medical_treatment,addToTriageCard); }; diff --git a/addons/pharma/functions/fnc_clotWound.sqf b/addons/pharma/functions/fnc_clotWound.sqf index 9152bdbe4..e8e08c7e6 100644 --- a/addons/pharma/functions/fnc_clotWound.sqf +++ b/addons/pharma/functions/fnc_clotWound.sqf @@ -113,8 +113,8 @@ private _fnc_clotWound = { private _openWounds = _unit getVariable [VAR_OPEN_WOUNDS, createHashMap]; private _pulse = _unit getVariable [VAR_HEART_RATE, 80]; private _coagulationFactor = _unit getVariable [QGVAR(coagulationFactor), 30]; - private _countTXA = [_unit, "TXA"] call ACEFUNC(medical_status,getMedicationCount); - private _countEACA = [_unit, "EACA"] call ACEFUNC(medical_status,getMedicationCount); + private _countTXA = ([_unit, "TXA"] call ACEFUNC(medical_status,getMedicationCount)) select 1; + private _countEACA = ([_unit, "EACA"] call ACEFUNC(medical_status,getMedicationCount)) select 1; private _hasWoundToBandageArray = []; if (_openWounds isEqualTo createHashMap) exitWith {}; // Exit when hashmap not initialized (Will not work when hashmap is set, cause ace only changes value of "woundCount" to 0) diff --git a/addons/pharma/functions/fnc_getBloodVolumeChange.sqf b/addons/pharma/functions/fnc_getBloodVolumeChange.sqf index cb3de9ef2..ad21e6d65 100644 --- a/addons/pharma/functions/fnc_getBloodVolumeChange.sqf +++ b/addons/pharma/functions/fnc_getBloodVolumeChange.sqf @@ -44,7 +44,7 @@ if (!isNil {_unit getVariable [QACEGVAR(medical,ivBags),[]]}) then { private _fluidHeat = 0; _bloodBags = _bloodBags apply { - _x params ["_bagVolumeRemaining", "_type", "_bodyPart"]; + _x params ["_bagVolumeRemaining", "_type", "_bodyPart", "_treatment", "_rateCoef", "_item"]; private _tourniquets = GET_TOURNIQUETS(_unit); @@ -65,13 +65,13 @@ if (!isNil {_unit getVariable [QACEGVAR(medical,ivBags),[]]}) then { // Plasma adds to ECP. Saline splits between the ECP and ISP. Blood adds to ECB switch (true) do { case(_type == "Plasma"): { _ECP = _ECP + _bagChange; _lossVolumeChange = _lossVolumeChange + (_bagChange / ML_TO_LITERS); }; - case(_type == "Saline"): { + case(_type == "Saline"): { if (_enableFluidShift) then { - _ECP = _ECP + _bagChange / 2; - _ISP = _ISP + _bagChange / 2; + _ECP = _ECP + _bagChange / 2; + _ISP = _ISP + _bagChange / 2; _lossVolumeChange = _lossVolumeChange + (_bagChange / 2000); } else { - _ECP = _ECP + _bagChange; + _ECP = _ECP + _bagChange; _lossVolumeChange = _lossVolumeChange + (_bagChange / ML_TO_LITERS); }; }; @@ -82,7 +82,7 @@ if (!isNil {_unit getVariable [QACEGVAR(medical,ivBags),[]]}) then { if (_bagVolumeRemaining < 0.01) then { [] } else { - [_bagVolumeRemaining, _type, _bodyPart] + [_bagVolumeRemaining, _type, _bodyPart, _treatment, _rateCoef, _item] }; }; @@ -142,7 +142,7 @@ if (_enableFluidShift) then { if (_defaultShift) then { _ISP = _ISP + ((((DEFAULT_ISP - _ISP) max -2) min 2) *_deltaT); - _SRBC = _SRBC + ((((DEFAULT_SRBC - _SRBC) max -1) min 1) * _deltaT); + _SRBC = _SRBC + ((((DEFAULT_SRBC - _SRBC) max -1) min 1) * _deltaT); }; }; diff --git a/addons/pharma/functions/fnc_medicationLocal.sqf b/addons/pharma/functions/fnc_medicationLocal.sqf index 3c42367e6..a1ba7db21 100644 --- a/addons/pharma/functions/fnc_medicationLocal.sqf +++ b/addons/pharma/functions/fnc_medicationLocal.sqf @@ -82,8 +82,6 @@ private _medicationConfig = _defaultConfig >> _classname; private _painReduce = GET_NUMBER(_medicationConfig >> "painReduce",getNumber (_defaultConfig >> "painReduce")); 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")); @@ -93,6 +91,7 @@ private _alphaFactor = GET_NUMBER(_medicationConfig >> "alphaFactor", private _maxRelief = GET_NUMBER(_medicationConfig >> "maxRelief",getNumber (_defaultConfig >> "maxRelief")); private _opioidRelief = GET_NUMBER(_medicationConfig >> "opioidRelief",getNumber (_defaultConfig >> "opioidRelief")); private _opioidEffect = GET_NUMBER(_medicationConfig >> "opioidEffect",getNumber (_defaultConfig >> "opioidEffect")); +private _dose = GET_NUMBER(_medicationConfig >> "dose",getNumber (_defaultConfig >> "dose")); private _heartRate = GET_HEART_RATE(_patient); private _hrIncrease = [_hrIncreaseLow, _hrIncreaseNormal, _hrIncreaseHigh] select (floor ((0 max _heartRate min 110) / 55)); @@ -109,10 +108,10 @@ if (_maxRelief > 0) then { // Adjust the medication effects and add the medication to the list TRACE_3("adjustments",_heartRateChange,_painReduce,_viscosityChange); -[_patient, _className, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange, _alphaFactor, _opioidRelief, _opioidEffect] call EFUNC(vitals,addMedicationAdjustment); +[_patient, _className, _timeTillMaxEffect, _timeInSystem, _heartRateChange, _painReduce, _viscosityChange, _dose, _alphaFactor, _opioidRelief, _opioidEffect] call EFUNC(vitals,addMedicationAdjustment); // Check for medication compatiblity -[_patient, _className, _maxDose, _maxDoseDeviation, _incompatibleMedication] call ACEFUNC(medical_treatment,onMedicationUsage); +[_patient, _className, _incompatibleMedication] call ACEFUNC(medical_treatment,onMedicationUsage); if (_className in ["Lorazepam","EACA","TXA","Atropine","Amiodarone","Flumazenil"]) then { [format ["kat_pharma_%1Local", toLower _className], [_patient, _bodyPart], _patient] call CBA_fnc_targetEvent; diff --git a/addons/pharma/functions/fnc_tourniquetRemove.sqf b/addons/pharma/functions/fnc_tourniquetRemove.sqf index e15a5e54b..ea2b120be 100644 --- a/addons/pharma/functions/fnc_tourniquetRemove.sqf +++ b/addons/pharma/functions/fnc_tourniquetRemove.sqf @@ -42,7 +42,9 @@ TRACE_1("clearConditionCaches: tourniquetRemove",_nearPlayers); // Add tourniquet item to medic or patient if (_medic call ACEFUNC(common,isPlayer)) then { - private _receiver = [_patient, _medic, _medic] select ACEGVAR(medical_treatment,allowSharedEquipment); + private _allowSharedEquipment = ACEGVAR(medical_treatment,allowSharedEquipment); + if (_allowSharedEquipment == 3) then { _allowSharedEquipment = [0, 1] select ([_medic] call ACEFUNC(medical_treatment,isMedic)) }; + private _receiver = [_patient, _medic, _medic] select _allowSharedEquipment; [_receiver, "ACE_tourniquet"] call ACEFUNC(common,addToInventory); } else { // If the medic is AI, only return tourniquet if enabled diff --git a/addons/pharma/functions/fnc_treatmentAdvanced_EACALocal.sqf b/addons/pharma/functions/fnc_treatmentAdvanced_EACALocal.sqf index 2a815a6df..b323af682 100644 --- a/addons/pharma/functions/fnc_treatmentAdvanced_EACALocal.sqf +++ b/addons/pharma/functions/fnc_treatmentAdvanced_EACALocal.sqf @@ -21,7 +21,7 @@ params ["_patient", "_bodyPart"]; private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; private _IVarray = _patient getVariable [QGVAR(IV), [0,0,0,0,0,0]]; private _IVactual = _IVarray select _partIndex; -private _countEACA = [_patient, "EACA"] call ACEFUNC(medical_status,getMedicationCount); +private _countEACA = ([_patient, "EACA"] call ACEFUNC(medical_status,getMedicationCount)) select 1; private _allowStack = missionNamespace getVariable [QGVAR(allowStackScript_EACA), true]; private _keepRunning = missionNamespace getVariable [QGVAR(keepScriptRunning_EACA), false]; private _cycleTime = missionNamespace getVariable [QGVAR(bandageCycleTime_EACA), 5]; diff --git a/addons/pharma/functions/fnc_treatmentAdvanced_TXALocal.sqf b/addons/pharma/functions/fnc_treatmentAdvanced_TXALocal.sqf index c52d0a4be..bfafc7a4b 100644 --- a/addons/pharma/functions/fnc_treatmentAdvanced_TXALocal.sqf +++ b/addons/pharma/functions/fnc_treatmentAdvanced_TXALocal.sqf @@ -21,7 +21,7 @@ params ["_patient", "_bodyPart"]; private _partIndex = ALL_BODY_PARTS find toLower _bodyPart; private _IVarray = _patient getVariable [QGVAR(IV), [0,0,0,0,0,0]]; private _IVactual = _IVarray select _partIndex; -private _countTXA = [_patient, "TXA"] call ACEFUNC(medical_status,getMedicationCount); +private _countTXA = ([_patient, "TXA"] call ACEFUNC(medical_status,getMedicationCount)) select 1; private _allowStack = missionNamespace getVariable [QGVAR(allowStackScript_TXA), true]; private _keepRunning = missionNamespace getVariable [QGVAR(keepScriptRunning_TXA), false]; private _cycleTime = missionNamespace getVariable [QGVAR(bandageCycleTime_TXA), 5]; diff --git a/addons/surgery/functions/fnc_closedReductionLocal.sqf b/addons/surgery/functions/fnc_closedReductionLocal.sqf index 9446413f6..d9d448037 100644 --- a/addons/surgery/functions/fnc_closedReductionLocal.sqf +++ b/addons/surgery/functions/fnc_closedReductionLocal.sqf @@ -22,15 +22,41 @@ params ["_medic", "_patient", "_bodyPart"]; private _part = ALL_BODY_PARTS find toLower _bodyPart; private _activeFracture = GET_FRACTURES(_patient); private _fractureArray = _patient getVariable [QGVAR(fractures), [0,0,0,0,0,0]]; -private _lidocaineCount = [_patient, "Lidocaine", false] call ACEFUNC(medical_status,getMedicationCount); -private _morphineCount = [_patient, "Morphine", false] call ACEFUNC(medical_status,getMedicationCount); -private _nalbuphineCount = [_patient, "Nalbuphine", false] call ACEFUNC(medical_status,getMedicationCount); -private _fentanylCount = [_patient, "Fentanyl", false] call ACEFUNC(medical_status,getMedicationCount); -private _ketamineCount = [_patient, "Ketamine", false] call ACEFUNC(medical_status,getMedicationCount); -if (_lidocaineCount <= 0.6 && _morphineCount <= 0.8 && _nalbuphineCount <= 0.8 && _fentanylCount <= 0.8 && _ketamineCount <= 0.8) then { - private _pain = random [0.7, 0.8, 0.9]; - [_patient, _pain] call ACEFUNC(medical_status,adjustPainLevel); -}; +private _medStack = _patient call ACEFUNC(medical_treatment,getAllMedicationCount); +private _medsToCheck = ["fentanyl", "ketamine", "nalbuphine", "morphine", "lidocaine"]; +private _fentanylEffectiveness = 0; +private _ketamineEffectiveness = 0; +private _nalbuphineEffectiveness = 0; +private _morphineEffectiveness = 0; +private _lidocaineEffectiveness = 0; +{ + private _medName = toLower (_x select 0); + private _effectiveness = _x select 2; + if ("fentanyl" in _medName) then { + _fentanylEffectiveness = _fentanylEffectiveness max _effectiveness; + }; + if ("ketamine" in _medName) then { + _ketamineEffectiveness = _ketamineEffectiveness max _effectiveness; + }; + if ("nalbuphine" in _medName) then { + _nalbuphineEffectiveness = _nalbuphineEffectiveness max _effectiveness; + }; + if ("morphine" in _medName) then { + _morphineEffectiveness = _morphineEffectiveness max _effectiveness; + }; + if ("lidocaine" in _medName) then { + _lidocaineEffectiveness = _lidocaineEffectiveness max _effectiveness; + }; + } forEach _medStack; + if ( + _fentanylEffectiveness <= 0.8 && + _ketamineEffectiveness <= 0.8 && + _nalbuphineEffectiveness <= 0.8 && + _lidocaineEffectiveness <= 0.8 && + _morphineEffectiveness <= 0.8 + ) then { + [_patient, [0.7, 0.8, 0.9] select (floor random 3)] call ACEFUNC(medical_status,adjustPainLevel); + }; playSound3D [QPATHTOF_SOUND(sounds\reduction.wav), _patient, false, getPosASL _patient, 8, 1, 15]; diff --git a/addons/surgery/functions/fnc_incisionLocal.sqf b/addons/surgery/functions/fnc_incisionLocal.sqf index e92d44dd2..8621f7f20 100644 --- a/addons/surgery/functions/fnc_incisionLocal.sqf +++ b/addons/surgery/functions/fnc_incisionLocal.sqf @@ -43,7 +43,7 @@ _patient setVariable [QGVAR(fractures), _fractureArray, true]; private _fractureArray = _patient getVariable [QGVAR(fractures), [0,0,0,0,0,0]]; private _liveFracture = _fractureArray select _part; - private _count = [_patient, "Etomidate", true] call ACEFUNC(medical_status,getMedicationCount); + private _count = ([_patient, "Etomidate", true] call ACEFUNC(medical_status,getMedicationCount)) select 1; private _alive = alive _patient; diff --git a/addons/vitals/functions/fnc_addMedicationAdjustment.sqf b/addons/vitals/functions/fnc_addMedicationAdjustment.sqf index c293d1345..9a4ca4a20 100644 --- a/addons/vitals/functions/fnc_addMedicationAdjustment.sqf +++ b/addons/vitals/functions/fnc_addMedicationAdjustment.sqf @@ -20,7 +20,7 @@ * * Public: No */ -params ["_unit", "_medication", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust", "_alphaFactor", "_opioidRelief", "_opioidEffect"]; +params ["_unit", "_medication", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust", "_dose", "_alphaFactor", "_opioidRelief", "_opioidEffect"]; TRACE_7("addMedicationAdjustment",_unit,_medication,_timeToMaxEffect,_maxTimeInSystem,_hrAdjust,_painAdjust,_flowAdjust); if (_maxTimeInSystem <= 0) exitWith { WARNING_1("bad value for _maxTimeInSystem - %1",_this); }; @@ -29,6 +29,6 @@ _timeToMaxEffect = _timeToMaxEffect max 1; private _adjustments = _unit getVariable [VAR_MEDICATIONS, []]; -_adjustments pushBack [_medication, CBA_missionTime, _timeToMaxEffect, _maxTimeInSystem, _hrAdjust, _painAdjust, _flowAdjust, _alphaFactor, _opioidRelief, _opioidEffect]; +_adjustments pushBack [_medication, CBA_missionTime, _timeToMaxEffect, _maxTimeInSystem, _hrAdjust, _painAdjust, _flowAdjust, _dose, _alphaFactor, _opioidRelief, _opioidEffect]; _unit setVariable [VAR_MEDICATIONS, _adjustments, true];