Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical - Add API for getting unit status (blood loss, injury, stability) #10514

Merged
merged 19 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
DartRuffian marked this conversation as resolved.
Show resolved Hide resolved
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)}
Loading