Centralize weapon validity check into WeaponInfo.
This commit is contained in:
@@ -116,7 +116,7 @@ namespace OpenRA.Mods.RA
|
||||
if (target.IsInRange(self.CenterPosition, minRange))
|
||||
return;
|
||||
|
||||
if (!IsValidAgainst(self.World, target))
|
||||
if (!Weapon.IsValidAgainst(target, self.World))
|
||||
return;
|
||||
|
||||
var barrel = Barrels[Burst % Barrels.Length];
|
||||
@@ -172,14 +172,6 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsValidAgainst(World world, Target target)
|
||||
{
|
||||
if (target.IsActor)
|
||||
return Combat.WeaponValidForTarget(Weapon, target.Actor);
|
||||
else
|
||||
return Combat.WeaponValidForTarget(Weapon, world, target.CenterPosition.ToCPos());
|
||||
}
|
||||
|
||||
public bool IsReloading { get { return FireDelay > 0; } }
|
||||
|
||||
public WVec MuzzleOffset(Actor self, Barrel b)
|
||||
|
||||
Reference in New Issue
Block a user