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

Limited amount of splints in autodoc #47379

Merged
merged 3 commits into from
Feb 17, 2021
Merged

Limited amount of splints in autodoc #47379

merged 3 commits into from
Feb 17, 2021

Conversation

Night-Pryanik
Copy link
Contributor

Summary

Features "Limited amount of splints in autodoc."

Purpose of change

Unlimited splints in autodoc was neither realistic nor fun.

Describe the solution

  • Made up to three arm splints and up to three leg splints spawn in autodocs.
  • Autodoc now actually uses available splints and prints an error if there's still a broken limb, but no splint for it in autodoc supplies.
  • Fixed a bug fixed when autodoc couldn't splint two broken arms or two broken legs simultaneously.

Describe alternatives you've considered

None.

Testing

Debug-broken both of my character's arms and one leg. Put one arm splint and two leg splints in autodoc. Selected bonesetting in autodoc's menu. One broken arm and broken leg were splinted. Second attempt of bonesetting showed me an error.

Additional context

New list in autodoc's menu depicting available supplies
изображение

Two out of three broken limbs were splinted
изображение

Second attempt of bonesetting, when there's no available arm splints in autodoc, popped up an error
изображение

In order to fix the aforementioned bug, I had to slightly change the logic. Now autodoc forcefully splints the broken limb even if there's another splint set up already. But it's still a good thing as autodoc applies very good level of bonesetting, and your character level of recover for that limb will instantly be bumped to "Mostly recovered".

Also print an error if there's not enough splints.
Also fixed a bug where autodoc couldn't splint two broken arms or two broken legs simultaneously.
@Night-Pryanik Night-Pryanik added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. labels Feb 9, 2021
Comment on lines +4926 to +4931
if( supplies.typeId() == itype_arm_splint ) {
arm_splints.push_back( supplies );
}
if( supplies.typeId() == itype_leg_splint ) {
leg_splints.push_back( supplies );
}
Copy link
Member

Choose a reason for hiding this comment

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

Could I suggest a flag instead of a hardcoded id check?

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 thought about it, but as you stated below, it made using use_amount impossible, so I decided that hardcoded ids would be tolerable for now.

src/iexamine.cpp Outdated Show resolved Hide resolved
src/iexamine.cpp Outdated Show resolved Hide resolved
int quantity = 1;
if( part == bodypart_id( "arm_l" ) || part == bodypart_id( "arm_r" ) ) {
if( arm_splints.size() > 0 ) {
for( const item &it : get_map().use_amount( examp, 1, itype_arm_splint, quantity ) ) {
Copy link
Member

Choose a reason for hiding this comment

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

Though using flags could make this tricky, so it's only a suggestion.

src/iexamine.cpp Outdated Show resolved Hide resolved
@Sirbab
Copy link
Contributor

Sirbab commented Feb 11, 2021

Would it be possible to reload them with splints?

@Night-Pryanik
Copy link
Contributor Author

Would it be possible to reload them with splints?

Yes. Autodoc now functions as container which allows it to hold items inside.

@ZhilkinSerg ZhilkinSerg merged commit c05a668 into CleverRaven:master Feb 17, 2021
@Night-Pryanik Night-Pryanik deleted the limited-splints-for-autodoc branch February 17, 2021 12:04
Ramza13 pushed a commit to Ramza13/Cataclysm-DDA that referenced this pull request Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Fields / Furniture / Terrain / Traps Objects that are part of the map or its features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants