-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 salvage_actor::cut_up #58414
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
[C++]
Changes (can be) made in C++. Previously named `Code`
Code: Tests
Measurement, self-control, statistics, balancing.
<Bugfix>
This is a fix for a bug (or closes open issue)
json-styled
JSON lint passed, label assigned by github actions
astyled
astyled PR, label is assigned by github actions
BasicBuildPassed
This PR builds correctly, label assigned by github actions
labels
Jun 14, 2022
Move mat_set outside of the loop Invert if Remove useless braces
Efficiency is calculated once and assigned to a const The recipe is found in a separate function, more clearly separating that functionality from what should be done if no recipe is found
Willenbrink
force-pushed
the
refactor_cut_up
branch
from
June 14, 2022 19:16
100d7ac
to
831c19d
Compare
github-actions
bot
added
BasicBuildPassed
This PR builds correctly, label assigned by github actions
and removed
BasicBuildPassed
This PR builds correctly, label assigned by github actions
labels
Jun 14, 2022
Why close? |
Oops, that was completely unintentional. Apparently I deleted the wrong branch and Github automatically closed the PR. |
Fab skill now has a more severe effect but is completely eliminated at lvl 5
BevapDin
reviewed
Jun 29, 2022
BevapDin
reviewed
Jun 29, 2022
BevapDin
reviewed
Jun 29, 2022
github-actions
bot
removed
the
BasicBuildPassed
This PR builds correctly, label assigned by github actions
label
Jul 1, 2022
github-actions
bot
added
the
BasicBuildPassed
This PR builds correctly, label assigned by github actions
label
Jul 5, 2022
github-actions
bot
removed
the
BasicBuildPassed
This PR builds correctly, label assigned by github actions
label
Jul 11, 2022
github-actions
bot
added
the
BasicBuildPassed
This PR builds correctly, label assigned by github actions
label
Jul 11, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
astyled
astyled PR, label is assigned by github actions
BasicBuildPassed
This PR builds correctly, label assigned by github actions
<Bugfix>
This is a fix for a bug (or closes open issue)
[C++]
Changes (can be) made in C++. Previously named `Code`
Code: Tests
Measurement, self-control, statistics, balancing.
json-styled
JSON lint passed, label assigned by github actions
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Bugfixes "Refactor salvage_actor::cut_up and fix minor bugs"
Purpose of change
This PR fixes #54657 which pointed out an issue with the formula for the returned weight.
I found another issue with the item loss, due to low fabrication etc., being applied multiple times.
Describe the solution
While fixing the issue with multiple materials, I decided to refactor the function to reduce code duplication and make things clearer.
The changes are mostly:
Validation:
Refactoring:
find_uncraft_recipe
to simplifycut_up
. It attempts to find a crafting or disassembly recipe fitting some constraints.cut_up_component
into a recursive lambda. Makes the order of traversal clearer and passing arguments simpler.Changes
or count_by_chargesitem instead of distributing their weight to their materialsDescribe alternatives you've considered
Not refactoring stuff and leaving things a whole lot less clear. It would be simpler to review I guess. Unfortunately changes to the indentation make the side-by-side diff basically useless.
Testing
The tests succeed and I've tested it with some specific items:
Note that the boots can be disassembled to obtain a rubber sole. As cut_up now prefers disassembly recipes when possible, a lot of weight is lost.
Additional context
I'm unsure about some potential problems and would like some feedback:
Ideally both fabrication and dexterity requirements would relate to the complexity of the item. Not sure how to do that. Do recipes exist for the majority of items? Then we could use their skill level to determine complexity. Could also use hardness of materials (and/or number of materials although that was just removed by this PR :) ). I think thats out-of-scope for this PR.