Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Cplhardcore committed Dec 17, 2024
1 parent 99f8009 commit 56256c8
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 7 deletions.
3 changes: 3 additions & 0 deletions addons/circulation/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions addons/circulation/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ PREP(handleCardiacArrest);
PREP(handleRespawn);
PREP(handleTreatment);
PREP(init);
PREP(ivBagLocal);
PREP(measureBloodPressure);
PREP(onCloseDialog);
PREP(placeAED_PickUpAction);
Expand Down
52 changes: 52 additions & 0 deletions addons/circulation/functions/fnc_ivBagLocal.sqf
Original file line number Diff line number Diff line change
@@ -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 <OBJECT>
* 1: Body Part <STRING>
* 2: Treatment <STRING>
* 3: Medic <OBJECT>
*
* 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);

Check failure on line 30 in addons/circulation/functions/fnc_ivBagLocal.sqf

View workflow job for this annotation

GitHub Actions / build

function call with incorrect number of arguments

called with 4 arguments
} 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];
2 changes: 1 addition & 1 deletion addons/circulation/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 7 additions & 5 deletions addons/gui/functions/fnc_updateInjuryList.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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), []]);
Expand All @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion addons/pharma/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 56256c8

Please sign in to comment.