Shift movement cost/speed into IMove; regressions in a few areas
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -66,7 +67,8 @@ namespace OpenRA.Mods.RA.Activities
|
||||
public static void Fly(Actor self, int desiredAltitude )
|
||||
{
|
||||
var unit = self.traits.Get<Unit>();
|
||||
var speed = .2f * Util.GetEffectiveSpeed(self, UnitMovementType.Fly);
|
||||
var mobile = self.traits.WithInterface<IMove>().FirstOrDefault();
|
||||
var speed = .2f * mobile.MovementSpeedForCell(self, self.Location);
|
||||
var angle = unit.Facing / 128f * Math.PI;
|
||||
var aircraft = self.traits.Get<Aircraft>();
|
||||
|
||||
|
||||
@@ -59,8 +59,9 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var desiredFacing = Util.GetFacing(dist, unit.Facing);
|
||||
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.Traits.Get<UnitInfo>().ROT);
|
||||
|
||||
var rawSpeed = .2f * Util.GetEffectiveSpeed(self, UnitMovementType.Fly);
|
||||
|
||||
var mobile = self.traits.WithInterface<IMove>().FirstOrDefault();
|
||||
var rawSpeed = .2f * mobile.MovementSpeedForCell(self, self.Location);
|
||||
|
||||
if (!float2.WithinEpsilon(float2.Zero, dist, range * Game.CellSize))
|
||||
self.CenterLocation += (rawSpeed / dist.Length) * dist;
|
||||
|
||||
|
||||
@@ -63,7 +63,8 @@ namespace OpenRA.Mods.RA.Activities
|
||||
Util.TickFacing(ref unit.Facing, desiredFacing,
|
||||
self.Info.Traits.Get<UnitInfo>().ROT);
|
||||
|
||||
var rawSpeed = .2f * Util.GetEffectiveSpeed(self, UnitMovementType.Fly);
|
||||
var mobile = self.traits.WithInterface<IMove>().FirstOrDefault();
|
||||
var rawSpeed = .2f * mobile.MovementSpeedForCell(self, self.Location);
|
||||
self.CenterLocation += (rawSpeed / dist.Length) * dist;
|
||||
aircraft.Location = Util.CellContaining(self.CenterLocation);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -57,7 +58,8 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
var desiredFacing = Util.GetFacing(d, unit.Facing);
|
||||
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.Traits.Get<UnitInfo>().ROT);
|
||||
var speed = .2f * Util.GetEffectiveSpeed(self, UnitMovementType.Fly);
|
||||
var mobile = self.traits.WithInterface<IMove>().FirstOrDefault();
|
||||
var speed = .2f * mobile.MovementSpeedForCell(self, self.Location);
|
||||
var angle = unit.Facing / 128f * Math.PI;
|
||||
|
||||
self.CenterLocation += speed * -float2.FromAngle((float)angle);
|
||||
|
||||
@@ -53,7 +53,9 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
var landPos = dest.CenterLocation;
|
||||
var unit = self.traits.Get<Unit>();
|
||||
var speed = .2f * Util.GetEffectiveSpeed(self, UnitMovementType.Fly);
|
||||
var mobile = self.traits.WithInterface<IMove>().FirstOrDefault();
|
||||
var speed = .2f * mobile.MovementSpeedForCell(self, self.Location);
|
||||
|
||||
var approachStart = landPos - new float2(unit.Altitude * speed, 0);
|
||||
var turnRadius = (128f / self.Info.Traits.Get<UnitInfo>().ROT) * speed / (float)Math.PI;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user