Use WVec overload of Util.GetFacing where possible.
This commit is contained in:
@@ -45,7 +45,7 @@ namespace OpenRA.Traits
|
||||
return GetFacing(d.ToInt2(), currentFacing);
|
||||
}
|
||||
|
||||
public static int GetFacing( int2 d, int currentFacing )
|
||||
public static int GetFacing(int2 d, int currentFacing)
|
||||
{
|
||||
if (d == int2.Zero)
|
||||
return currentFacing;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
return (AllowMovement) ? Util.SequenceActivities(self.Trait<Mobile>().MoveWithinRange(Target, Range.Range / 1024), this) : NextActivity;
|
||||
}
|
||||
|
||||
var desiredFacing = Util.GetFacing(Target.CenterLocation - self.CenterLocation, 0);
|
||||
var desiredFacing = Util.GetFacing(Target.CenterPosition - self.CenterPosition, 0);
|
||||
var facing = self.Trait<IFacing>();
|
||||
if (facing.Facing != desiredFacing)
|
||||
return Util.SequenceActivities(new Turn(desiredFacing), this);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
|
||||
var aircraft = self.Trait<Aircraft>();
|
||||
|
||||
var desiredFacing = Util.GetFacing(d.ToInt2(), aircraft.Facing);
|
||||
var desiredFacing = Util.GetFacing(d, aircraft.Facing);
|
||||
if (aircraft.Altitude == cruiseAltitude)
|
||||
aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, aircraft.ROT);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
}
|
||||
|
||||
var attack = self.Trait<AttackHeli>();
|
||||
var dist = target.CenterLocation - self.CenterLocation;
|
||||
var dist = target.CenterPosition - self.CenterPosition;
|
||||
|
||||
var desiredFacing = Util.GetFacing(dist, aircraft.Facing);
|
||||
aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, aircraft.ROT);
|
||||
|
||||
@@ -27,8 +27,8 @@ namespace OpenRA.Mods.RA.Air
|
||||
|
||||
if (IsCanceled) return NextActivity;
|
||||
|
||||
var d = Target.CenterLocation - self.CenterLocation;
|
||||
if (d.LengthSquared < 50) /* close enough */
|
||||
var d = Target.CenterPosition - self.CenterPosition;
|
||||
if (d.LengthSquared < 256*256) // close enough (1/4 cell)
|
||||
return NextActivity;
|
||||
|
||||
var aircraft = self.Trait<Aircraft>();
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA
|
||||
return false;
|
||||
|
||||
var facing = self.Trait<IFacing>().Facing;
|
||||
var facingToTarget = Util.GetFacing(target.CenterLocation - self.CenterLocation, facing);
|
||||
var facingToTarget = Util.GetFacing(target.CenterPosition - self.CenterPosition, facing);
|
||||
|
||||
if (Math.Abs(facingToTarget - facing) % 256 > info.FacingTolerance)
|
||||
return false;
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace OpenRA.Mods.RA.Missions
|
||||
{
|
||||
Sound.Play("reinfor1.aud");
|
||||
foreach (var unit in units)
|
||||
world.CreateActor(unit, greece, startEntryPoint.Location, Util.GetFacing(startBridgeEndPoint.CenterLocation - startEntryPoint.CenterLocation, 0))
|
||||
world.CreateActor(unit, greece, startEntryPoint.Location, Util.GetFacing(startBridgeEndPoint.CenterPosition - startEntryPoint.CenterPosition, 0))
|
||||
.QueueActivity(new Move.Move(startMovePoint.Location, 0));
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace OpenRA.Mods.RA.Missions
|
||||
{
|
||||
Sound.Play("reinfor1.aud");
|
||||
foreach (var unit in units)
|
||||
world.CreateActor(unit, greece, alliedBaseEntryPoint.Location, Util.GetFacing(alliedBaseMovePoint.CenterLocation - alliedBaseEntryPoint.CenterLocation, 0))
|
||||
world.CreateActor(unit, greece, alliedBaseEntryPoint.Location, Util.GetFacing(alliedBaseMovePoint.CenterPosition - alliedBaseEntryPoint.CenterPosition, 0))
|
||||
.QueueActivity(new Move.Move(alliedBaseMovePoint.Location, 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
new LocationInit( enterCell ),
|
||||
new OwnerInit( self.Owner ),
|
||||
new FacingInit( Util.GetFacing((order.TargetLocation - enterCell).ToInt2(), 0) ),
|
||||
new FacingInit( Util.GetFacing(order.TargetLocation - enterCell, 0) ),
|
||||
new AltitudeInit( Rules.Info["u2"].Traits.Get<PlaneInfo>().CruiseAltitude ),
|
||||
});
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public bool FaceTarget(Actor self, Target target)
|
||||
{
|
||||
desiredFacing = Util.GetFacing(target.CenterLocation - self.CenterLocation, turretFacing);
|
||||
desiredFacing = Util.GetFacing(target.CenterPosition - self.CenterPosition, turretFacing);
|
||||
return turretFacing == desiredFacing;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user