fix:Pause AI building production and spawner aircraft under EMP (respect ImmuneToEMP)#1833
fix:Pause AI building production and spawner aircraft under EMP (respect ImmuneToEMP)#1833ahasasjeb wants to merge 12 commits intoPhobos-developers:developfrom
Conversation
Added functionality to freeze AI-controlled factory production when under EMP.
TaranDahl
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
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.