Convert turret facings to WAngle relative to the body.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user