-
-
Notifications
You must be signed in to change notification settings - Fork 125
fix:Pause AI building production and spawner aircraft under EMP (respect ImmuneToEMP) #1833
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
Conversation
Added functionality to freeze AI-controlled factory production when under EMP.
TaranDahl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More documentation needs to be added. Could look into other PRs.
Added checks for building power status and spawn regeneration rate.
Enhanced EMP handling for AI-owned buildings, ensuring production is paused during EMP effects based on immunity settings.
src/Ext/Techno/Hooks.Misc.cpp
Outdated
| if (auto const pBuilding = abstract_cast<BuildingClass*, true>(pOwner)) | ||
| { | ||
| if (pBuilding->Type->Powered && !pBuilding->IsPowerOnline()) | ||
| return 0; | ||
| } | ||
|
|
||
| if (const auto pOwnerType = pOwner->GetTechnoType(); pOwnerType && pOwnerType->SpawnRegenRate <= 0) | ||
| return 0; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions:
- I saw in your doc that you want to prevent the respawn of the spawnee in EMP state, but is this necessary? Will the building still launch them in EMP state?
- And, you used
return 0;, it will not affect any of the vanilla logic, but it will cause issues with theSpawns.Queuelogic later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a clear look at the problem first and do not mark it as resolved at will
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-review changes, please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also have the same concern that your code may not work as you expect because it return 0. Have you tested it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code works fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In EMP state, SpawnManagerClass will not make any updates, which means these are unnecessary.
Even if this has any effect, return 0 means continuing to execute the game's vanilla instructions, which will break Spawns.Queue's logic.
What I want to express is that the code here actually has no effect. This approach is no different from the vanilla, as SpawnManagerClass would never work under EMP.
If you want to pause the timer, you can do it like the production. Although this may not be the most efficient approach, it is feasible.
|
If you want negative
And, I hope you can first check the content in
|
Added functionality to freeze AI-controlled factory production when under EMP.