From 900e857bfa538b60f275777e6822f5ed4e4b02e6 Mon Sep 17 00:00:00 2001 From: matjaeck <37185497+matjaeck@users.noreply.github.com> Date: Fri, 1 Nov 2019 17:17:02 +0100 Subject: [PATCH] Let AI ignore frozen actors and target original actors instead. --- OpenRA.Mods.Common/TargetExtensions.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/TargetExtensions.cs b/OpenRA.Mods.Common/TargetExtensions.cs index 745aa7cc60..7e0c0df63b 100644 --- a/OpenRA.Mods.Common/TargetExtensions.cs +++ b/OpenRA.Mods.Common/TargetExtensions.cs @@ -42,7 +42,20 @@ namespace OpenRA.Mods.Common // Bot-controlled units aren't yet capable of understanding visibility changes if (viewer.IsBot) + { + // Prevent that bot-controlled units endlessly fire at frozen actors. + // TODO: Teach the AI to support long range artillery units with units that provide line of sight + if (t.Type == TargetType.FrozenActor) + { + if (t.FrozenActor.Actor != null) + return Target.FromActor(t.FrozenActor.Actor); + + // Original actor was killed + return Target.Invalid; + } + return t; + } if (t.Type == TargetType.Actor) { @@ -68,8 +81,7 @@ namespace OpenRA.Mods.Common return Target.FromActor(t.FrozenActor.Actor); // Original actor was killed while hidden - if (t.Actor == null) - return Target.Invalid; + return Target.Invalid; } }