diff --git a/CREDITS.md b/CREDITS.md index 9026457bf8..e52fa692a9 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -732,6 +732,7 @@ This page lists all the individual contributions to the project by their author. - Fix the issue that the Jumpjet must end its movement before starting the next mission - Taunt warhead - Fix the bug where non-Teleporter miners would not return to work after minerals are depleted and then regenerated + - Miners back to work when ore regenerated - **solar-III (凤九歌)** - Target scanning delay customization (documentation) - Skip target scanning function calling for unarmed technos (documentation) diff --git a/YRpp b/YRpp index 1dde1af4d5..044629acb4 160000 --- a/YRpp +++ b/YRpp @@ -1 +1 @@ -Subproject commit 1dde1af4d58f630a07a313f8c0460a401e511270 +Subproject commit 044629acb47a4e2b8eefb440ca19754f40a43d7c diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 3f42622b1d..c7f49dbc33 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -317,6 +317,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Fixed the [EIP#007120F7](https://modenc.renegadeprojects.com/Internal_Error#eip_007120F7) that was triggered when repairing because the `Strength` value was lower than `RepairStep`. - Fixed the bug where non-Teleporter miners would not return to work after minerals are depleted and then regenerated. - Fixed a desync due to an inconsistent shroud state caused by `GapGenerator` and `SpySat` interaction. +- Now miners will no longer withdraw from the Harvest mission due to mineral depletion and will periodically attempt to return to work. ## Fixes / interactions with other extensions diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 486c6cc179..ec2d41e947 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -633,6 +633,7 @@ Vanilla fixes: - Fixed an issue where a unit might cause the target to fall from above its own head when using a locomotor warhead with `Locomotor=Jumpjet` to pull a target with `BalloonHover=yes` (by NetsuNegi) - Fixed the [EIP#007120F7](https://modenc.renegadeprojects.com/Internal_Error#eip_007120F7) caused when the `Strength` value is lower than `RepairStep` (by NetsuNegi) - Fixed the bug where non-Teleporter miners would not return to work after minerals are depleted and then regenerated (by TaranDahl) +- Miners back to work when ore regenerated (by TaranDahl) Phobos fixes: - Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi) diff --git a/src/Ext/Unit/Hooks.Harvester.cpp b/src/Ext/Unit/Hooks.Harvester.cpp index dcd679d3fe..79fcf84f56 100644 --- a/src/Ext/Unit/Hooks.Harvester.cpp +++ b/src/Ext/Unit/Hooks.Harvester.cpp @@ -1,4 +1,4 @@ -#include +#include #pragma region EnterRefineryFix @@ -240,3 +240,28 @@ DEFINE_HOOK(0x738A3E, UnitClass_EnterIdleMode_SubterraneanHarvester, 0x5) // Skip the check for Teleporter here; this is an unreasonable check. // This check determines whether miners on a Guard mission near the refinery should return to the Harvest mission. DEFINE_JUMP(LJMP, 0x740943, 0x740957); + +// Now, miners will no longer actively withdraw from the Harvest mission due to mineral depletion. +DEFINE_HOOK(0x73EEA6, UnitClass_MissionHarvest_AllOreGathered, 0x6) +{ + enum { SkipGameCode = 0x73EFA4 }; + + GET(UnitClass*, pThis, EBP); + + auto pBuilding = MapClass::Instance.GetCellAt(pThis->GetCoords())->GetBuilding(); + if (pBuilding && (pBuilding->Type->Refinery || pBuilding->Type->Weeder)) + { + CellStruct buffer = CellStruct::Empty; + pThis->NearbyLocation(&buffer, pBuilding); + auto pDest = MapClass::Instance.GetCellAt(buffer); + pThis->SetDestination(pDest, false); + R->EAX(15); + } + else + { + pThis->MissionStatus = 0; + R->EAX(100); + } + + return SkipGameCode; +}