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 more API getters #10514

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

DartRuffian
Copy link
Contributor

When merged this pull request will:

  • Add API for checking if a unit has any injuries
    • Uses medical_ai's isInjured function
  • Add API for getting a unit's blood loss
    • Uses medical_status's getBloodLoss function

IMPORTANT

  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
  • Development Guidelines are read, understood and applied.
  • Title of this PR uses our standard template Component - Add|Fix|Improve|Change|Make|Remove {changes}.

addons/medical/functions/fnc_getBloodLoss.sqf Outdated Show resolved Hide resolved
addons/medical/functions/fnc_getBloodLoss.sqf Show resolved Hide resolved
addons/medical/functions/fnc_getBloodLoss.sqf Outdated Show resolved Hide resolved

if !(alive _unit) exitWith {false};

_unit call EFUNC(medical_ai,isInjured)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EFUNC(medical_ai,isInjured) only checks if the unit has broken legs, it doesn't check for broken arms. It also returns true if the unit is unconscious.

What purpose should this new function serve?
As it is atm, imo you are asking it to do too much, making it not very useful in my eyes.

Copy link
Contributor Author

@DartRuffian DartRuffian Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What purpose should this new function serve?

For my use-case, it was checking for "non-normal" medical state. I.e. true if uncon, has wounds, etc.
It was for a medevac script and I only wanted the action to show if the unit was actually injured.

I could've checked all of the variables myself, but I figured an API function would be more useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EFUNC(medical_ai,isInjured) only checks if the unit has broken legs, it doesn't check for broken arms. It also returns true if the unit is unconscious.

Should the medical_ai function check for broken arms as well?
I included it just in the API function for now, but I can just update the AI function if desired.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the medical_ai function check for broken arms as well?

No, it was intentionally done like that for (to me unknown) reason, although my guess would be that 1) AI don't have a lot of splints, 2) AI don't suffer from AI sway as players do (so don't waste them) and 3) might have simplified the AI medic state machine by not having to add a priority system for which limbs to splint (is now a moot point, because I revamped the state machine quite a bit).

What is the AI function completely omits is blood level and HR checking. I'll need to check whether this is intentional or not, but regardless the API function needs to check for the blood level at the very least. I'd imagine that having a high/low HR should also make the API return true, but then there might be certain scenarios where you simply don't care.

That leads me to: what's the formal definition of "non-normal"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd define "non-normal" as a state differing from the state set by initUnit / fullHeal

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!(lifeState unit in ["HEALTHY", "somethingElseIForgot"])

Copy link
Contributor Author

@DartRuffian DartRuffian Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting that should be added in the check as well?

Ah, I thought IS_UNCON was updated to use common's isAwake function. I'll update that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!(lifeState unit in ["HEALTHY", "somethingElseIForgot"])

"INJURED", and I opted to just use common_fnc_isAwake. Unless it should explicity check lifeState instead of the common function?

addons/medical/functions/fnc_isInjured.sqf Outdated Show resolved Hide resolved
addons/medical/functions/fnc_getBloodLoss.sqf Outdated Show resolved Hide resolved
DartRuffian and others added 7 commits November 17, 2024 12:55
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
@DartRuffian
Copy link
Contributor Author

DartRuffian commented Nov 18, 2024

Making a checklist of things for fnc_isInjured. Not explicitly saying all of these should be considered.

  • Fractured limbs
    • Arms are checked in API function, legs are checked in medical_ai_fnc_isInjured
  • Blood volume
  • Blood pressure
  • Peripheral resistance
  • Oxygen demand
  • Open wounds
  • Unconsciousness
  • Tourniquets
  • Pain
  • Heart rate
  • SPO2

@LinkIsGrim
Copy link
Contributor

SPO2, Heart Rate, Blood Pressure and Oxygen Demand can't just be checked against default as they can vary with fatigue and altitude if SPO2 simulation is enabled.

@DartRuffian
Copy link
Contributor Author

I just added those to have them listed, I don't think any of them should be considered IMO

Comment on lines +26 to +27
{GET_BLOOD_VOLUME(_unit) != DEFAULT_BLOOD_VOLUME} ||
{!(_unit call EFUNC(common,isAwake))} ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily an indication of injury. Maybe stable condition, but not injury.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I misunderstood your comment (#10514 (comment)) then, I thought you were suggesting to check that as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants