Skip to content

Commit

Permalink
Medical API - Add getter for IVs (#10553)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkIsGrim authored Dec 17, 2024
1 parent 23a19f4 commit a304e95
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions addons/medical/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PREP(deserializeState);
PREP(fullHeal);
PREP(getBandagedWounds);
PREP(getBloodLoss);
PREP(getIVs);
PREP(getOpenWounds);
PREP(getStitchedWounds);
PREP(isInjured);
Expand Down
43 changes: 43 additions & 0 deletions addons/medical/functions/fnc_getIVs.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "..\script_component.hpp"
/*
* Author: LinkIsGrim
* Returns a copy of unit's IVs.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* IVs <ARRAY of ARRAY>:
* 0: IV volume remaining, in liters <STRING>
* 1: IV type (blood, saline, plasma, etc) <STRING>
* 2: Body part IV is attached to <STRING>
* 3: IV classname <STRING>
* 4: IV flow rate coef <NUMBER>
*
* Example:
* player call ace_medical_fnc_getIVs
*
* Public: Yes
*/

params [["_unit", objNull, [objNull]]];

if (!alive _unit) exitWith {
ERROR_1("getIVs - null or dead unit %1",_unit);

[]
};

if !(_unit isKindOf "CAManBase") exitWith {
ERROR_2("getIVs - unit %1 is not child of CAManBase - type %2",_unit,typeOf _unit);

[]
};

private _ivBags = [];

{
_ivBags pushBack +_x; // manual deep copy so modification doesn't affect unit state
} forEach (_unit getVariable [QGVAR(ivBags), []]);

_ivBags

0 comments on commit a304e95

Please sign in to comment.