diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index 6e9fd393a2..d0d9755fe1 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -299,7 +299,7 @@ namespace OpenRa.Game unit = new Actor(name, (1 / 24f * producer.CenterLocation).ToInt2(), player); var mobile = unit.traits.Get(); mobile.facing = 128; - mobile.QueueActivity(new Mobile.MoveTo(unit.Location + new int2(0, 3))); + mobile.QueueActivity(new Traits.Activities.Move(unit.Location + new int2(0, 3))); } world.Add( unit ); diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 981ec18d40..2575a4c6a0 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -77,6 +77,7 @@ + @@ -128,6 +129,8 @@ + + diff --git a/OpenRa.Game/Sidebar.cs b/OpenRa.Game/Sidebar.cs index eb76f1c5bf..2ff6fcc6c7 100644 --- a/OpenRa.Game/Sidebar.cs +++ b/OpenRa.Game/Sidebar.cs @@ -197,11 +197,6 @@ namespace OpenRa.Game return null; } - static bool IsAutoCompleting(string group) - { - return group != "Building"; - } - SidebarItem mouseOverItem; void MouseHandler(MouseInput mi) diff --git a/OpenRa.Game/Traits/Activities/Activity.cs b/OpenRa.Game/Traits/Activities/Activity.cs new file mode 100755 index 0000000000..34697cdde6 --- /dev/null +++ b/OpenRa.Game/Traits/Activities/Activity.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace OpenRa.Game.Traits.Activities +{ + interface Activity + { + Activity NextActivity { get; set; } + void Tick( Actor self, Mobile mobile ); + void Cancel( Actor self, Mobile mobile ); + } +} diff --git a/OpenRa.Game/Traits/Activities/DeployMcv.cs b/OpenRa.Game/Traits/Activities/DeployMcv.cs index 241e9fdc16..17f7a10b13 100755 --- a/OpenRa.Game/Traits/Activities/DeployMcv.cs +++ b/OpenRa.Game/Traits/Activities/DeployMcv.cs @@ -5,9 +5,9 @@ using System.Text; namespace OpenRa.Game.Traits.Activities { - class DeployMcv : Mobile.CurrentActivity + class DeployMcv : Activity { - public Mobile.CurrentActivity NextActivity { get; set; } + public Activity NextActivity { get; set; } public void Tick( Actor self, Mobile mobile ) { diff --git a/OpenRa.Game/Traits/Activities/Move.cs b/OpenRa.Game/Traits/Activities/Move.cs new file mode 100755 index 0000000000..89fd565f2a --- /dev/null +++ b/OpenRa.Game/Traits/Activities/Move.cs @@ -0,0 +1,245 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using OpenRa.Game.GameRules; + +namespace OpenRa.Game.Traits.Activities +{ + class Move : Activity + { + public Activity NextActivity { get; set; } + + int2? destination; + public List path; + Func> getPath; + + MovePart move; + + public Move( int2 destination ) + { + this.getPath = ( self, mobile ) => Game.PathFinder.FindUnitPath( + self.Location, destination, + mobile.GetMovementType() ); + this.destination = destination; + } + + public Move( Actor target, int range ) + { + this.getPath = ( self, mobile ) => Game.PathFinder.FindUnitPathToRange( + self.Location, target.Location, + mobile.GetMovementType(), range ); + this.destination = null; + } + + static bool CanEnterCell( int2 c, Actor self ) + { + var u = Game.UnitInfluence.GetUnitAt( c ); + var b = Game.BuildingInfluence.GetBuildingAt( c ); + return ( u == null || u == self ) && b == null; + } + + public void Tick( Actor self, Mobile mobile ) + { + if( move != null ) + { + move.TickMove( self, mobile, this ); + return; + } + + if( destination == self.Location ) + { + mobile.InternalSetActivity( NextActivity ); + return; + } + + if( path == null ) path = getPath( self, mobile ).TakeWhile( a => a != self.Location ).ToList(); + + if( path.Count == 0 ) + { + destination = mobile.toCell; + return; + } + + destination = path[ 0 ]; + + var nextCell = PopPath( self, mobile ); + if( nextCell == null ) + return; + + int2 dir = nextCell.Value - mobile.fromCell; + var firstFacing = Util.GetFacing( dir, mobile.facing ); + if( firstFacing != mobile.facing ) + { + var t = new Turn( firstFacing ) { NextActivity = this }; + mobile.InternalSetActivity( t ); + path.Add( nextCell.Value ); + + t.Tick( self, mobile ); + } + else + { + mobile.toCell = nextCell.Value; + move = new MoveFirstHalf( + CenterOfCell( mobile.fromCell ), + BetweenCells( mobile.fromCell, mobile.toCell ), + mobile.facing, + mobile.facing, + 0 ); + + Game.UnitInfluence.Update( mobile ); + + move.TickMove( self, mobile, this ); + } + } + + int2? PopPath( Actor self, Mobile mobile ) + { + if( path.Count == 0 ) return null; + var nextCell = path[ path.Count - 1 ]; + if( !CanEnterCell( nextCell, self ) ) + { + if( ( mobile.toCell - destination.Value ).LengthSquared <= 8 ) + { + path.Clear(); + return null; + } + + Game.UnitInfluence.Remove( mobile ); + var newPath = Game.PathFinder.FindPathToPath( self.Location, path, mobile.GetMovementType() ) + .TakeWhile( a => a != self.Location ) + .ToList(); + Game.UnitInfluence.Add( mobile ); + if( newPath.Count == 0 ) + return null; + + while( path[ path.Count - 1 ] != newPath[ 0 ] ) + path.RemoveAt( path.Count - 1 ); + for( int i = 1 ; i < newPath.Count ; i++ ) + path.Add( newPath[ i ] ); + + if( path.Count == 0 ) + return null; + nextCell = path[ path.Count - 1 ]; + } + path.RemoveAt( path.Count - 1 ); + return nextCell; + } + + static float2 CenterOfCell( int2 loc ) + { + return new float2( 12, 12 ) + Game.CellSize * (float2)loc; + } + + static float2 BetweenCells( int2 from, int2 to ) + { + return 0.5f * ( CenterOfCell( from ) + CenterOfCell( to ) ); + } + + abstract class MovePart + { + public readonly float2 from, to; + public readonly int fromFacing, toFacing; + public int moveFraction; + public readonly int moveFractionTotal; + + public MovePart( float2 from, float2 to, int fromFacing, int toFacing, int startingFraction ) + { + this.from = from; + this.to = to; + this.fromFacing = fromFacing; + this.toFacing = toFacing; + this.moveFraction = startingFraction; + this.moveFractionTotal = (int)( to - from ).Length * ( 25 / 6 ); + } + + public void TickMove( Actor self, Mobile mobile, Move parent ) + { + var oldFraction = moveFraction; + var oldTotal = moveFractionTotal; + + moveFraction += ( self.unitInfo as UnitInfo.MobileInfo ).Speed; + UpdateCenterLocation( self, mobile ); + if( moveFraction >= moveFractionTotal ) + { + parent.move = OnComplete( self, mobile, parent ); + if( parent.move == null ) + UpdateCenterLocation( self, mobile ); + } + } + + void UpdateCenterLocation( Actor self, Mobile mobile ) + { + var frac = (float)moveFraction / moveFractionTotal; + + self.CenterLocation = float2.Lerp( from, to, frac ); + if( moveFraction >= moveFractionTotal ) + mobile.facing = toFacing & 0xFF; + else + mobile.facing = ( fromFacing + ( toFacing - fromFacing ) * moveFraction / moveFractionTotal ) & 0xFF; + } + + protected abstract MovePart OnComplete( Actor self, Mobile mobile, Move parent ); + } + + class MoveFirstHalf : MovePart + { + public MoveFirstHalf( float2 from, float2 to, int fromFacing, int toFacing, int startingFraction ) + : base( from, to, fromFacing, toFacing, startingFraction ) + { + } + + protected override MovePart OnComplete( Actor self, Mobile mobile, Move parent ) + { + var nextCell = parent.PopPath( self, mobile ); + if( nextCell != null ) + { + if( ( nextCell - mobile.toCell ) != ( mobile.toCell - mobile.fromCell ) ) + { + var ret = new MoveFirstHalf( + BetweenCells( mobile.fromCell, mobile.toCell ), + BetweenCells( mobile.toCell, nextCell.Value ), + mobile.facing, + Util.GetNearestFacing( mobile.facing, Util.GetFacing( nextCell.Value - mobile.toCell, mobile.facing ) ), + moveFraction - moveFractionTotal ); + mobile.fromCell = mobile.toCell; + mobile.toCell = nextCell.Value; + Game.UnitInfluence.Update( mobile ); + return ret; + } + else + parent.path.Add( nextCell.Value ); + } + var ret2 = new MoveSecondHalf( + BetweenCells( mobile.fromCell, mobile.toCell ), + CenterOfCell( mobile.toCell ), + mobile.facing, + mobile.facing, + moveFraction - moveFractionTotal ); + mobile.fromCell = mobile.toCell; + Game.UnitInfluence.Update( mobile ); + return ret2; + } + } + + class MoveSecondHalf : MovePart + { + public MoveSecondHalf( float2 from, float2 to, int fromFacing, int toFacing, int startingFraction ) + : base( from, to, fromFacing, toFacing, startingFraction ) + { + } + + protected override MovePart OnComplete( Actor self, Mobile mobile, Move parent ) + { + self.CenterLocation = CenterOfCell( mobile.toCell ); + mobile.fromCell = mobile.toCell; + return null; + } + } + + public void Cancel( Actor self, Mobile mobile ) + { + path = new List(); + NextActivity = null; + } + } +} diff --git a/OpenRa.Game/Traits/Activities/Turn.cs b/OpenRa.Game/Traits/Activities/Turn.cs new file mode 100755 index 0000000000..e355b2174f --- /dev/null +++ b/OpenRa.Game/Traits/Activities/Turn.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace OpenRa.Game.Traits.Activities +{ + class Turn : Activity + { + public Activity NextActivity { get; set; } + + public int desiredFacing; + + public Turn( int desiredFacing ) + { + this.desiredFacing = desiredFacing; + } + + public void Tick( Actor self, Mobile mobile ) + { + if( desiredFacing == mobile.facing ) + { + mobile.InternalSetActivity( NextActivity ); + if( NextActivity != null ) + NextActivity.Tick( self, mobile ); + return; + } + Util.TickFacing( ref mobile.facing, desiredFacing, self.unitInfo.ROT ); + } + + public void Cancel( Actor self, Mobile mobile ) + { + desiredFacing = mobile.facing; + NextActivity = null; + } + } +} diff --git a/OpenRa.Game/Traits/Mobile.cs b/OpenRa.Game/Traits/Mobile.cs index dd72568cc5..8f8b08fce9 100644 --- a/OpenRa.Game/Traits/Mobile.cs +++ b/OpenRa.Game/Traits/Mobile.cs @@ -1,361 +1,96 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using OpenRa.Game.GameRules; -using OpenRa.Game.Graphics; - -namespace OpenRa.Game.Traits -{ - class Mobile : ITick, IOrder - { - public Actor self; - - public int2 fromCell; - public int2 toCell { get { return self.Location; } set { self.Location = value; } } - public int facing; - - public int Voice = Game.CosmeticRandom.Next(2); - CurrentActivity currentActivity; - - public Mobile(Actor self) - { - this.self = self; - fromCell = toCell; - Game.UnitInfluence.Update( this ); - } - - public void QueueActivity( CurrentActivity nextActivity ) - { - if( currentActivity == null ) - { - currentActivity = nextActivity; - return; - } - var act = currentActivity; - while( act.NextActivity != null ) - { - act = act.NextActivity; - } - act.NextActivity = nextActivity; - } - - public void Tick(Actor self) - { - if( currentActivity != null ) - currentActivity.Tick( self, this ); - else - fromCell = toCell; - } - - public Order Order(Actor self, int2 xy, bool lmb, Actor underCursor) - { - if( lmb ) return null; - - if( underCursor != null ) +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using OpenRa.Game.GameRules; +using OpenRa.Game.Graphics; +using OpenRa.Game.Traits.Activities; + +namespace OpenRa.Game.Traits +{ + class Mobile : ITick, IOrder + { + public Actor self; + + public int2 fromCell; + public int2 toCell { get { return self.Location; } set { self.Location = value; } } + public int facing; + + public int Voice = Game.CosmeticRandom.Next(2); + Activity currentActivity; + + public Mobile(Actor self) + { + this.self = self; + fromCell = toCell; + Game.UnitInfluence.Update( this ); + } + + public void QueueActivity( Activity nextActivity ) + { + if( currentActivity == null ) + { + currentActivity = nextActivity; + return; + } + var act = currentActivity; + while( act.NextActivity != null ) + { + act = act.NextActivity; + } + act.NextActivity = nextActivity; + } + + public void InternalSetActivity( Activity activity ) + { + currentActivity = activity; + } + + public void Tick(Actor self) + { + if( currentActivity != null ) + currentActivity.Tick( self, this ); + else + fromCell = toCell; + } + + public Order Order(Actor self, int2 xy, bool lmb, Actor underCursor) + { + if( lmb ) return null; + + if( underCursor != null ) return null; if (xy == toCell) return null; - - return OpenRa.Game.Order.Move( self, xy, - !Game.IsCellBuildable(xy, GetMovementType()) ); - } - - public void Cancel(Actor self) - { - if (currentActivity != null) - currentActivity.Cancel(self, this); - } - - public IEnumerable OccupiedCells() - { - return new[] { fromCell, toCell }; - } - - public UnitMovementType GetMovementType() - { + + return OpenRa.Game.Order.Move( self, xy, + !Game.IsCellBuildable(xy, GetMovementType()) ); + } + + public void Cancel(Actor self) + { + if (currentActivity != null) + currentActivity.Cancel(self, this); + } + + public IEnumerable OccupiedCells() + { + return new[] { fromCell, toCell }; + } + + public UnitMovementType GetMovementType() + { var vi = self.unitInfo as UnitInfo.VehicleInfo; - if (vi == null) return UnitMovementType.Foot; - if (vi.WaterBound) return UnitMovementType.Float; - return vi.Tracked ? UnitMovementType.Track : UnitMovementType.Wheel; - } - - public interface CurrentActivity - { - CurrentActivity NextActivity { get; set; } - void Tick( Actor self, Mobile mobile ); - void Cancel( Actor self, Mobile mobile ); - } - - public class Turn : CurrentActivity - { - public CurrentActivity NextActivity { get; set; } - - public int desiredFacing; - - public Turn( int desiredFacing ) - { - this.desiredFacing = desiredFacing; - } - - public void Tick( Actor self, Mobile mobile ) - { - if( desiredFacing == mobile.facing ) - { - mobile.currentActivity = NextActivity; - if( NextActivity != null ) - NextActivity.Tick( self, mobile ); - return; - } - Util.TickFacing( ref mobile.facing, desiredFacing, self.unitInfo.ROT ); - } - - public void Cancel( Actor self, Mobile mobile ) - { - desiredFacing = mobile.facing; - NextActivity = null; - } - } - - public class MoveTo : CurrentActivity - { - public CurrentActivity NextActivity { get; set; } - - int2? destination; - public List path; - Func> getPath; - - MovePart move; - - public MoveTo( int2 destination ) - { - this.getPath = (self, mobile) => Game.PathFinder.FindUnitPath( - self.Location, destination, - mobile.GetMovementType()); - this.destination = destination; - } - - public MoveTo(Actor target, int range) - { - this.getPath = (self, mobile) => Game.PathFinder.FindUnitPathToRange( - self.Location, target.Location, - mobile.GetMovementType(), range); - this.destination = null; - } - - static bool CanEnterCell(int2 c, Actor self) - { - var u = Game.UnitInfluence.GetUnitAt(c); - var b = Game.BuildingInfluence.GetBuildingAt(c); - return (u == null || u == self) && b == null; - } - - public void Tick( Actor self, Mobile mobile ) - { - if( move != null ) - { - move.TickMove( self, mobile, this ); - return; - } - - if( destination == self.Location ) - { - mobile.currentActivity = NextActivity; - return; - } - - if (path == null) path = getPath(self, mobile).TakeWhile(a => a != self.Location).ToList(); - - if (path.Count == 0) - { - destination = mobile.toCell; - return; - } - - destination = path[0]; - - var nextCell = PopPath( self, mobile ); - if( nextCell == null ) - return; - - int2 dir = nextCell.Value - mobile.fromCell; - var firstFacing = Util.GetFacing( dir, mobile.facing ); - if( firstFacing != mobile.facing ) - { - mobile.currentActivity = new Turn( firstFacing ) { NextActivity = this }; - path.Add( nextCell.Value ); - } - else - { - mobile.toCell = nextCell.Value; - move = new MoveFirstHalf( - CenterOfCell( mobile.fromCell ), - BetweenCells( mobile.fromCell, mobile.toCell ), - mobile.facing, - mobile.facing, - 0 ); - - Game.UnitInfluence.Update( mobile ); - } - mobile.currentActivity.Tick( self, mobile ); - } - - int2? PopPath( Actor self, Mobile mobile ) - { - if( path.Count == 0 ) return null; - var nextCell = path[ path.Count - 1 ]; - if( !CanEnterCell( nextCell, self ) ) - { - if( ( mobile.toCell - destination.Value ).LengthSquared <= 8 ) - { - path.Clear(); - return null; - } - - Game.UnitInfluence.Remove( mobile ); - var newPath = Game.PathFinder.FindPathToPath( self.Location, path, mobile.GetMovementType() ) - .TakeWhile( a => a != self.Location ) - .ToList(); - Game.UnitInfluence.Add( mobile ); - if( newPath.Count == 0 ) - return null; - - while( path[ path.Count - 1 ] != newPath[ 0 ] ) - path.RemoveAt( path.Count - 1 ); - for( int i = 1 ; i < newPath.Count ; i++ ) - path.Add( newPath[ i ] ); - - if( path.Count == 0 ) - return null; - nextCell = path[ path.Count - 1 ]; - } - path.RemoveAt( path.Count - 1 ); - return nextCell; - } - - static float2 CenterOfCell( int2 loc ) - { - return new float2( 12, 12 ) + Game.CellSize * (float2)loc; - } - - static float2 BetweenCells( int2 from, int2 to ) - { - return 0.5f * ( CenterOfCell( from ) + CenterOfCell( to ) ); - } - - abstract class MovePart - { - public readonly float2 from, to; - public readonly int fromFacing, toFacing; - public int moveFraction; - public readonly int moveFractionTotal; - - public MovePart( float2 from, float2 to, int fromFacing, int toFacing, int startingFraction ) - { - this.from = from; - this.to = to; - this.fromFacing = fromFacing; - this.toFacing = toFacing; - this.moveFraction = startingFraction; - this.moveFractionTotal = (int)( to - from ).Length * ( 25 / 6 ); - } - - public void TickMove( Actor self, Mobile mobile, MoveTo parent ) - { - var oldFraction = moveFraction; - var oldTotal = moveFractionTotal; - - moveFraction += ( self.unitInfo as UnitInfo.MobileInfo ).Speed; - UpdateCenterLocation( self, mobile ); - if( moveFraction >= moveFractionTotal ) - { - parent.move = OnComplete( self, mobile, parent ); - if( parent.move == null ) - UpdateCenterLocation( self, mobile ); - } - } - - void UpdateCenterLocation( Actor self, Mobile mobile ) - { - var frac = (float)moveFraction / moveFractionTotal; - - self.CenterLocation = float2.Lerp( from, to, frac ); - if( moveFraction >= moveFractionTotal ) - mobile.facing = toFacing & 0xFF; - else - mobile.facing = ( fromFacing + ( toFacing - fromFacing ) * moveFraction / moveFractionTotal ) & 0xFF; - } - - protected abstract MovePart OnComplete( Actor self, Mobile mobile, MoveTo parent ); - } - - class MoveFirstHalf : MovePart - { - public MoveFirstHalf( float2 from, float2 to, int fromFacing, int toFacing, int startingFraction ) - : base( from, to, fromFacing, toFacing, startingFraction ) - { - } - - protected override MovePart OnComplete( Actor self, Mobile mobile, MoveTo parent ) - { - var nextCell = parent.PopPath( self, mobile ); - if( nextCell != null ) - { - if( ( nextCell - mobile.toCell ) != ( mobile.toCell - mobile.fromCell ) ) - { - var ret = new MoveFirstHalf( - BetweenCells( mobile.fromCell, mobile.toCell ), - BetweenCells( mobile.toCell, nextCell.Value ), - mobile.facing, - Util.GetNearestFacing( mobile.facing, Util.GetFacing( nextCell.Value - mobile.toCell, mobile.facing ) ), - moveFraction - moveFractionTotal ); - mobile.fromCell = mobile.toCell; - mobile.toCell = nextCell.Value; - Game.UnitInfluence.Update( mobile ); - return ret; - } - else - parent.path.Add( nextCell.Value ); - } - var ret2 = new MoveSecondHalf( - BetweenCells( mobile.fromCell, mobile.toCell ), - CenterOfCell( mobile.toCell ), - mobile.facing, - mobile.facing, - moveFraction - moveFractionTotal ); - mobile.fromCell = mobile.toCell; - Game.UnitInfluence.Update( mobile ); - return ret2; - } - } - - class MoveSecondHalf : MovePart - { - public MoveSecondHalf( float2 from, float2 to, int fromFacing, int toFacing, int startingFraction ) - : base( from, to, fromFacing, toFacing, startingFraction ) - { - } - - protected override MovePart OnComplete( Actor self, Mobile mobile, MoveTo parent ) - { - self.CenterLocation = CenterOfCell( mobile.toCell ); - mobile.fromCell = mobile.toCell; - return null; - } - } - - public void Cancel( Actor self, Mobile mobile ) - { - path = new List(); - NextActivity = null; - } - } - - public IEnumerable GetCurrentPath() - { - var move = currentActivity as MoveTo; - if (move == null || move.path == null) return new int2[] { }; - return Enumerable.Reverse(move.path); - } - } -} + if (vi == null) return UnitMovementType.Foot; + if (vi.WaterBound) return UnitMovementType.Float; + return vi.Tracked ? UnitMovementType.Track : UnitMovementType.Wheel; + } + + public IEnumerable GetCurrentPath() + { + var move = currentActivity as Traits.Activities.Move; + if (move == null || move.path == null) return new int2[] { }; + return Enumerable.Reverse(move.path); + } + } +} diff --git a/OpenRa.Game/UnitOrders.cs b/OpenRa.Game/UnitOrders.cs index fab96e2bc7..7c77aa7fcf 100755 --- a/OpenRa.Game/UnitOrders.cs +++ b/OpenRa.Game/UnitOrders.cs @@ -1,9 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using OpenRa.Game.Traits; using OpenRa.Game.GameRules; +using OpenRa.Game.Traits; namespace OpenRa.Game { @@ -17,7 +16,7 @@ namespace OpenRa.Game { var mobile = order.Subject.traits.Get(); mobile.Cancel( order.Subject ); - mobile.QueueActivity( new Mobile.MoveTo( order.TargetLocation ) ); + mobile.QueueActivity( new Traits.Activities.Move( order.TargetLocation ) ); var attackBase = order.Subject.traits.WithInterface().FirstOrDefault(); if( attackBase != null ) @@ -37,7 +36,7 @@ namespace OpenRa.Game var range = Rules.WeaponInfo[ weapon ].Range; mobile.QueueActivity( - new Mobile.MoveTo( order.TargetActor, + new Traits.Activities.Move( order.TargetActor, Math.Max( 0, (int)range - RangeTolerance ) ) ); } @@ -50,7 +49,7 @@ namespace OpenRa.Game break; /* throw the order on the floor */ var mobile = order.Subject.traits.Get(); - mobile.QueueActivity( new Mobile.Turn( 96 ) ); + mobile.QueueActivity( new Traits.Activities.Turn( 96 ) ); mobile.QueueActivity( new Traits.Activities.DeployMcv() ); break; } @@ -58,8 +57,8 @@ namespace OpenRa.Game { var mobile = order.Subject.traits.Get(); mobile.Cancel(order.Subject); - mobile.QueueActivity(new Mobile.MoveTo(order.TargetActor.Location + new int2(1, 2))); - mobile.QueueActivity(new Mobile.Turn(64)); + mobile.QueueActivity( new Traits.Activities.Move( order.TargetActor.Location + new int2( 1, 2 ) ) ); + mobile.QueueActivity( new Traits.Activities.Turn( 64 ) ); /* todo: actual deliver activity! [animation + add cash] */ break;