Fix AttackBomber marking aircraft that are not in the world as in range
This commit is contained in:
committed by
Oliver Brakmann
parent
87e33a75c6
commit
b066005f7e
@@ -50,28 +50,31 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void ITick.Tick(Actor self)
|
||||
{
|
||||
var dat = self.World.Map.DistanceAboveTerrain(target.CenterPosition);
|
||||
target = Target.FromPos(target.CenterPosition - new WVec(WDist.Zero, WDist.Zero, dat));
|
||||
var wasInAttackRange = inAttackRange;
|
||||
var wasFacingTarget = facingTarget;
|
||||
|
||||
inAttackRange = false;
|
||||
|
||||
facingTarget = TargetInFiringArc(self, target, 4 * info.FacingTolerance);
|
||||
|
||||
foreach (var a in Armaments)
|
||||
if (self.IsInWorld)
|
||||
{
|
||||
if (!target.IsInRange(self.CenterPosition, a.MaxRange()))
|
||||
continue;
|
||||
var dat = self.World.Map.DistanceAboveTerrain(target.CenterPosition);
|
||||
target = Target.FromPos(target.CenterPosition - new WVec(WDist.Zero, WDist.Zero, dat));
|
||||
|
||||
inAttackRange = true;
|
||||
a.CheckFire(self, facing, target);
|
||||
var wasFacingTarget = facingTarget;
|
||||
facingTarget = TargetInFiringArc(self, target, 4 * info.FacingTolerance);
|
||||
|
||||
foreach (var a in Armaments)
|
||||
{
|
||||
if (!target.IsInRange(self.CenterPosition, a.MaxRange()))
|
||||
continue;
|
||||
|
||||
inAttackRange = true;
|
||||
a.CheckFire(self, facing, target);
|
||||
}
|
||||
|
||||
// Actors without armaments may want to trigger an action when it passes the target
|
||||
if (!Armaments.Any())
|
||||
inAttackRange = !wasInAttackRange && !facingTarget && wasFacingTarget;
|
||||
}
|
||||
|
||||
// Actors without armaments may want to trigger an action when it passes the target
|
||||
if (!Armaments.Any())
|
||||
inAttackRange = !wasInAttackRange && !facingTarget && wasFacingTarget;
|
||||
|
||||
if (inAttackRange && !wasInAttackRange)
|
||||
OnEnteredAttackRange(self);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user