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

Custom Filter loot zone #32754

Merged
merged 8 commits into from Aug 3, 2019
Merged

Custom Filter loot zone #32754

merged 8 commits into from Aug 3, 2019

Conversation

ghost
Copy link

@ghost ghost commented Jul 30, 2019

Summary

SUMMARY: Features "Custom Filter loot zone"

Purpose of change

Fixes #25134

Describe the solution

Adds the string filter input from zone options to a string_item_filter when the loot sorting activity searches for the nearest correct tile to push the item to.

Describe alternatives you've considered

N/A

Additional context

This will need to be updated after #32730 is merged - it copies one of the funtions from there, for use in zone administration, and might not be in the same place afte rthat is merged, and also modifies the loot sorting activity, which is also modified in that PR, or vice versa if this is merged first

src/clzones.cpp Outdated Show resolved Hide resolved
src/activity_item_handling.cpp Outdated Show resolved Hide resolved
@pjf
Copy link
Contributor

pjf commented Jul 30, 2019

Just applied this to my local branch and made a 'battery' zone. Not only does it work, but the item preview on the zone is a super-nice touch! Thank you!

@pjf
Copy link
Contributor

pjf commented Jul 30, 2019

And now I'm reporting in with my first gotcha. I created uses a filter of BBB. I then used a permanent marker to change the name of a swiss army knife to BBB - Swiss Army Knife. While the advanced inventory filter (/) finds the knife fine if I search for 'BBB', the custom filter zone doesn't seem to be accepting the item.

@pjf
Copy link
Contributor

pjf commented Jul 30, 2019

Aaah, I see what's going on... custom_loot_has is checking against the item type, rather than the item name itself (which I presume is what the advanced inventory filter uses).

@ghost
Copy link
Author

ghost commented Jul 30, 2019

Aaah, I see what's going on... custom_loot_has is checking against the item type, rather than the item name itself (which I presume is what the advanced inventory filter uses).

Ahh right, forgot you can actualyl change the name of the item.
I can see if its possible to pass the item itself as the parameter.

@ghost
Copy link
Author

ghost commented Jul 30, 2019

Yeah, done, that seems to work, with the item itelf.

src/clzones.cpp Outdated Show resolved Hide resolved
src/clzones.h Outdated Show resolved Hide resolved
src/clzones.cpp Outdated Show resolved Hide resolved
@pjf
Copy link
Contributor

pjf commented Jul 30, 2019

Been doing some more testing locally, and this is working really great! For example, I have tank,drum,-c:clothing that seems to be doing a reasonable job of picking up tanks (but not 'tank tops'), and jar,jug,bottle,-c:food seems to grab most empty containers (but not ones containing food).

I'm 100% happy to consider this passing the bounty requirement once merged. :)

src/clzones.cpp Outdated Show resolved Hide resolved
@ZhilkinSerg ZhilkinSerg added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones labels Jul 31, 2019
@ZhilkinSerg ZhilkinSerg self-assigned this Aug 1, 2019
@pjf
Copy link
Contributor

pjf commented Aug 2, 2019

I've been using this pretty heavily, and there's been only one gotcha that I've found. If there's a custom zone and a regular zone on the same tile, then it appears the regular zone gets ignored.

For example, I have a custom zone for pinecones on top of my non-perishable foods. This results in non-perishables not getting sorted to that square any more.

I've attached a save that demonstrates this. Turning off the 'dry food' and 'custom cellar' zones causes the food in the back of the vehicle to get sorted. With them still being enabled, the food just sits there.

I wouldn't consider this to be a blocker, given that everything else seems to be working so well!

@kevingranade kevingranade merged commit d179e54 into CleverRaven:master Aug 3, 2019
@ZhilkinSerg ZhilkinSerg removed their assignment Aug 3, 2019
@ghost ghost deleted the custom_filter_zone branch September 11, 2019 09:59
misterprimus pushed a commit to misterprimus/Cataclysm-DDA that referenced this pull request Sep 21, 2019
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 Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include Filters in Loot Sorting Zones [$20]
4 participants