diff --git a/CREDITS.md b/CREDITS.md index db73b2649c..bd89b75fc1 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -662,6 +662,7 @@ This page lists all the individual contributions to the project by their author. - Toggle per-target warhead effects apply timing - Extra range for chasing and pre-firing - Fix an issue that rockets do not consider the destination altitude during climbing + - Allow other vehicles to attempt to move above the target like `BalloonHover=yes` - **solar-III (凤九歌)** - Target scanning delay customization (documentation) - Skip target scanning function calling for unarmed technos (documentation) diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 5dc33e1079..0534fe5096 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -1974,6 +1974,18 @@ Harvester.CanGuardArea=false ; boolean Harvester.CanGuardArea.RequireTarget=false ; boolean ``` +### Allow other vehicles to attempt to move above the target like `BalloonHover=yes` + +- In vanilla, vehicles with `BalloonHover=yes` and a weapon with projectile with `Vertical=yes` will attempt to move above the target. +- Now you can make other vehicles do the same without `BalloonHover=yes`. + - A weapon with projectile with `Vertical=yes` is still needed. + +In `rulesmd.ini`: +```ini +[SOMEVEHICLE] ; VehicleType +CanGoAboveTarget=false ; boolean +``` + ### Bunker entering check dehardcode - In vanilla, vehicles entering tank bunkers are subject to a series of hardcoding restrictions, including having to have turrets, having to have weapons, and not having Hover speed types. Now you can skip these restrictions. diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 10c5a6a3ec..50d4c62e7a 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -480,6 +480,7 @@ New: - Allow techno type considered as other type when recruiting techno for teams (by NetsuNegi) - Map Action [`511` Undeploy Building to Waypoint](AI-Scripting-and-Mapping.md#undeploy-building-to-waypoint), [`609` Set Radar Mode](AI-Scripting-and-Mapping.md#set-radar-mode), [`610` Set house's `TeamDelays` value](AI-Scripting-and-Mapping.md#set-house-s-teamdelays-value) (by FlyStar) - Fixed an issue that rockets do not consider the destination altitude during climbing (by TaranDahl) +- [Allow other vehicles to attempt to move above the target like `BalloonHover=yes`](Fixed-or-Improved-Logics.md#allow-other-vehicles-to-attempt-to-move-above-the-target-like-balloonhoveryes) (by TaranDahl) Vanilla fixes: - Fixed sidebar not updating queued unit numbers when adding or removing units when the production is on hold (by CrimRecya) diff --git a/src/Ext/TechnoType/Body.cpp b/src/Ext/TechnoType/Body.cpp index 34846e8b06..e2f7273314 100644 --- a/src/Ext/TechnoType/Body.cpp +++ b/src/Ext/TechnoType/Body.cpp @@ -1115,6 +1115,8 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI) this->TeamMember_ConsideredAs.Read(exINI, pSection, "TeamMember.ConsideredAs"); + this->CanGoAboveTarget.Read(exINI, pSection, "CanGoAboveTarget"); + // Ares 0.2 this->RadarJamRadius.Read(exINI, pSection, "RadarJamRadius"); @@ -1790,6 +1792,8 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm) .Process(this->TeamMember_ConsideredAs) .Process(this->TurretResponse) + + .Process(this->CanGoAboveTarget) ; } void TechnoTypeExt::ExtData::LoadFromStream(PhobosStreamReader& Stm) diff --git a/src/Ext/TechnoType/Body.h b/src/Ext/TechnoType/Body.h index 88a037a994..d8419ea48f 100644 --- a/src/Ext/TechnoType/Body.h +++ b/src/Ext/TechnoType/Body.h @@ -455,6 +455,8 @@ class TechnoTypeExt Nullable TurretResponse; + Valueable CanGoAboveTarget; + ExtData(TechnoTypeClass* OwnerObject) : Extension(OwnerObject) , HealthBar_Hide { false } , HealthBar_HidePips { false } @@ -860,6 +862,8 @@ class TechnoTypeExt , TeamMember_ConsideredAs {} , TurretResponse {} + + , CanGoAboveTarget { false } { } virtual ~ExtData() = default; diff --git a/src/Ext/Unit/Hooks.Firing.cpp b/src/Ext/Unit/Hooks.Firing.cpp index 853ec461f1..3cfce40c1c 100644 --- a/src/Ext/Unit/Hooks.Firing.cpp +++ b/src/Ext/Unit/Hooks.Firing.cpp @@ -160,3 +160,12 @@ DEFINE_HOOK(0x741A96, UnitClass_SetDestination_ResetFiringFrame, 0x6) return 0; } + +DEFINE_HOOK(0x74159F, UnitClass_ApproachTarget_GoAboveTarget, 0x6) +{ + GET(UnitClass* const, pThis, ESI); + auto pType = pThis->Type; + auto pTypeExt = TechnoTypeExt::ExtMap.Find(pType); + R->AL(pType->BalloonHover || pTypeExt->CanGoAboveTarget); + return R->Origin() + 0x6; +}