-
Notifications
You must be signed in to change notification settings - Fork 261
add guard against OnDefeat failures for AI #7256
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
base: develop
Are you sure you want to change the base?
Changes from 3 commits
5ad2ab6
bb66e1c
b1ad7c0
6e3601d
d689d10
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - Add guards for platoon function calls in the DisableAI function to stop errors during the OnDefeat call. | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1437,8 +1437,12 @@ function DisableAI(self) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not unit.Dead then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local handle = unit.PlatoonHandle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if handle and self:PlatoonExists(handle) then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handle:Stop() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handle:PlatoonDisbandNoAssign() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if handle.Stop then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handle:Stop() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if handle.PlatoonDisbandNoAssig then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| handle:PlatoonDisbandNoAssign() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
Comment on lines
+1440
to
+1445
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I read a bit of the platoon code, and it seems like there's some manual
Could you post the replay and maybe investigate the metatable of the platoon that fails at being destroyed (for example if it is a mod using the adaptive silo)? These functions should never be missing because they're part of the base class. Even if the platoon is from a mod.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was based off a replay for my own AI. I don't disagree that it may have something to do with the state machine platoon implementation. The platoons in question were otherwise functioning fine. I thought this would be the safest change to make that would be low risk of unforeseen consequences. I did a dump of the platoon table when troubleshooting as I thought maybe I'd accidentally set it to an empty table, but the resulting dump looked the same as any other platoon and had the c object attached so I was thinking that the platoon was mid was through its own destruction. In my testing I only had the issue happen once in say 10 games but a player pointed out that it happened alot more often for them with the difference being that they had a much higher player count.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you have suggestions of I could better troubleshoot it then I'm happy to try find the core reason.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did some metatable trickery in this branch to track down tracebacks of what changes were done to the platoon that failed: It's useful so I'll make a PR for it on a more organized branch. I have included the output log in the branch files. What stands out to me is this final assignment of the failing platoon's metatable to After investigating RNGAI, I saw: unit.PlatoonHandle:ChangeStateExt(unit.PlatoonHandle.PerformBuildTask)Where Lines 784 to 818 in 653be9b
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| IssueStop({ unit }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| IssueToUnitClearCommands(unit) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.