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

Update Recoil / Spread to be flat reduction, capping out at 100%, allow knockback to go above 100% #44

Merged
merged 6 commits into from
Sep 9, 2023

Conversation

secretagentjr
Copy link

@secretagentjr secretagentjr commented Jul 18, 2023

No Recoil/Spread at 100% for each stat, Knockback can go above 100%, Health displays properly past 255

@secretagentjr secretagentjr changed the title Update Recoil / Spread to be flat reduction, capping out at 100% Update Recoil / Spread to be flat reduction, capping out at 100%, allow knockback to go above 100% Jul 19, 2023
@GenZmeY
Copy link
Owner

GenZmeY commented Jul 30, 2023

It doesn't look right. type of PlayerHealthPercent is a byte and it can have values in the range 0-255. Since percentages are stored there (range 0-100), I don't see any problems with the old code.

Speaking of new code:

PlayerHealthPercent *= float(OwnerPawn.Health) / float(OwnerPawn.HealthMax);

The float(OwnerPawn.Health) / float(OwnerPawn.HealthMax); will always give values in the range 0.0f - 1.0f, and multiplying this result by the previous value of PlayerHealthPercent ( *= ) will decrement PlayerHealthPercent each time it is updated

If health is incorrectly displayed somewhere in the interface, then most likely the problem is something else. Can you tell me how to reproduce the bug you are trying to fix here?

Also added some logs and found that this function is useless: we never get inside the if because both variables always have the actual value:
Useless

It looks like they are updated somewhere else.

In this case (+ what I said earlier), I see no reason to change this function.

@GenZmeY GenZmeY merged commit 53b8933 into GenZmeY:master Sep 9, 2023
1 check passed
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.

None yet

2 participants