Fix unload zones when unload target is on the zone's edge #56483
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
None
Purpose of change
When using a strip zone or an unload-all zone, if the target unload item is on the edge of the zone, the player only performs the
sort
action if they're standing in the zone.The unload check is expecting the distance between the player and the zone to be 0:
Cataclysm-DDA/src/activity_item_handling.cpp
Lines 2172 to 2176 in 3d0002b
Since the automovement puts the player directly beside the item to unload, this check will fail if the item is on the zone's edge.
Describe the solution
Increase the zone's range check to 1 (preferred solution by BombasticSlacks).
Describe alternatives you've considered
Make the automovement put the player directly on the zone (not adjacent) if the zone is one of the two above.
Testing
2022-03-30.17-58-54.mp4
Additional context