diff --git a/CREDITS.md b/CREDITS.md index eb12fff2ab..11158dfece 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -847,6 +847,7 @@ This page lists all the individual contributions to the project by their author. - Allow beacon placement hotkey in single player - Adjust recruitable status on team member discharge - RA1-Style multi-turret and multi-barrel + - Allow other vehicles to attempt to move above the target like ZEP - **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 4b8f7a1d69..b38a10c704 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -2437,6 +2437,17 @@ Harvester.CanGuardArea=false ; boolean Harvester.CanGuardArea.RequireTarget=false ; boolean ``` +### Allow other vehicles to attempt to move above the target like ZEP + +- 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` or `Vertical=yes`. + +In `rulesmd.ini`: +```ini +[SOMEWEAPON] ; WeaponType +GoAboveTarget=false ; boolean +``` + ### Custom Unit Crate Reroll Chance - It is possible to influence weighting of units given from crates (`CrateGoodie=true`) via `CrateGoodie.RerollChance`, which determines the chance that if this type of unit is rolled, it will reroll again for another type of unit. diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 4e6da264d3..dace6a7df8 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -631,6 +631,7 @@ HideShakeEffects=false ; boolean - [Show game time](User-Interface.md#show-game-time) (by Trsdy & Ollerus) - Provided a toggle for whether the landing direction in default scenarios does not use the building direction but follows `[AudioVisual] -> PoseDir` (by Noble_Fish) - [Separate the definitions of default direction for aircraft production and landing in the field](Fixed-or-Improved-Logics.md#separate-the-definitions-of-default-direction-for-aircraft-production-and-landing-in-the-field) (by Noble_Fish) +- Allow other vehicles to attempt to move above the target like ZEP (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/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po b/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po index 4545b47fdb..af64bdff1f 100644 --- a/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po +++ b/docs/locale/zh_CN/LC_MESSAGES/CREDITS.po @@ -2880,6 +2880,9 @@ msgstr "允许在单人模式下使用信标放置快捷键" msgid "Adjust recruitable status on team member discharge" msgstr "小队成员解散时调整可招募性" +msgid "Allow other vehicles to attempt to move above the target like ZEP" +msgstr "使其他单位也能像 ZEP 一样尝试移动到目标上方" + msgid "**solar-III (凤九歌)**" msgstr "**solar-III(凤九歌)**" diff --git a/docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po b/docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po index 5c10053105..bf62de8aa4 100644 --- a/docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po +++ b/docs/locale/zh_CN/LC_MESSAGES/Fixed-or-Improved-Logics.po @@ -5192,6 +5192,21 @@ msgstr "" "若 `Harvester.CanGuardArea.RequireTarget` 设为 " "true,当单位警戒范围内不存在有效目标时将会切换回通常所用的 `Havrest` 任务。" +msgid "Allow other vehicles to attempt to move above the target like ZEP" +msgstr "使其他单位也能像 ZEP 一样尝试移动到目标上方" + +msgid "" +"In vanilla, vehicles with `BalloonHover=yes` and a weapon with projectile " +"with `Vertical=yes` will attempt to move above the target." +msgstr "" +"在原版中,拥有 `BalloonHover=yes` 且武器抛射体 `Vertical=yes` 的载具会尝试移动到目标上方。" + +msgid "" +"Now you can make other vehicles do the same without `BalloonHover=yes` or " +"`Vertical=yes`." +msgstr "" +"现在你可以让其他载具无需 `BalloonHover=yes` 或 `Vertical=yes` 也能做到这点。" + msgid "Custom Unit Crate Reroll Chance" msgstr "自定义单位箱子重新随机选取的概率" diff --git a/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po b/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po index df40f4feb0..40649d37bf 100644 --- a/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po +++ b/docs/locale/zh_CN/LC_MESSAGES/Whats-New.po @@ -2940,6 +2940,12 @@ msgid "" "set to a value exceeding 256 (by Noble_Fish)" msgstr "修复降落方向设为超出 256 的值时不能正确换算的 Bug(by Noble_Fish)" +msgid "" +"Allow other vehicles to attempt to move above the target like ZEP (by " +"TaranDahl)" +msgstr "" +"使其他单位也能像 ZEP 一样尝试移动到目标上方(by TaranDahl)" + msgid "Fixes / interactions with other extensions:" msgstr "其他扩展引擎相关的修复/交互:" diff --git a/src/Ext/Unit/Hooks.Firing.cpp b/src/Ext/Unit/Hooks.Firing.cpp index c1ddb088f7..1c9706dcb7 100644 --- a/src/Ext/Unit/Hooks.Firing.cpp +++ b/src/Ext/Unit/Hooks.Firing.cpp @@ -160,3 +160,21 @@ DEFINE_HOOK(0x741A96, UnitClass_SetDestination_ResetFiringFrame, 0x6) return 0; } + +DEFINE_HOOK(0x74159F, UnitClass_ApproachTarget_GoAboveTarget, 0x6) +{ + GET(UnitClass* const, pThis, ESI); + + if (const auto pTarget = pThis->Target) + { + const int weaponIndex = pThis->SelectWeapon(pTarget); + + if (const auto pWeapon = pThis->GetWeapon(weaponIndex)->WeaponType) + { + if (WeaponTypeExt::Fetch(pWeapon)->GoAboveTarget) + return 0x7415E5; + } + } + + return 0; +} diff --git a/src/Ext/WeaponType/Body.cpp b/src/Ext/WeaponType/Body.cpp index 11b52fe3a6..ea0cb30d34 100644 --- a/src/Ext/WeaponType/Body.cpp +++ b/src/Ext/WeaponType/Body.cpp @@ -197,6 +197,7 @@ void WeaponTypeExt::LoadFromINIFile(CCINIClass* const pINI) this->AttackCursorOnFriendlies.Read(exINI, pSection, "AttackCursorOnFriendlies"); this->AttackNoThreatBuildings.Read(exINI, pSection, "AttackNoThreatBuildings"); this->CylinderRangefinding.Read(exINI, pSection, "CylinderRangefinding"); + this->GoAboveTarget.Read(exINI, pSection, "GoAboveTarget"); this->Anim_Update.Read(exINI, pSection, "Anim.Update"); // handle SkipWeaponPicking @@ -305,6 +306,7 @@ void WeaponTypeExt::Serialize(T& Stm) .Process(this->AttackCursorOnFriendlies) .Process(this->AttackNoThreatBuildings) .Process(this->CylinderRangefinding) + .Process(this->GoAboveTarget) .Process(this->Anim_Update) ; }; diff --git a/src/Ext/WeaponType/Body.h b/src/Ext/WeaponType/Body.h index 9e443bb85a..fdf676e841 100644 --- a/src/Ext/WeaponType/Body.h +++ b/src/Ext/WeaponType/Body.h @@ -109,7 +109,7 @@ class WeaponTypeExt final : public AbstractTypeExt Nullable AttackFriendlies; Nullable AttackCursorOnFriendlies; Nullable AttackNoThreatBuildings; - + Valueable GoAboveTarget; Nullable Anim_Update; bool SkipWeaponPicking; @@ -204,6 +204,7 @@ class WeaponTypeExt final : public AbstractTypeExt , AttackCursorOnFriendlies {} , AttackNoThreatBuildings {} , CylinderRangefinding {} + , GoAboveTarget { false } , Anim_Update {} { }