From 00650b0f08fb786d41229cc29d4322f1c429d147 Mon Sep 17 00:00:00 2001 From: lvjia Date: Mon, 1 Sep 2025 15:11:51 +0800 Subject: [PATCH 1/6] Fixed AI continuing to produce units and construct buildings from buildings affected by EMP. --- src/Ext/Techno/Body.Update.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Ext/Techno/Body.Update.cpp b/src/Ext/Techno/Body.Update.cpp index f41d25f7f5..ad236a6846 100644 --- a/src/Ext/Techno/Body.Update.cpp +++ b/src/Ext/Techno/Body.Update.cpp @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include @@ -1638,6 +1640,21 @@ void TechnoExt::ExtData::UpdateRearmInEMPState() if (pThis->ReloadTimer.InProgress() && pTypeExt->NoReload_UnderEMP.Get(RulesExt::Global()->NoReload_UnderEMP)) pThis->ReloadTimer.StartTime++; + + // Pause building factory production under EMP / Deactivated + if (auto const pBuilding = abstract_cast(pThis)) + { + if (auto const pFactory = pBuilding->Factory) + { + if (pFactory->Object && pFactory->Production.Rate > 0) + { + if (pFactory->Production.Timer.HasStarted() && !pFactory->Production.Timer.Expired()) + { + pFactory->Production.Timer.StartTime++; + } + } + } + } } void TechnoExt::ExtData::UpdateRearmInTemporal() From e35d20bdb7a652d896bbbedfe795333657b2ca8b Mon Sep 17 00:00:00 2001 From: lvjia Date: Mon, 1 Sep 2025 15:24:40 +0800 Subject: [PATCH 2/6] doc --- CREDITS.md | 2 ++ docs/Fixed-or-Improved-Logics.md | 1 + docs/Whats-New.md | 2 ++ 3 files changed, 5 insertions(+) diff --git a/CREDITS.md b/CREDITS.md index 52e0977bf5..ee5006106b 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -643,3 +643,5 @@ This page lists all the individual contributions to the project by their author. - **Damfoos** - extensive and thorough testing - **Dmitry Volkov** - extensive and thorough testing - **Rise of the East community** - extensive playtesting of in-dev features +- **ahasasjeb**: + - Fixed AI continuing to produce units and construct buildings from buildings affected by EMP \ No newline at end of file diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 9c0586bd77..53ad910677 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -261,6 +261,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - `DeployingAnim` now supports both `Normalized=true` and `Reverse=true`. Keep in mind `Reverse` uses `LoopEnd` for frame amount instead of `End` even without `LoopCount` > 1. - `DeployingAnim` using unit drawer now also tint accordingly with the unit. - Fixed the bug that armor multiplier of new attacheffect will have extra take effect once if restricted warheads. +- Fixed AI continuing to produce units and construct buildings from buildings affected by EMP. ## Fixes / interactions with other extensions diff --git a/docs/Whats-New.md b/docs/Whats-New.md index cd865f0c19..ade0522dc2 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -439,6 +439,7 @@ New: - [Customize hardcoded projectile initial facing behavior](Fixed-or-Improved-Logics.md#customizing-initial-facing-behavior) (by Starkku) - Health bar permanently displayed (by FlyStar) - [`IsSimpleDeployer` facing customization & directional deploy animations](Fixed-or-Improved-Logics.md#issimpleDeployer-facing-and-animation-customization) (by Starkku) +- Fixed AI continuing to produce units and construct buildings from buildings affected by EMP. Vanilla fixes: - Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya) @@ -459,6 +460,7 @@ Vanilla fixes: - `DeployingAnim` now supports both `Normalized=true` and `Reverse=true` (by Starkku) - `DeployingAnim` using unit drawer now also tint accordingly with the unit (by Starkku) + Phobos fixes: - Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi) - Fixed an issue that `FireAngle` was not taken into account when drawing barrel in `TurretShadow` (by CrimRecya) From 1f660a91764d1c0ba97507f61a70cdcd53cda1a2 Mon Sep 17 00:00:00 2001 From: lvjia Date: Mon, 1 Sep 2025 15:26:15 +0800 Subject: [PATCH 3/6] doc --- docs/Whats-New.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Whats-New.md b/docs/Whats-New.md index ade0522dc2..351d2918cc 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -439,7 +439,7 @@ New: - [Customize hardcoded projectile initial facing behavior](Fixed-or-Improved-Logics.md#customizing-initial-facing-behavior) (by Starkku) - Health bar permanently displayed (by FlyStar) - [`IsSimpleDeployer` facing customization & directional deploy animations](Fixed-or-Improved-Logics.md#issimpleDeployer-facing-and-animation-customization) (by Starkku) -- Fixed AI continuing to produce units and construct buildings from buildings affected by EMP. +- Fixed AI continuing to produce units and construct buildings from buildings affected by EMP. (by ahasasjeb) Vanilla fixes: - Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya) From bf59c19bf4a6decde15f4bca4aadffce7af803f8 Mon Sep 17 00:00:00 2001 From: lvjia Date: Mon, 1 Sep 2025 15:31:42 +0800 Subject: [PATCH 4/6] reorder and group includes --- src/Ext/Techno/Body.Update.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ext/Techno/Body.Update.cpp b/src/Ext/Techno/Body.Update.cpp index ad236a6846..552447ef44 100644 --- a/src/Ext/Techno/Body.Update.cpp +++ b/src/Ext/Techno/Body.Update.cpp @@ -12,14 +12,14 @@ #include #include #include +#include +#include #include #include #include #include #include -#include -#include // TechnoClass_AI_0x6F9E50 From 903e781cd6a94d450f01abfd51dacb741c298649 Mon Sep 17 00:00:00 2001 From: lvjia Date: Mon, 1 Sep 2025 21:46:40 +0800 Subject: [PATCH 5/6] Clean up blank lines and add AI judgment --- docs/Whats-New.md | 1 - src/Ext/Techno/Body.Update.cpp | 14 +++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 351d2918cc..66ca4ae3d2 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -460,7 +460,6 @@ Vanilla fixes: - `DeployingAnim` now supports both `Normalized=true` and `Reverse=true` (by Starkku) - `DeployingAnim` using unit drawer now also tint accordingly with the unit (by Starkku) - Phobos fixes: - Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi) - Fixed an issue that `FireAngle` was not taken into account when drawing barrel in `TurretShadow` (by CrimRecya) diff --git a/src/Ext/Techno/Body.Update.cpp b/src/Ext/Techno/Body.Update.cpp index 552447ef44..f9f30d6825 100644 --- a/src/Ext/Techno/Body.Update.cpp +++ b/src/Ext/Techno/Body.Update.cpp @@ -12,6 +12,7 @@ #include #include #include + #include #include @@ -1641,16 +1642,19 @@ void TechnoExt::ExtData::UpdateRearmInEMPState() if (pThis->ReloadTimer.InProgress() && pTypeExt->NoReload_UnderEMP.Get(RulesExt::Global()->NoReload_UnderEMP)) pThis->ReloadTimer.StartTime++; - // Pause building factory production under EMP / Deactivated + // Pause building factory production under EMP / Deactivated (AI only) if (auto const pBuilding = abstract_cast(pThis)) { - if (auto const pFactory = pBuilding->Factory) + if (pBuilding->Owner && !pBuilding->Owner->IsControlledByHuman()) { - if (pFactory->Object && pFactory->Production.Rate > 0) + if (auto const pFactory = pBuilding->Factory) { - if (pFactory->Production.Timer.HasStarted() && !pFactory->Production.Timer.Expired()) + if (pFactory->Production.Timer.InProgress()) { - pFactory->Production.Timer.StartTime++; + if (pFactory->Production.Timer.HasStarted() && !pFactory->Production.Timer.Expired()) + { + pFactory->Production.Timer.StartTime++; + } } } } From 9a038766b41c9b5274f5fab5043f7c603b9b4ff4 Mon Sep 17 00:00:00 2001 From: lvjia Date: Tue, 2 Sep 2025 14:16:52 +0800 Subject: [PATCH 6/6] Remove redundant if statements --- src/Ext/Techno/Body.Update.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Ext/Techno/Body.Update.cpp b/src/Ext/Techno/Body.Update.cpp index f9f30d6825..787ae3752e 100644 --- a/src/Ext/Techno/Body.Update.cpp +++ b/src/Ext/Techno/Body.Update.cpp @@ -1651,10 +1651,7 @@ void TechnoExt::ExtData::UpdateRearmInEMPState() { if (pFactory->Production.Timer.InProgress()) { - if (pFactory->Production.Timer.HasStarted() && !pFactory->Production.Timer.Expired()) - { - pFactory->Production.Timer.StartTime++; - } + pFactory->Production.Timer.StartTime++; } } }