Auto-move uses distraction manager, prompts on danger-close #2664
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
SUMMARY: Features "Auto-move now takes distraction manager into account, "
Purpose of change
I was getting sick of "monster spotted" queries constantly interrupting fast-travel, testing how to fix it turned out to be easy enough even for someone with my level of inexperienced.
Describe the solution
game::process_voluntary_act_interrupt
, changed the check for monsters that're dangerously close to also occur if you're fast traveling, and not just performing standard activities. I'm going to hope that doesn't cause performance issues, but it's needed to prevent fast-travel with "monster spotted" disabled from letting you walk face-first into zombies.game::cancel_activity_or_ignore_query
, added a check in the fast-travel section that has it bail out if the current distraction is one you've set to ignore.game::cancel_activity_or_ignore_query
as provided by Kheir.Describe alternatives you've considered
game::mon_info_update
where spotting monsters in general is handled. This seems like a bad idea since that'd be making a three-layer if/else chain even more clunky than it already is and the least annoying ways to do that will most likely cause the distraction to not trigger correctly if you already saw the offending monster beforehand and they get closer.Testing
Additional context
Tested DDA and at some point they also set auto-move to take distraction manager into account, but it of course has the "blindly walk right into attacks because it's not checking for
hostile_spotted_near
" problem.