stance wiring for AutoTarget/AutoHeal
This commit is contained in:
@@ -65,7 +65,7 @@ namespace OpenRA.Traits
|
||||
var inRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range);
|
||||
|
||||
return inRange
|
||||
.Where(a => a.Owner == self.Owner && a != self) /* todo: one day deal with friendly players */
|
||||
.Where(a => a != self && self.Owner.Stances[ a.Owner ] == Stance.Ally)
|
||||
.Where(a => Combat.HasAnyValidWeapons(self, a))
|
||||
.Where(a => a.Health < a.Info.Traits.Get<OwnedActorInfo>().HP)
|
||||
.OrderBy(a => (a.Location - self.Location).LengthSquared)
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.Traits
|
||||
var inRange = self.World.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range);
|
||||
|
||||
return inRange
|
||||
.Where(a => a.Owner != null && a.Owner != self.Owner) /* todo: one day deal with friendly players */
|
||||
.Where(a => a.Owner != null && self.Owner.Stances[ a.Owner ] == Stance.Enemy)
|
||||
.Where(a => Combat.HasAnyValidWeapons(self, a))
|
||||
.OrderBy(a => (a.Location - self.Location).LengthSquared)
|
||||
.FirstOrDefault();
|
||||
@@ -62,7 +62,7 @@ namespace OpenRA.Traits
|
||||
if (!Combat.HasAnyValidWeapons(self, e.Attacker))
|
||||
return;
|
||||
|
||||
if (e.Attacker.Owner == self.Owner)
|
||||
if (self.Owner.Stances[e.Attacker.Owner] == Stance.Ally)
|
||||
return; // don't retaliate against own units force-firing on us. it's usually not what the player wanted.
|
||||
|
||||
if (e.Damage < 0)
|
||||
|
||||
Reference in New Issue
Block a user