Skip to content

Commit

Permalink
Override selection if the mouse is over an already selected actor.
Browse files Browse the repository at this point in the history
  • Loading branch information
pchote authored and abcdefg30 committed Oct 30, 2019
1 parent 0e4cb53 commit 5315f86
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions OpenRA.Mods.Common/Traits/Air/Aircraft.cs
Expand Up @@ -1182,6 +1182,10 @@ public AircraftMoveOrderTargeter(Aircraft aircraft)

public bool TargetOverridesSelection(Actor self, Target target, List<Actor> 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);
}

Expand Down
4 changes: 4 additions & 0 deletions OpenRA.Mods.Common/Traits/Buildings/TransformsIntoAircraft.cs
Expand Up @@ -160,6 +160,10 @@ class AircraftMoveOrderTargeter : IOrderTargeter

public bool TargetOverridesSelection(Actor self, Target target, List<Actor> 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);
}

Expand Down
4 changes: 4 additions & 0 deletions OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs
Expand Up @@ -160,6 +160,10 @@ class MoveOrderTargeter : IOrderTargeter
readonly bool rejectMove;
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> 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);
}

Expand Down
4 changes: 4 additions & 0 deletions OpenRA.Mods.Common/Traits/Mobile.cs
Expand Up @@ -958,6 +958,10 @@ class MoveOrderTargeter : IOrderTargeter
readonly bool rejectMove;
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> 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);
}

Expand Down

0 comments on commit 5315f86

Please sign in to comment.