Change to use pattern matching

This commit is contained in:
teinarss
2021-02-28 19:00:32 +01:00
committed by reaperrr
parent 7c0e4b25ae
commit d60c05eff3
35 changed files with 63 additions and 122 deletions

View File

@@ -197,10 +197,9 @@ namespace OpenRA.Mods.Common.Activities
maxRange = armaments.Min(a => a.MaxRange());
var pos = self.CenterPosition;
var mobile = move as Mobile;
if (!target.IsInRange(pos, maxRange)
|| (minRange.Length != 0 && target.IsInRange(pos, minRange))
|| (mobile != null && !mobile.CanInteractWithGroundLayer(self)))
|| (move is Mobile mobile && !mobile.CanInteractWithGroundLayer(self)))
{
// Try to move within range, drop the target otherwise
if (move == null)