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

Fix healHitPointAfterAdvBandage - Issue #2498. #2646

Merged
merged 9 commits into from
Oct 4, 2015
Merged

Fix healHitPointAfterAdvBandage - Issue #2498. #2646

merged 9 commits into from
Oct 4, 2015

Conversation

DerekSauer
Copy link
Contributor

Issue: Adv. Medical Heal hitpoints doesn't work #2498.

With "ace_medical_healHitPointAfterAdvBandage" enabled fully bandaging wounded body parts were not healing those body parts in the Arma engine. ACE's interface would show body parts fully bandaged and undamaged but the player's uniform would remain bloody and the effected parts would remain non-functional (E.g.: Even though ACE thinks your legs are healed, Arma doesn't and you can't run. Your pants are also full of blood).

This fix checks to see if an ACE body part is fully bandaged and then heals the respective Arma body part while keeping in mind that Arma does not have separate body parts for left & right arms and legs.

@DerekSauer DerekSauer changed the title Fix for issue #2498. Fix healHitPointAfterAdvBandage - Issue #2498. Sep 29, 2015
@bux
Copy link
Member

bux commented Sep 29, 2015

Thank you for your contribution! Could you please reformat your code to follow our Coding Guidelines?

@thojkooi
Copy link
Contributor

Thank you @DerekSauer

This PR reintroduces the bug where injuries that does not cause bloodloss will prefent the heal hitpoints after bandaging working (the bruises bug).

To fix this, use both the injury amount and the bloodloss. Example:

((_x select 4) * (_x select 3)) > 0

@DerekSauer
Copy link
Contributor Author

The code is now taking into account wounds that do not cause bleeding (bruises). Thanks for the heads up Glowbal, I would not have considered that. It should now also comply with ACE3's coding guidelines. Let me know if I missed any.

Used the wrong method to retrieve the target's current wounds and was
getting an empty array. This caused bandaging any wound even once to
completely heal the target on the Arma side.
if (_bodyPart == 5 && {(_numOpenWounds * _bloodLoss) > 0}) then {
_legsWounds = _legsWounds + 1;
};
} foreach _currentWounds;
Copy link
Member

Choose a reason for hiding this comment

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

forEach

@thojkooi thojkooi added the kind/bug-fix Release Notes: **FIXED:** label Sep 30, 2015
@thojkooi thojkooi added this to the 3.4.0 milestone Sep 30, 2015
_x params ["", "", "_bodyPart", "_numOpenWounds", "_bloodLoss"];

// Head
if (_bodyPart == 0 && {(_numOpenWounds * _bloodLoss) > 0}) then {
Copy link
Contributor

Choose a reason for hiding this comment

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

Create an early exit condition for (_numOpenWounds * _bloodLoss) > 0 that way it only has to be evaluated 1 time instead of 6 times in the worst case, as well as skipping 6 value checks and making the code look cleaner.

Using a switch/case conditional since it offers early termination if a
matching condition is found before all conditions are checked. It also
unnecessary to use a conditional to confirm whether a limb is wounded or
not. Number of Wounds multiplied by Blood loss will return zero for
a fully bandaged body part, not incrementing the wound counter; or it will
return some other number which will increment the wound counter.
@thojkooi
Copy link
Contributor

thojkooi commented Oct 4, 2015

Thanks @DerekSauer 👍

Fix #2498

thojkooi added a commit that referenced this pull request Oct 4, 2015
Fix healHitPointAfterAdvBandage - Issue #2498.
@thojkooi thojkooi merged commit e36df97 into acemod:master Oct 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug-fix Release Notes: **FIXED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants