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 AI targeting itself during EMP #3431

Merged

Conversation

JohnAFernandez
Copy link
Contributor

To keep the AI code from going crazy, we should keep the AI from targeting itself during/after EMP. The AI will attempt to do this if they are set to traitor.

Closes #3366

To keep the AI code from going crazy, we should keep the AI from targeting itself during/after EMP
@JohnAFernandez JohnAFernandez added the fix A fix for bugs, not-a-bugs, and/or regressions. label May 16, 2021
@JohnAFernandez JohnAFernandez added this to the Release 21.4 milestone May 16, 2021
@JohnAFernandez JohnAFernandez self-assigned this May 16, 2021
Copy link
Contributor

@Goober5000 Goober5000 left a comment

Choose a reason for hiding this comment

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

This is good, but as a matter of code style I think it should be the second condition, after (ship_lookup >= 0). Intuitively, checking that the ship isn't itself would be the second thing to look for, right after checking for a valid index.

@JohnAFernandez
Copy link
Contributor Author

This is good, but as a matter of code style I think it should be the second condition, after (ship_lookup >= 0). Intuitively, checking that the ship isn't itself would be the second thing to look for, right after checking for a valid index.

I disagree. Because the program will follow the same order of checks as it does in the code, and this is the rarest case of it being rejected, this is the most efficient way to add the check.

@JohnAFernandez JohnAFernandez merged commit f998215 into scp-fs2open:master May 23, 2021
@JohnAFernandez JohnAFernandez deleted the Fix-Ai-targeting-itself branch May 23, 2021 02:46
@JohnAFernandez JohnAFernandez added the Point Release Candidate An already merged bugfix that may be merged into a previous stable version label Jun 14, 2021
@JohnAFernandez JohnAFernandez added this to Point Release Candidates in Point Release Sorting, Target: 21.2.1 Jun 21, 2021
@JohnAFernandez JohnAFernandez removed the Point Release Candidate An already merged bugfix that may be merged into a previous stable version label Jun 21, 2021
@JohnAFernandez JohnAFernandez moved this from To sort to One Approval in Point Release Sorting, Target: 21.2.1 Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A fix for bugs, not-a-bugs, and/or regressions.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Ship told to attack itself. I was told to report it.
2 participants