Add plumbing for notifying traits of movement
More precisely, about start and stop of movement.
This commit is contained in:
@@ -94,8 +94,6 @@ namespace OpenRA.Mods.Cnc.Activities
|
||||
// We are at the destination
|
||||
if (++ticks >= length)
|
||||
{
|
||||
mobile.IsMoving = false;
|
||||
|
||||
// Revoke the run condition
|
||||
attack.IsAiming = false;
|
||||
|
||||
@@ -113,8 +111,6 @@ namespace OpenRA.Mods.Cnc.Activities
|
||||
return this;
|
||||
}
|
||||
|
||||
mobile.IsMoving = true;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
||||
|
||||
public bool ShouldBeOpen()
|
||||
{
|
||||
if (move.IsMoving || self.World.Map.DistanceAboveTerrain(self.CenterPosition).Length > 0)
|
||||
if (move.CurrentMovementTypes.HasFlag(MovementType.Horizontal) || self.World.Map.DistanceAboveTerrain(self.CenterPosition).Length > 0)
|
||||
return false;
|
||||
|
||||
return cargo.CurrentAdjacentCells.Any(c => self.World.Map.Contains(c)
|
||||
|
||||
@@ -72,7 +72,8 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
||||
|
||||
void ITick.Tick(Actor self)
|
||||
{
|
||||
if (movement.IsMoving)
|
||||
if (movement.CurrentMovementTypes.HasFlag(MovementType.Horizontal)
|
||||
|| movement.CurrentMovementTypes.HasFlag(MovementType.Turn))
|
||||
tick++;
|
||||
|
||||
if (tick < info.TickRate)
|
||||
|
||||
@@ -201,9 +201,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
public CPos NearestMoveableCell(CPos cell) { return cell; }
|
||||
|
||||
// Actors with TDGunboat always move
|
||||
public bool IsMoving { get { return true; } set { } }
|
||||
|
||||
public bool IsMovingVertically { get { return false; } set { } }
|
||||
public MovementType CurrentMovementTypes { get { return MovementType.Horizontal; } set { } }
|
||||
|
||||
public bool CanEnterTargetNow(Actor self, Target target)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user