From 56256c801f3e7e9e33bb203b7f721cdd4552def0 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Mon, 16 Dec 2024 20:52:59 -0800 Subject: [PATCH] Updated --- addons/circulation/CfgFunctions.hpp | 3 ++ addons/circulation/XEH_PREP.hpp | 1 + .../circulation/functions/fnc_ivBagLocal.sqf | 52 +++++++++++++++++++ addons/circulation/script_component.hpp | 2 +- addons/gui/functions/fnc_updateInjuryList.sqf | 12 +++-- .../pharma/ACE_Medical_Treatment_Actions.hpp | 2 +- 6 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 addons/circulation/functions/fnc_ivBagLocal.sqf diff --git a/addons/circulation/CfgFunctions.hpp b/addons/circulation/CfgFunctions.hpp index 4db609314..e1804f247 100644 --- a/addons/circulation/CfgFunctions.hpp +++ b/addons/circulation/CfgFunctions.hpp @@ -8,6 +8,9 @@ class CfgFunctions { class cprSuccess { file = QPATHTOF(functions\fnc_cprSuccess.sqf); }; + class ivBagLocal { + file = QPATHTOF(functions\fnc_ivBagLocal.sqf); + }; }; }; class overwrite_ace_medical_status { diff --git a/addons/circulation/XEH_PREP.hpp b/addons/circulation/XEH_PREP.hpp index 7802009e4..8c35c00d4 100644 --- a/addons/circulation/XEH_PREP.hpp +++ b/addons/circulation/XEH_PREP.hpp @@ -39,6 +39,7 @@ PREP(handleCardiacArrest); PREP(handleRespawn); PREP(handleTreatment); PREP(init); +PREP(ivBagLocal); PREP(measureBloodPressure); PREP(onCloseDialog); PREP(placeAED_PickUpAction); diff --git a/addons/circulation/functions/fnc_ivBagLocal.sqf b/addons/circulation/functions/fnc_ivBagLocal.sqf new file mode 100644 index 000000000..90b549fac --- /dev/null +++ b/addons/circulation/functions/fnc_ivBagLocal.sqf @@ -0,0 +1,52 @@ +#include "..\script_component.hpp" +/* + * Author: Glowbal, mharis001, Cplhardcore + * Local callback for administering an IV bag to a patient. + * + * Arguments: + * 0: Patient + * 1: Body Part + * 2: Treatment + * 3: Medic + * + * Return Value: + * None + * + * Example: + * [player, "RightArm", "BloodIV", player] call ace_medical_treatment_fnc_ivBagLocal + * + * Public: No + */ + +params ["_patient", "_bodyPart", "_classname", "_medic"]; + +// Exit if patient has max blood volume +private _bloodVolume = GET_BLOOD_VOLUME_LITERS(_patient); +if (_bloodVolume >= DEFAULT_BLOOD_VOLUME) exitWith { + // Return the bag if patient is topped up on blood + if (_medic call ACEFUNC(common,isPlayer)) then { + private _receiver = [_patient, _medic, _medic] select GVAR(allowSharedEquipment); + [_receiver, _classname] call EFUNC(common,addToInventory); + TRACE_4("ivBagLocal"_patient,_medic,_receiver,_classname); + } else { + // If the medic is AI, only return bag if enabled + if (missionNamespace getVariable [QEGVAR(medical_ai,requireItems), 0] > 0) then { + [_medic, _classname] call EFUNC(common,addToInventory); + }; + }; +}; + +private _partIndex = ALL_BODY_PARTS find toLowerANSI _bodyPart; + +// Get attributes for the used IV +private _defaultConfig = configFile >> QUOTE(ADDON) >> "IV"; +private _ivConfig = _defaultConfig >> _classname; + +private _volume = GET_NUMBER(_ivConfig >> "volume",getNumber (_defaultConfig >> "volume")); +private _type = GET_STRING(_ivConfig >> "type",getText (_defaultConfig >> "type")); +private _rateCoef = GET_NUMBER(_ivConfig >> "rateCoef",getNumber (_defaultConfig >> "rateCoef")); + +// Add IV bag to patient's ivBags array +private _ivBags = _patient getVariable [QEGVAR(medical,ivBags), []]; +_ivBags pushBack [_volume, _type, _partIndex, _classname, _rateCoef]; +_patient setVariable [QEGVAR(medical,ivBags), _ivBags, true]; \ No newline at end of file diff --git a/addons/circulation/script_component.hpp b/addons/circulation/script_component.hpp index 40614c5b5..63b307028 100644 --- a/addons/circulation/script_component.hpp +++ b/addons/circulation/script_component.hpp @@ -3,7 +3,7 @@ #include "\x\kat\addons\main\script_mod.hpp" #include "\x\kat\addons\gui\gui_defines.hpp" -// #define DEBUG_MODE_FULL +#define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS diff --git a/addons/gui/functions/fnc_updateInjuryList.sqf b/addons/gui/functions/fnc_updateInjuryList.sqf index d638896d3..bf18c7559 100644 --- a/addons/gui/functions/fnc_updateInjuryList.sqf +++ b/addons/gui/functions/fnc_updateInjuryList.sqf @@ -81,6 +81,8 @@ private _totalIvVolume = 0; private _saline = 0; private _blood = 0; private _plasma = 0; +private _ringers = 0; +private _packedRBC = 0; { _x params ["_volumeRemaining", "_type"]; switch (_type) do { @@ -93,12 +95,12 @@ private _plasma = 0; case "Plasma": { _plasma = _plasma + _volumeRemaining; }; - case "PackedRBC": { - _packedRBC = _packedRBC + _volumeRemaining; - }; case "Ringers Lactate": { _ringers = _ringers + _volumeRemaining; }; + case "PackedRBC": { + _packedRBC = _packedRBC + _volumeRemaining; + }; }; _totalIvVolume = _totalIvVolume + _volumeRemaining; } forEach (_target getVariable [QACEGVAR(medical,ivBags), []]); @@ -114,10 +116,10 @@ if (_totalIvVolume > 0) then { _entries pushBack [format [localize ACELSTRING(medical_treatment,receivingPlasmaIvVolume), floor _plasma], [1, 1, 1, 1]]; }; if (_ringers > 0) then { - _entries pushBack [format [localize ELSTRING(pharma,receivingPacked_RBCIvVolume), floor _plasma], [1, 1, 1, 1]]; + _entries pushBack [format [localize ELSTRING(pharma,receivingRingers_LactateIvVolume), floor _ringers], [1, 1, 1, 1]]; }; if (_packedRBC > 0) then { - _entries pushBack [format [localize ELSTRING(pharma,receivingRingers_LactateIvVolume), floor _plasma], [1, 1, 1, 1]]; + _entries pushBack [format [localize ELSTRING(pharma,receivingPacked_RBCIvVolume), floor _packedRBC], [1, 1, 1, 1]]; }; } else { _entries pushBack [localize ACELSTRING(medical_treatment,Status_NoIv), _nonissueColor]; diff --git a/addons/pharma/ACE_Medical_Treatment_Actions.hpp b/addons/pharma/ACE_Medical_Treatment_Actions.hpp index a78da3e08..9fc627d3d 100644 --- a/addons/pharma/ACE_Medical_Treatment_Actions.hpp +++ b/addons/pharma/ACE_Medical_Treatment_Actions.hpp @@ -43,7 +43,7 @@ class ACE_Medical_Treatment_Actions { displayNameProgress = CSTRING(Transfusing_Packed_RBC); callbackSuccess = "[_medic, _patient, _bodyPart, _className, _itemUser, _usedItem] call ace_medical_treatment_fnc_ivBag; [_patient, -400, 16, _className] call kat_pharma_fnc_fluid;"; }; - class PackedRBC_250: BloodIV { + class PackedRBCIV_250: BloodIV { displayName = CSTRING(Actions_Packed_RBC_250); items[] = {"kat_PackedRBCIV_250"}; displayNameProgress = CSTRING(Transfusing_Packed_RBC);