Skip to content

Commit

Permalink
Medical Treatment - Return IV bags when applicable (acemod#10407)
Browse files Browse the repository at this point in the history
* Small iv fix

* Documentation fixes

* Use same logic as tourniquet removal

* Author header

* Grim Fixes

* Update fnc_healingLogic.sqf

---------

Co-authored-by: Grim <[email protected]>
Co-authored-by: johnb432 <[email protected]>
  • Loading branch information
3 people authored Oct 15, 2024
1 parent 0726304 commit d934333
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion addons/medical_ai/functions/fnc_healingLogic.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ if (true) then {
if (_canGiveIV) exitWith {
_treatmentEvent = QEGVAR(medical_treatment,ivBagLocal);
_treatmentTime = 5;
_treatmentArgs = [_target, _bodyPart, "SalineIV"];
_treatmentArgs = [_target, _bodyPart, "SalineIV", _healer];
_treatmentItem = "@iv";
};

Expand Down
2 changes: 1 addition & 1 deletion addons/medical_treatment/functions/fnc_ivBag.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ params ["_medic", "_patient", "_bodyPart", "_classname", "", "_usedItem"];
[_patient, _usedItem] call FUNC(addToTriageCard);
[_patient, "activity", LSTRING(Activity_gaveIV), [[_medic, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);

[QGVAR(ivBagLocal), [_patient, _bodyPart, _classname], _patient] call CBA_fnc_targetEvent;
[QGVAR(ivBagLocal), [_patient, _bodyPart, _classname, _medic], _patient] call CBA_fnc_targetEvent;
20 changes: 16 additions & 4 deletions addons/medical_treatment/functions/fnc_ivBagLocal.sqf
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
#include "..\script_component.hpp"
/*
* Author: Glowbal, mharis001
* 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"] call ace_medical_treatment_fnc_ivBagLocal
* [player, "RightArm", "BloodIV", player] call ace_medical_treatment_fnc_ivBagLocal
*
* Public: No
*/

params ["_patient", "_bodyPart", "_classname"];
params ["_patient", "_bodyPart", "_classname", "_medic"];

// Exit if patient has max blood volume
private _bloodVolume = GET_BLOOD_VOLUME(_patient);
if (_bloodVolume >= DEFAULT_BLOOD_VOLUME) exitWith {};
if (_bloodVolume >= DEFAULT_BLOOD_VOLUME) exitWith {
// Return the bag if patient is topped up on blood
if (_medic call EFUNC(common,isPlayer)) then {
private _receiver = [_patient, _medic, _medic] select GVAR(allowSharedEquipment);
[_receiver, _classname] call EFUNC(common,addToInventory);
} 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;

Expand Down

0 comments on commit d934333

Please sign in to comment.