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

refactor: Remove usage of hp_part from bandaging and disinfection #5647

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

Coolthulhu
Copy link
Member

Checklist

Required

Optional

Purpose of change

Slowly creeping towards removable/addable body parts

Describe the solution

Replaces hp_part usage from bandaging/disinfecting iuse_actor and regen. For a given body part, its hp_part corresponds to its bodypart::main_part, but hp_part is a separate enum.

Describe alternatives you've considered

Testing

  • Spawn character, bandages, antiseptic powder
  • Hurt character, bandage some wounds, disinfect others
  • Save+load
  • Parts stay bandaged/disinfected after load
  • Set body part hp to full for some bandaged/disinfected parts
  • Sleep for one "sleep tick" (nearest 5 minute interval)
  • Get a message about "bandaged/disinfected body part healed"
  • Set hp of all parts to some value below max
  • Bandage/disinfect some
  • Sleep for some set time
  • Notice bandaged/disinfected wounds healing faster than ones with no treatment

Additional context

Possibly fixed a bug with inconsistent usage of bodypart::damage_bandaged vs Character::damage_bandaged.

@github-actions github-actions bot added the src changes related to source code. label Nov 2, 2024
Copy link
Member

@chaosvolt chaosvolt left a comment

Choose a reason for hiding this comment

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

  1. Compiled and load-tested.
  2. Spawned in and bandaged all wounds after setting HP to 1, healing up during a nap as expected.
  3. Repeated test with maxed-out first aid skill, healing is increased as expected.
  4. Spawned an enemy in and let them hit me, bandages take damage.

Interesting oddity I noticed: disinfectant never takes "damage" so long as the part is bandaged. I tested in build 2024-11-01 and confirmed this is a pre-existing behavior. Reasonable that bandages would cover applied antiseptic so it's fine, just wasn't sure if it was intended or desired behavior.

@Coolthulhu
Copy link
Member Author

Interesting oddity I noticed: disinfectant never takes "damage" so long as the part is bandaged.

I think it's unintended, but it's so minor we can let it slide.
I think the indented behavior is that bandaged/disinfected value on body parts is set to "remaining hp to heal" and to go down when damaged, as if you healed up to full and then got damaged. This would prevent "pre-healing" from working, because you'd always only bandage the hp that is missing.

@ZChris13
Copy link

ZChris13 commented Nov 4, 2024

This would prevent "pre-healing" from working, because you'd always only bandage the hp that is missing.

this should be documented somewhere

@chaosvolt chaosvolt merged commit 37a1f76 into cataclysmbnteam:main Nov 4, 2024
12 checks passed
@Coolthulhu Coolthulhu deleted the hppart-removal-part1 branch November 7, 2024 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants