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 first pass component selection to avoid poison #70824

Closed
wants to merge 1 commit into from

Conversation

PatrikLundell
Copy link
Contributor

Summary

None

Purpose of change

Address the component selection half of #70796 (but not the UI display part for component selection).

Describe the solution

Extend the restriction for first pass item selection to exclude known poisonous and hallucinogenic items in addition to the previous exclusion of containers containing items.

As a side effect the odd case where a separate filter was used (because it was used together with a supplied filter) had its first pass filter use a common operation to remove code duplication.

The code ended up no longer being inlined as the addition relied on flags that weren't in the set of files copied into the header (and the compiler complained about mismatching definitions elsewhere when it was done).

Describe alternatives you've considered

  • Try to figure out how to deal with the component selection display side of the report.
  • Try harder to figure out how to test the solution.

Testing

Not Tested Should Work...

I was unable to figure out how to (if possible) spawn mushrooms (or any other item that comes in random poisonous and/or hallucinogenic variants) the were affected. Manipulating flags only seems to do that, i.e. allow the removal of flags, but not actually set that it was poisonous. Adding the hidden flag would not help testing even if it would work, as the test shouldn't exclude poison you don't know about.

Ended up with a simple regression test of ordering the base camp expansion construction of two stoves where two tanks were placed one each of the two storage zone tiles, with one being empty and one containing a liquid, and verifying the two liquid containing tanks remained and the empty ones were consumed.

Additional context

As it's not tested, it would be appreciated if the logic was double checked.

I'd appreciate if someone could explain how to (and if) you can spawn poisonous and hallucinogenic shrooms, as well as ones that are but that fact is hidden to the player for testing purposes.

I realize foraging enough should eventually result in known shrooms and/or may apples of the two known categories, but that's a fair bit of work that still wouldn't cover the hidden poison/hallucinogen case.

Spawning shrooms one at a time 20 times resulted in 20 shrooms in a stack when dropped, indicating none of them would be poisonous or hallucinogenic (and the "examine" description didn't say they were). The normal foraging code seems to give poison a 1 in 10 chance of appearing, so that sample ought to have cause some poisonous or hallucinogenic case if debug spawning used the same logic.

@github-actions github-actions bot added Crafting / Construction / Recipes Includes: Uncrafting / Disassembling [C++] Changes (can be) made in C++. Previously named `Code` Player Faction Base / Camp All about the player faction base/camp/site json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Jan 10, 2024
@PatrikLundell
Copy link
Contributor Author

The logic is broken. The flags should appear on ALL shrooms. The tests should check for whatever the results of the presence of these flags was.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 10, 2024
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 [C++] Changes (can be) made in C++. Previously named `Code` Crafting / Construction / Recipes Includes: Uncrafting / Disassembling json-styled JSON lint passed, label assigned by github actions Player Faction Base / Camp All about the player faction base/camp/site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant