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

Return to always treating hostile NPCs as being dangerous for 0.H #75781

Merged
merged 1 commit into from
Aug 18, 2024

Conversation

kevingranade
Copy link
Member

@kevingranade kevingranade commented Aug 17, 2024

Summary

Bugfixes "Treat hostile NPCs as unsafe even if your safe mode rules don't match."

Purpose of change

Fixes #65513
After several people digging into this, it looks like the real issue is that if you even as much as initialize a safe mode manager instance by e.g. adding a single empty rule, safe mode will no longer trigger on hostile NPCs.

Describe the solution

This adjusts the logic so that the fallback logic of "NPCs are unsafe if they're trying to kill us" is still evaluated even if we have safe mode rules set.

Describe alternatives you've considered

There might be some more sophisticated option based on making safe mode more directly aware of NPC hostility, but I'm aiming for a clean bugfix to get 0.H unblocked.

Testing

I reproduced the issue by spawning a NPC who was kinda angry to start with and then provoking them so they became hostile.
Once they were hostile, safe mode triggered.
I moved away from them and added an empty safe mode rule. (just Add -> Enter)
Once I did this, safe mode no longer triggered.

After my change, I repeated this process and safe mode triggered whether there was a rule in safe mode manager or not.

Additional context

Looks like this happened in #43095 attempting to avoid translation overhead. This restores the previous logic without regressing on that perf change.
Both options are arguably correct, but it seems unlikely that "ignore NPCs that are actively trying to kill me" is ever what you want.

@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) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Aug 17, 2024
@Maleclypse Maleclypse merged commit 1043de2 into 0.H-branch Aug 18, 2024
19 of 23 checks passed
@kevingranade kevingranade deleted the hostile-npcs-are-unsafe branch August 19, 2024 01:48
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