remove unnecessary parameters from Aircraft.MovementSpeedForCell, and rename to MovementSpeed
This commit is contained in:
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
public static void Fly(Actor self, int desiredAltitude )
|
public static void Fly(Actor self, int desiredAltitude )
|
||||||
{
|
{
|
||||||
var aircraft = self.Trait<Aircraft>();
|
var aircraft = self.Trait<Aircraft>();
|
||||||
var speed = .2f * aircraft.MovementSpeedForCell(self, self.Location);
|
var speed = .2f * aircraft.MovementSpeed;
|
||||||
var angle = aircraft.Facing / 128f * Math.PI;
|
var angle = aircraft.Facing / 128f * Math.PI;
|
||||||
aircraft.center += speed * -float2.FromAngle((float)angle);
|
aircraft.center += speed * -float2.FromAngle((float)angle);
|
||||||
aircraft.Altitude += Math.Sign(desiredAltitude - aircraft.Altitude);
|
aircraft.Altitude += Math.Sign(desiredAltitude - aircraft.Altitude);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
|
|
||||||
var desiredFacing = Util.GetFacing(dist, aircraft.Facing);
|
var desiredFacing = Util.GetFacing(dist, aircraft.Facing);
|
||||||
aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, aircraft.ROT);
|
aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, aircraft.ROT);
|
||||||
var rawSpeed = .2f * aircraft.MovementSpeedForCell(self, self.Location);
|
var rawSpeed = .2f * aircraft.MovementSpeed;
|
||||||
|
|
||||||
if (!float2.WithinEpsilon(float2.Zero, dist, range * Game.CellSize))
|
if (!float2.WithinEpsilon(float2.Zero, dist, range * Game.CellSize))
|
||||||
aircraft.center += (rawSpeed / dist.Length) * dist;
|
aircraft.center += (rawSpeed / dist.Length) * dist;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing,
|
aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing,
|
||||||
aircraft.ROT);
|
aircraft.ROT);
|
||||||
|
|
||||||
var rawSpeed = .2f * aircraft.MovementSpeedForCell(self, self.Location);
|
var rawSpeed = .2f * aircraft.MovementSpeed;
|
||||||
aircraft.center += (rawSpeed / dist.Length) * dist;
|
aircraft.center += (rawSpeed / dist.Length) * dist;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
|
|
||||||
var desiredFacing = Util.GetFacing(d, aircraft.Facing);
|
var desiredFacing = Util.GetFacing(d, aircraft.Facing);
|
||||||
aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, aircraft.ROT);
|
aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, aircraft.ROT);
|
||||||
var speed = .2f * aircraft.MovementSpeedForCell(self, self.Location);
|
var speed = .2f * aircraft.MovementSpeed;
|
||||||
var angle = aircraft.Facing / 128f * Math.PI;
|
var angle = aircraft.Facing / 128f * Math.PI;
|
||||||
|
|
||||||
aircraft.center += speed * -float2.FromAngle((float)angle);
|
aircraft.center += speed * -float2.FromAngle((float)angle);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
var landPos = dest.CenterLocation;
|
var landPos = dest.CenterLocation;
|
||||||
var aircraft = self.Trait<Aircraft>();
|
var aircraft = self.Trait<Aircraft>();
|
||||||
|
|
||||||
var speed = .2f * aircraft.MovementSpeedForCell(self, self.Location);
|
var speed = .2f * aircraft.MovementSpeed;
|
||||||
|
|
||||||
var approachStart = landPos - new float2(aircraft.Altitude * speed, 0);
|
var approachStart = landPos - new float2(aircraft.Altitude * speed, 0);
|
||||||
var turnRadius = (128f / self.Info.Traits.Get<AircraftInfo>().ROT) * speed / (float)Math.PI;
|
var turnRadius = (128f / self.Info.Traits.Get<AircraftInfo>().ROT) * speed / (float)Math.PI;
|
||||||
|
|||||||
@@ -81,13 +81,16 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public bool CanEnterCell(int2 location) { return true; }
|
public bool CanEnterCell(int2 location) { return true; }
|
||||||
|
|
||||||
public float MovementSpeedForCell(Actor self, int2 cell)
|
public float MovementSpeed
|
||||||
{
|
{
|
||||||
var modifier = self
|
get
|
||||||
.TraitsImplementing<ISpeedModifier>()
|
{
|
||||||
.Select(t => t.GetSpeedModifier())
|
var modifier = self
|
||||||
.Product();
|
.TraitsImplementing<ISpeedModifier>()
|
||||||
return Info.Speed * modifier;
|
.Select( t => t.GetSpeedModifier() )
|
||||||
|
.Product();
|
||||||
|
return Info.Speed * modifier;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int2[] noCells = new int2[] { };
|
int2[] noCells = new int2[] { };
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ namespace OpenRA.Mods.RA
|
|||||||
if (aircraft.Altitude <= 0)
|
if (aircraft.Altitude <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var rawSpeed = .2f * aircraft.MovementSpeedForCell(self, self.Location);
|
var rawSpeed = .2f * aircraft.MovementSpeed;
|
||||||
var otherHelis = self.World.FindUnitsInCircle(self.CenterLocation, Info.IdealSeparation)
|
var otherHelis = self.World.FindUnitsInCircle(self.CenterLocation, Info.IdealSeparation)
|
||||||
.Where(a => a.HasTrait<Helicopter>());
|
.Where(a => a.HasTrait<Helicopter>());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user