Skip to content

Commit

Permalink
Medical - Add more API getters (#10514)
Browse files Browse the repository at this point in the history
Co-authored-by: johnb432 <[email protected]>
Co-authored-by: Grim <[email protected]>
  • Loading branch information
3 people authored Dec 16, 2024
1 parent 6026969 commit 24d2c61
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
3 changes: 3 additions & 0 deletions addons/medical/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ PREP(adjustPainLevel);
PREP(deserializeState);
PREP(fullHeal);
PREP(getBandagedWounds);
PREP(getBloodLoss);
PREP(getOpenWounds);
PREP(getStitchedWounds);
PREP(isInjured);
PREP(isInStableCondition);
PREP(serializeState);
PREP(setUnconscious);
25 changes: 25 additions & 0 deletions addons/medical/functions/fnc_getBloodLoss.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "..\script_component.hpp"
/*
* Author: DartRuffian
* Calculate the total blood loss of a unit.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Total blood loss of unit (litres/second) <NUMBER>
*
* Example:
* player call ace_medical_fnc_getBloodLoss
*
* Public: Yes
*/

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

if (!local _unit) exitWith {
ERROR_1("unit [%1] is not local",_unit);
-1
};

GET_BLOOD_LOSS(_unit)
23 changes: 23 additions & 0 deletions addons/medical/functions/fnc_isInStableCondition.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "..\script_component.hpp"
/*
* Author: DartRuffian
* Checks if a unit is in stable condition (stable vitals, awake, and not bleeding).
* Unit shouldn't require further treatment if true and not injured.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Is unit stable <BOOL>
*
* Example:
* player call ace_medical_fnc_isInStableCondition
*
* Public: Yes
*/

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

if (!alive _unit) exitWith { false };

_unit call EFUNC(medical_status,isInStableCondition)
26 changes: 26 additions & 0 deletions addons/medical/functions/fnc_isInjured.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "..\script_component.hpp"
/*
* Author: DartRuffian
* Checks if a unit is injured (bleeding, fractured limbs, low blood, etc).
* Unit may still require further treatment even if false.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Is unit injured <BOOL>
*
* Example:
* player call ace_medical_fnc_isInjured
*
* Public: Yes
*/

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

if (!alive _unit) exitWith { false };

private _fractures = GET_FRACTURES(_unit);

((_fractures select HITPOINT_INDEX_LARM) == 1) || {(_fractures select HITPOINT_INDEX_RARM) == 1} ||
{_unit call EFUNC(medical_ai,isInjured)}

0 comments on commit 24d2c61

Please sign in to comment.