diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 25ae3556ec..aa41f7b434 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -292,7 +292,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - Vehicles overlapping `Wall=true` OverlayTypes no longer display sell cursor and cannot be sold. - Fixed vehicles disguised as trees incorrectly displaying veterancy insignia when they shouldn't. - Fixed the issue where the AI's regular targeting would also target garrisonable buildings. -- Fixed the issue that the move mission of the jumpjet does not end correctly. +- Fixed the issue that the move mission doesn't end when the techno is moving, which is mostly problematic for jumpjet and hover techno. Set `[General] -> ReadyToNextMission.MovingCheck` to true to disable the fix. - AI team garrison scripts now re-evaluate destination immediately instead of trying to garrison ungarrisonable building before changing target. - Fixed the bug that `DeploysInto` and `UndeploysInto` will make damaged techno lose 1 health. - Fixed the issue that the Jumpjet must end its movement before starting the next mission. diff --git a/src/Ext/Rules/Body.cpp b/src/Ext/Rules/Body.cpp index 13856705e2..5f1a6ab7d8 100644 --- a/src/Ext/Rules/Body.cpp +++ b/src/Ext/Rules/Body.cpp @@ -600,6 +600,8 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI) this->ApproachTarget_StopWhenInRange.Read(exINI, GameStrings::General, "AttackMove.StopWhenTargetAcquired"); this->ApproachTarget_StopWhenInRange.Read(exINI, GameStrings::General, "ApproachTarget.StopWhenInRange"); + this->ReadyToNextMission_MovingCheck.Read(exINI, GameStrings::General, "ReadyToNextMission.MovingCheck"); + // Section AITargetTypes int itemsCount = pINI->GetKeyCount("AITargetTypes"); for (int i = 0; i < itemsCount; ++i) @@ -1071,6 +1073,7 @@ void RulesExt::ExtData::Serialize(T& Stm) .Process(this->PoseDir_Production) .Process(this->PoseDir_Field) .Process(this->ApproachTarget_StopWhenInRange) + .Process(this->ReadyToNextMission_MovingCheck) ; } diff --git a/src/Ext/Rules/Body.h b/src/Ext/Rules/Body.h index 0711960642..cae5c9046e 100644 --- a/src/Ext/Rules/Body.h +++ b/src/Ext/Rules/Body.h @@ -527,6 +527,7 @@ class RulesExt Nullable PoseDir_Field; Valueable ApproachTarget_StopWhenInRange; + Valueable ReadyToNextMission_MovingCheck; ExtData(RulesClass* OwnerObject) : Extension(OwnerObject) , Storage_TiberiumIndex { -1 } @@ -990,6 +991,7 @@ class RulesExt , PoseDir_Field{} , ApproachTarget_StopWhenInRange { false } + , ReadyToNextMission_MovingCheck { false } { } virtual ~ExtData() = default; diff --git a/src/Misc/Hooks.BugFixes.cpp b/src/Misc/Hooks.BugFixes.cpp index 7e7eec05a0..af35a93a06 100644 --- a/src/Misc/Hooks.BugFixes.cpp +++ b/src/Misc/Hooks.BugFixes.cpp @@ -3311,9 +3311,15 @@ DEFINE_HOOK(0x73992B, UnitClass_TryToDeploy_SetBuildingHealthPercentage, 0x7) DEFINE_HOOK_AGAIN(0x521BA7, FootClass_ReadyToNextMission_MovingCheck, 0x6); // Infantry DEFINE_HOOK(0x7442D6, FootClass_ReadyToNextMission_MovingCheck, 0x6) // Unit { - GET(FootClass*, pThis, ESI); - const auto pLoco = pThis->Locomotor.GetInterfacePtr(); - R->AL(!locomotion_cast(pLoco) && !locomotion_cast(pLoco) && pLoco->Is_Moving_Now()); + bool result = false; + + if (RulesExt::Global()->ReadyToNextMission_MovingCheck) + { + GET(FootClass*, pThis, ESI); + result = pThis->Locomotor.GetInterfacePtr()->Is_Moving_Now(); + } + + R->AL(result); return R->Origin() + 0xF; }