From 5315f8603f62eb6e9bc7f45ad8b309206e0ce966 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 29 Oct 2019 20:41:19 +0000 Subject: [PATCH] Override selection if the mouse is over an already selected actor. --- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 4 ++++ OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs | 4 ++++ OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs | 4 ++++ OpenRA.Mods.Common/Traits/Mobile.cs | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index b7834c4190..43541f35ed 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -1182,6 +1182,10 @@ namespace OpenRA.Mods.Common.Traits public bool TargetOverridesSelection(Actor self, Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { + // Always prioritise orders over selecting other peoples actors or own actors that are already selected + if (target.Type == TargetType.Actor && (target.Actor.Owner != self.Owner || self.World.Selection.Contains(target.Actor))) + return true; + return modifiers.HasModifier(TargetModifiers.ForceMove); } diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs index fb7e496be9..527562bdfc 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs @@ -160,6 +160,10 @@ namespace OpenRA.Mods.Common.Traits public bool TargetOverridesSelection(Actor self, Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { + // Always prioritise orders over selecting other peoples actors or own actors that are already selected + if (target.Type == TargetType.Actor && (target.Actor.Owner != self.Owner || self.World.Selection.Contains(target.Actor))) + return true; + return modifiers.HasModifier(TargetModifiers.ForceMove); } diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs index 620b3551b1..ab9cc4df21 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs @@ -160,6 +160,10 @@ namespace OpenRA.Mods.Common.Traits readonly bool rejectMove; public bool TargetOverridesSelection(Actor self, Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { + // Always prioritise orders over selecting other peoples actors or own actors that are already selected + if (target.Type == TargetType.Actor && (target.Actor.Owner != self.Owner || self.World.Selection.Contains(target.Actor))) + return true; + return modifiers.HasModifier(TargetModifiers.ForceMove); } diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 5df1c950c0..2697deeaef 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -958,6 +958,10 @@ namespace OpenRA.Mods.Common.Traits readonly bool rejectMove; public bool TargetOverridesSelection(Actor self, Target target, List actorsAt, CPos xy, TargetModifiers modifiers) { + // Always prioritise orders over selecting other peoples actors or own actors that are already selected + if (target.Type == TargetType.Actor && (target.Actor.Owner != self.Owner || self.World.Selection.Contains(target.Actor))) + return true; + return modifiers.HasModifier(TargetModifiers.ForceMove); }