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

Fix: Make AUTO_PICKUP_SAFEMODE also consider ignored mobs #63334

Conversation

inogenous
Copy link
Contributor

Summary

Bugfixes "Make AUTO_PICKUP_SAFEMODE also consider ignored mobs"

Purpose of change

  • Autopickup should not happen when AUTO_PICKUP_SAFEMODE is enabled and a monster is nearby.
  • Makes AUTO_PICKUP_SAFEMODE also consider ignored monsters when evaluating whether or not to autopickup.
  • Prevents the following situation:
  1. Enable options: SAFEMODE, AUTO_PICKUP_ADJACENT, AUTO_PICKUP_SAFEMODE
  2. Enable autopickup for rocks
  3. Player is 4 tiles from dangerous monster
  4. Press key to ignore monster
  5. Take one step towards rock on the ground so that rock is now adjacent
  6. Rock is picked up, even though player is close to dangerous monster and AUTO_PICKUP_SAFEMODE is enabled

20230129-1

Describe the solution

  • In the above scenario, step 4 would set mostseen to 0 since the monster is ignored.
  • Before this commit, autopickup checked for mostseen == 0, thus allowing autopickup even if AUTO_PICKUP_SAFEMODE is enabled
  • With this commit, autopickup will instead check for whether there is any monster within safemode proximity that is dangerous, regardless of whether it is ignored or not

Describe alternatives you've considered

  • It could also be argued that if the player chooses to ignore a monster, then the intention should also be that autopickup should still be allowed since the monster is ignored. However, the (current) wording of AUTO_PICKUP_SAFEMODE does not state anything about ignored monsters: If true, auto pickup is disabled as long as you can see monsters nearby.

Testing

  • With this commit, in scenario listed above, step 6 does not pickup the rock.

Additional context

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) labels Jan 29, 2023
* Makes `AUTO_PICKUP_SAFEMODE` also consider ignored monsters when evaluating whether or not to autopickup.
* Prevents the following situation:
	1. Enable options: `SAFEMODE`, `AUTO_PICKUP_ADJACENT`, `AUTO_PICKUP_SAFEMODE`
	2. Enable autopickup for rocks
	3. Player is 4 tiles from dangerous monster
	4. Press key to ignore monster
	5. Take one step towards rock on the ground so that rock is now adjacent
	6. Rock is picked up, even though player is close to dangerous monster and `AUTO_PICKUP_SAFEMODE` is enabled

Implementation detail:
* In the above scenario, step 4 would set `mostseen` to 0 since the monster is ignored.
* Before this commit, autopickup checked for `mostseen == 0`, thus allowing autopickup even if `AUTO_PICKUP_SAFEMODE` is enabled
* With this commit, autopickup will instead check for whether there is any monster within safemode proximity that is dangerous, regardless of whether it is ignored or not
@inogenous inogenous force-pushed the bugfix-autopickup-safemode-ignored-monsters branch from 67dc2e8 to 7601c3c Compare January 29, 2023 10:36
@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jan 29, 2023
@dseguin dseguin merged commit ea63fd9 into CleverRaven:master Jan 30, 2023
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 <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants