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

Auto-move uses distraction manager, prompts on danger-close #2664

Merged
merged 5 commits into from
Apr 19, 2023

Conversation

chaosvolt
Copy link
Member

@chaosvolt chaosvolt commented Apr 18, 2023

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

  1. In 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.
  2. In 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.
  3. Also implemented a bit less clunky if-else logic for game::cancel_activity_or_ignore_query as provided by Kheir.

Describe alternatives you've considered

  1. Letting players accidentally get into melee range with zeds if it turns out checking for nearby monsters makes fast-travel chug. Didn't seem to in my experience but.
  2. Trying to jury-rig a proximity check into 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

  1. Compiled and load-tested.
  2. Fast-traveled into a city with all distractions enabled, still got interrupted when a hostile comes into view.
  3. Turned "hostile spotted" distraction off and repeated this, now only got interrupted when I got too close to one of them.
  4. Turned "hostile close" distraction off too and kept on trucking, happily blunder into zed and get attacked (unless they stopped me EXACTLY in their path without me getting hit immediately, then it cancels automove because monster's in the way).
  5. Checked affected file for astyle.

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.

@github-actions github-actions bot added the src changes related to source code. label Apr 18, 2023
chaosvolt and others added 3 commits April 18, 2023 13:11
Co-Authored-By: KheirFerrum <102964889+KheirFerrum@users.noreply.github.com>
@scarf005 scarf005 assigned scarf005 and unassigned scarf005 Apr 18, 2023
@scarf005 scarf005 self-requested a review April 18, 2023 23:01
@scarf005 scarf005 self-assigned this Apr 18, 2023
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All enabled disabled "Monster Spotted" disabled "Dangerously Close"
Cataclysm: Bright Nights - cbn-experimental-2023-04-15-1839-5-g9c0df91e1b89_01 Cataclysm: Bright Nights - cbn-experimental-2023-04-15-1839-5-g9c0df91e1b89_02 Cataclysm: Bright Nights - cbn-experimental-2023-04-15-1839-5-g9c0df91e1b89_03

LGTM

@scarf005 scarf005 merged commit c321169 into cataclysmbnteam:upload Apr 19, 2023
@chaosvolt chaosvolt deleted the auto-move-goes-nyoom branch April 19, 2023 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants