ra: 托管时镜头自动跟随防守热点
Some checks failed
Continuous Integration / Linux (.NET 8.0) (push) Has been cancelled
Continuous Integration / Windows (.NET 8.0) (push) Has been cancelled

新增 BotTakeoverCameraFollower(Player trait):托管开启时通过 ViewportCenterProvider 自动跟随热点事件,默认偏防守(基地/矿区受击优先,建造落点次之),并使用热点衰减 + 最短驻留时间 + 切换阈值避免多处战斗时镜头抖动。

同时:

- mods/ra/rules/player.yaml 接入该 trait(仅 takeover 激活时生效)

- 修复 ingame-player.yaml 的 TooltipDesc/FTL 校验警告

- 小幅代码风格优化(不改行为)
This commit is contained in:
let5sne.win10
2026-01-11 23:27:24 +08:00
parent ec3107e6e7
commit 9d80847a9a
5 changed files with 508 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Widgets
var button = widget.Get<ButtonWidget>("LLM_TAKEOVER");
button.GetText = () => IsTakeoverActive() ? "Cancel AI" : "AI";
button.IsHighlighted = () => IsTakeoverActive();
button.IsHighlighted = IsTakeoverActive;
button.OnClick = OnTakeoverClick;
button.IsDisabled = () => world.LocalPlayer == null
|| world.LocalPlayer.WinState != WinState.Undefined;
@@ -50,8 +50,7 @@ namespace OpenRA.Mods.Common.Widgets
// Prefer the classic AI takeover manager (uses ModularBot + original bot modules).
var takeover = player.PlayerActor.TraitOrDefault<BotTakeoverManager>();
if (takeover != null)
takeover.Toggle();
takeover?.Toggle();
}
}
}