Properly account for disabled Armaments in various places
These places didn't care if an Armament was disabled, which could lead to unexpected behavior.
This commit is contained in:
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
// TODO: This should fire each weapon at its maximum range
|
// TODO: This should fire each weapon at its maximum range
|
||||||
if (attackPlane != null && target.IsInRange(self.CenterPosition, attackPlane.Armaments.Select(a => a.Weapon.MinRange).Min()))
|
if (attackPlane != null && target.IsInRange(self.CenterPosition, attackPlane.Armaments.Where(Exts.IsTraitEnabled).Select(a => a.Weapon.MinRange).Min()))
|
||||||
ChildActivity = ActivityUtils.SequenceActivities(new FlyTimed(ticksUntilTurn, self), new Fly(self, target), new FlyTimed(ticksUntilTurn, self));
|
ChildActivity = ActivityUtils.SequenceActivities(new FlyTimed(ticksUntilTurn, self), new Fly(self, target), new FlyTimed(ticksUntilTurn, self));
|
||||||
else
|
else
|
||||||
ChildActivity = ActivityUtils.SequenceActivities(new Fly(self, target), new FlyTimed(ticksUntilTurn, self));
|
ChildActivity = ActivityUtils.SequenceActivities(new Fly(self, target), new FlyTimed(ticksUntilTurn, self));
|
||||||
|
|||||||
@@ -151,6 +151,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
foreach (var a in Armaments)
|
foreach (var a in Armaments)
|
||||||
{
|
{
|
||||||
|
if (a.IsTraitDisabled)
|
||||||
|
continue;
|
||||||
|
|
||||||
var port = SelectFirePort(self, targetYaw);
|
var port = SelectFirePort(self, targetYaw);
|
||||||
if (port == null)
|
if (port == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -115,6 +115,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
foreach (var a in attack.Armaments)
|
foreach (var a in attack.Armaments)
|
||||||
{
|
{
|
||||||
|
if (a.IsTraitDisabled)
|
||||||
|
continue;
|
||||||
|
|
||||||
foreach (var b in a.Barrels)
|
foreach (var b in a.Barrels)
|
||||||
{
|
{
|
||||||
var muzzle = self.CenterPosition + a.MuzzleOffset(self, b);
|
var muzzle = self.CenterPosition + a.MuzzleOffset(self, b);
|
||||||
|
|||||||
Reference in New Issue
Block a user