Fix movement on ramps when moving to subcell
Fix movement on ramps when moving to subcell
This commit is contained in:
@@ -451,7 +451,13 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
if (progress >= Distance)
|
if (progress >= Distance)
|
||||||
{
|
{
|
||||||
mobile.SetCenterPosition(self, To);
|
var toPos = To;
|
||||||
|
|
||||||
|
// apply ramp offset to ground units
|
||||||
|
if (MovingOnGroundLayer)
|
||||||
|
toPos -= new WVec(WDist.Zero, WDist.Zero, self.World.Map.DistanceAboveTerrain(toPos));
|
||||||
|
mobile.SetCenterPosition(self, toPos);
|
||||||
|
|
||||||
mobile.Facing = TurnsWhileMoving
|
mobile.Facing = TurnsWhileMoving
|
||||||
? Util.TickFacing(mobile.Facing, ToFacing, mobile.TurnSpeed)
|
? Util.TickFacing(mobile.Facing, ToFacing, mobile.TurnSpeed)
|
||||||
: ToFacing;
|
: ToFacing;
|
||||||
|
|||||||
@@ -471,8 +471,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var position = cell.Layer == 0 ? self.World.Map.CenterOfCell(cell) :
|
var position = cell.Layer == 0 ? self.World.Map.CenterOfCell(cell) :
|
||||||
self.World.GetCustomMovementLayers()[cell.Layer].CenterOfCell(cell);
|
self.World.GetCustomMovementLayers()[cell.Layer].CenterOfCell(cell);
|
||||||
|
|
||||||
var subcellOffset = self.World.Map.Grid.OffsetOfSubCell(subCell);
|
position += self.World.Map.Grid.OffsetOfSubCell(subCell);
|
||||||
SetCenterPosition(self, position + subcellOffset);
|
position -= new WVec(0, 0, self.World.Map.DistanceAboveTerrain(position).Length);
|
||||||
|
|
||||||
|
SetCenterPosition(self, position);
|
||||||
FinishedMoving(self);
|
FinishedMoving(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user