Add plumbing for targeting of target center instead of closest targetable position
Note: Projectiles that can track their target need minor additional changes, but for InstantHit (which already implemented support for this) and unguided projectiles (Bullet, GravityBomb) this commit is already sufficient.
This commit is contained in:
@@ -131,7 +131,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return false;
|
||||
|
||||
var pos = self.CenterPosition;
|
||||
var delta = target.Positions.PositionClosestTo(pos) - pos;
|
||||
var targetPos = attack != null && attack.Info.AttackTargetCenter ? target.CenterPosition : target.Positions.PositionClosestTo(pos);
|
||||
var delta = targetPos - pos;
|
||||
DesiredFacing = delta.HorizontalLengthSquared != 0 ? delta.Yaw.Facing : TurretFacing;
|
||||
MoveTurret();
|
||||
return HasAchievedDesiredFacing;
|
||||
|
||||
Reference in New Issue
Block a user