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 GUI - Peek Medical Info on Hit #9467

Merged
merged 10 commits into from Oct 9, 2023

Conversation

amsteadrayle
Copy link
Contributor

When merged this pull request will:

  • Temporarily show the player's patient information display when hit

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}.

@amsteadrayle
Copy link
Contributor Author

amsteadrayle commented Oct 6, 2023

Like with my other PR, the goal with this is to provide the player with immediate feedback about their medical condition without interrupting gameplay.

Is Hit the best event to attach this to? Would HandleDamage or medical_injured be different or better in any way?

TODO:

  • Add setting to enable/disable

  • Add setting for duration

  • Fix flickering on subsequent hits before fadeout finishes

  • I think this can be fixed by changing the CBA_fnc_waitAndExecute to CBA_fnc_waitUntilAndExecute and checking the time elapsed since the last hit. Is there an existing, accepted implementation of that? Would there be a problem with multiple identical CBA_fnc_waitUntilAndExecute in this situation?

  • Show damaged body part

  • Is there a good way to do this? I've searched around a bunch and I haven't been able to figure anything out that would be straightforward. This is more of a hopeful goal at the moment.

@amsteadrayle amsteadrayle changed the title WIP - Medical GUI - Basic implementation of medical status peek on hit WIP - Medical GUI - Temporarily show medical status on hit Oct 6, 2023
@amsteadrayle amsteadrayle changed the title WIP - Medical GUI - Temporarily show medical status on hit WIP - Medical GUI - Temporarily show player's patient information on hit Oct 6, 2023
@LinkIsGrim
Copy link
Contributor

Event should be a matter of preference (as long as execution order is right). Tying to medical's injured event would be most appropriate and consistent with the rest of the components.

@amsteadrayle
Copy link
Contributor Author

This now uses the medical_woundReceived event to know about the damaged body part.

Here's a quick demo, tweaked to still show my own info when remote controling a unit.
https://www.youtube.com/watch?v=VGBjroxGD70

@amsteadrayle amsteadrayle changed the title WIP - Medical GUI - Temporarily show player's patient information on hit Medical GUI - Temporarily show player's patient information on hit Oct 8, 2023
addons/medical_gui/XEH_postInit.sqf Outdated Show resolved Hide resolved
params ["_unit", "_allDamages", ""];
if !(GVAR(peekMedicalOnHit) && ACE_PLAYER == _unit) exitWith {};

private _bodypart = toLower (_allDamages select 0 select 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

There're only ANSI chars, right ?

Suggested change
private _bodypart = toLower (_allDamages select 0 select 1);
private _bodypart = toLowerANSI (_allDamages select 0 select 1);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably, but I was just copying the existing usage from here:

Copy link
Contributor

Choose a reason for hiding this comment

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

Ya, seen exactly that one before and it annoys me a lot (assuming I ain't wrong).

Copy link
Contributor

Choose a reason for hiding this comment

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

Why this? We don't do it anywhere else.

Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
addons/medical_gui/XEH_postInit.sqf Outdated Show resolved Hide resolved
Comment on lines 130 to 137
[
QGVAR(peekMedicalOnHit),
"CHECKBOX",
[LSTRING(PeekMedicalOnHit_DisplayName), LSTRING(PeekMedicalOnHit_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory)],
true,
false // isGlobal
] call CBA_fnc_addSetting;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be local IMO.

Some might prefer defaulting to off.

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 set it local to allow servers to leave it to player preference. Particularly thinking about if somone wants to disable it while a server allows it. But I don't feel too strongly about it.

I do agree with defaulting to off, on second thought.

Copy link
Member

Choose a reason for hiding this comment

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

Local can always be overwritten.

@LinkIsGrim LinkIsGrim added this to the 3.16.1 milestone Oct 8, 2023
@LinkIsGrim LinkIsGrim added the kind/feature Release Notes: **ADDED:** label Oct 8, 2023
amsteadrayle and others added 2 commits October 8, 2023 19:48
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
@LinkIsGrim
Copy link
Contributor

Looks good, solve merge conflicts.

@LinkIsGrim LinkIsGrim modified the milestones: 3.16.1, 3.16.0 Oct 9, 2023
@LinkIsGrim LinkIsGrim changed the title Medical GUI - Temporarily show player's patient information on hit Medical GUI - Peek Medical Info on Hit Oct 9, 2023
@LinkIsGrim LinkIsGrim merged commit 941207c into acemod:master Oct 9, 2023
4 of 5 checks passed
@amsteadrayle
Copy link
Contributor Author

Those setting limits were intentional. 0 seconds is too short to actually parse any information, and 1 second is still very short. The upper limit being 10 seconds was just an extreme in case anyone felt like looking for that long.
The timing is different from the manual peek because you don't control when or how long it appears.

@LinkIsGrim
Copy link
Contributor

There's no harm in reducing the lower end of the time range.

10 seconds is too much time IMO. 5 is an eternity during a firefight already.

I guess default time could've been kept as it was but since this feature is off by default, anyone using it will be looking at settings anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Release Notes: **ADDED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants