From d4e6815f64a32b7211005eea6d166514f5a378c5 Mon Sep 17 00:00:00 2001 From: Gustas Date: Thu, 27 Jul 2023 21:23:20 +0300 Subject: [PATCH] Fix AutoTarget ignoring frozen actor bot targeting hack Mirrors check of the function Recalculate which is found it TargetExtensions class --- OpenRA.Mods.Common/Traits/AutoTarget.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenRA.Mods.Common/Traits/AutoTarget.cs b/OpenRA.Mods.Common/Traits/AutoTarget.cs index 8bdb36446e..da2fb44b36 100644 --- a/OpenRA.Mods.Common/Traits/AutoTarget.cs +++ b/OpenRA.Mods.Common/Traits/AutoTarget.cs @@ -387,6 +387,12 @@ namespace OpenRA.Mods.Common.Traits if (attackStances == PlayerRelationship.Enemy && self.Owner.RelationshipWith(target.FrozenActor.Owner) == PlayerRelationship.Ally) continue; + // Bot-controlled units aren't yet capable of understanding visibility changes + // 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 (self.Owner.IsBot && target.FrozenActor.Actor == null) + continue; + targetTypes = target.FrozenActor.TargetTypes; owner = target.FrozenActor.Owner; }