Move IsMovingVertically to IMove
- avoids an Aircraft trait look-up in #11886 - potentially useful for future additional locomotors (jumpjet), custom locomotors in external mods, possibly future updates to default ground locomotor (Mobile) with regard to behavior on slopes
This commit is contained in:
@@ -308,6 +308,7 @@ namespace OpenRA.Traits
|
|||||||
Activity VisualMove(Actor self, WPos fromPos, WPos toPos);
|
Activity VisualMove(Actor self, WPos fromPos, WPos toPos);
|
||||||
CPos NearestMoveableCell(CPos target);
|
CPos NearestMoveableCell(CPos target);
|
||||||
bool IsMoving { get; set; }
|
bool IsMoving { get; set; }
|
||||||
|
bool IsMovingVertically { get; set; }
|
||||||
bool CanEnterTargetNow(Actor self, Target target);
|
bool CanEnterTargetNow(Actor self, Target target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,13 +115,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public int TurnSpeed { get { return Info.TurnSpeed; } }
|
public int TurnSpeed { get { return Info.TurnSpeed; } }
|
||||||
public Actor ReservedActor { get; private set; }
|
public Actor ReservedActor { get; private set; }
|
||||||
public bool MayYieldReservation { get; private set; }
|
public bool MayYieldReservation { get; private set; }
|
||||||
public bool IsMovingVertically { get; private set; }
|
|
||||||
|
|
||||||
bool airborne;
|
bool airborne;
|
||||||
bool cruising;
|
bool cruising;
|
||||||
bool firstTick = true;
|
bool firstTick = true;
|
||||||
|
|
||||||
bool isMoving;
|
bool isMoving;
|
||||||
|
bool isMovingVertically;
|
||||||
WPos cachedPosition;
|
WPos cachedPosition;
|
||||||
|
|
||||||
public Aircraft(ActorInitializer init, AircraftInfo info)
|
public Aircraft(ActorInitializer init, AircraftInfo info)
|
||||||
@@ -182,7 +182,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var oldCachedPosition = cachedPosition;
|
var oldCachedPosition = cachedPosition;
|
||||||
cachedPosition = self.CenterPosition;
|
cachedPosition = self.CenterPosition;
|
||||||
isMoving = (oldCachedPosition - cachedPosition).HorizontalLengthSquared != 0;
|
isMoving = (oldCachedPosition - cachedPosition).HorizontalLengthSquared != 0;
|
||||||
IsMovingVertically = (oldCachedPosition - cachedPosition).VerticalLengthSquared != 0;
|
isMovingVertically = (oldCachedPosition - cachedPosition).VerticalLengthSquared != 0;
|
||||||
|
|
||||||
Repulse();
|
Repulse();
|
||||||
}
|
}
|
||||||
@@ -495,6 +495,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public bool IsMoving { get { return isMoving; } set { } }
|
public bool IsMoving { get { return isMoving; } set { } }
|
||||||
|
|
||||||
|
public bool IsMovingVertically { get { return isMovingVertically; } set { } }
|
||||||
|
|
||||||
public bool CanEnterTargetNow(Actor self, Target target)
|
public bool CanEnterTargetNow(Actor self, Target target)
|
||||||
{
|
{
|
||||||
if (target.Positions.Any(p => self.World.ActorMap.GetActorsAt(self.World.Map.CellContaining(p)).Any(a => a != self && a != target.Actor)))
|
if (target.Positions.Any(p => self.World.ActorMap.GetActorsAt(self.World.Map.CellContaining(p)).Any(a => a != self && a != target.Actor)))
|
||||||
|
|||||||
@@ -327,6 +327,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
readonly Lazy<IEnumerable<int>> speedModifiers;
|
readonly Lazy<IEnumerable<int>> speedModifiers;
|
||||||
public bool IsMoving { get; set; }
|
public bool IsMoving { get; set; }
|
||||||
|
public bool IsMovingVertically { get { return false; } set { } }
|
||||||
|
|
||||||
int facing;
|
int facing;
|
||||||
CPos fromCell, toCell;
|
CPos fromCell, toCell;
|
||||||
|
|||||||
Reference in New Issue
Block a user