Convert turret facings to WAngle relative to the body.

This commit is contained in:
Paul Chote
2020-07-18 12:41:22 +01:00
committed by reaperrr
parent 70a86bed7a
commit 75cb5c2166
15 changed files with 189 additions and 192 deletions

View File

@@ -110,11 +110,7 @@ namespace OpenRA.Mods.Common.Traits
if (turret != null)
{
// WorldOrientation is quantized to satisfy the *Fudges.
// Need to then convert back to a pseudo-local coordinate space, apply offsets,
// then rotate back at the end
var turretOrientation = turret.WorldOrientation(self) - quantizedBodyOrientation;
localOffset = localOffset.Rotate(turretOrientation);
localOffset = localOffset.Rotate(turret.LocalOrientation);
localOffset += turret.Offset;
}
@@ -123,27 +119,15 @@ namespace OpenRA.Mods.Common.Traits
public WDist DistanceFromEdge(Actor self, WPos pos)
{
var origin = self.CenterPosition;
var orientation = self.Orientation;
if (turret != null)
{
origin += turret.Position(self);
orientation = turret.WorldOrientation(self);
}
var origin = turret != null ? self.CenterPosition + turret.Position(self) : self.CenterPosition;
var orientation = turret != null ? turret.WorldOrientation : self.Orientation;
return Info.Type.DistanceFromEdge(pos, origin, orientation);
}
public IEnumerable<IRenderable> RenderDebugOverlay(Actor self, WorldRenderer wr)
{
var origin = self.CenterPosition;
var orientation = self.Orientation;
if (turret != null)
{
origin += turret.Position(self);
orientation = turret.WorldOrientation(self);
}
var origin = turret != null ? self.CenterPosition + turret.Position(self) : self.CenterPosition;
var orientation = turret != null ? turret.WorldOrientation : self.Orientation;
return Info.Type.RenderDebugOverlay(wr, origin, orientation);
}
}