diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index ec70620d16..d1f3be011b 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -198,7 +198,7 @@ namespace OpenRa.Game var unit = new Actor(name, (1/24f * producer.CenterLocation).ToInt2(), player); var mobile = unit.traits.Get(); mobile.facing = 128; - mobile.QueueAction( new Traits.Mobile.MoveTo( unit.Location + new int2( 0, 3 ) ) ); + mobile.QueueActivity( new Traits.Mobile.MoveTo( unit.Location + new int2( 0, 3 ) ) ); world.AddFrameEndTask(_ => world.Add(unit)); diff --git a/OpenRa.Game/MoveOrder.cs b/OpenRa.Game/MoveOrder.cs index b1f392412b..9931d94d22 100644 --- a/OpenRa.Game/MoveOrder.cs +++ b/OpenRa.Game/MoveOrder.cs @@ -32,7 +32,7 @@ namespace OpenRa.Game Game.PlaySound(Game.SovietVoices.First.GetNext() + GetVoiceSuffix(), false); var mobile = Unit.traits.Get(); mobile.Cancel(Unit); - mobile.QueueAction( new Traits.Mobile.MoveTo( Destination ) ); + mobile.QueueActivity( new Traits.Mobile.MoveTo( Destination ) ); } } } diff --git a/OpenRa.Game/Traits/McvDeploy.cs b/OpenRa.Game/Traits/McvDeploy.cs index 2057e3cb5a..33ef8f3737 100644 --- a/OpenRa.Game/Traits/McvDeploy.cs +++ b/OpenRa.Game/Traits/McvDeploy.cs @@ -37,13 +37,13 @@ namespace OpenRa.Game.Traits public override void Apply() { var mobile = Unit.traits.Get(); - mobile.QueueAction( new Mobile.Turn( 96 ) ); - mobile.QueueAction( new DeployAction() ); + mobile.QueueActivity( new Mobile.Turn( 96 ) ); + mobile.QueueActivity( new DeployAction() ); } - class DeployAction : Mobile.CurrentAction + class DeployAction : Mobile.CurrentActivity { - public Mobile.CurrentAction NextAction { get; set; } + public Mobile.CurrentActivity NextActivity { get; set; } public void Tick( Actor self, Mobile mobile ) { diff --git a/OpenRa.Game/Traits/Mobile.cs b/OpenRa.Game/Traits/Mobile.cs index 60944c455c..3d614711fd 100644 --- a/OpenRa.Game/Traits/Mobile.cs +++ b/OpenRa.Game/Traits/Mobile.cs @@ -16,7 +16,7 @@ namespace OpenRa.Game.Traits public int facing; public int Voice = Game.CosmeticRandom.Next(2); - CurrentAction currentAction; + CurrentActivity currentActivity; public Mobile(Actor self) { @@ -24,25 +24,25 @@ namespace OpenRa.Game.Traits fromCell = toCell; } - public void QueueAction( CurrentAction nextAction ) + public void QueueActivity( CurrentActivity nextActivity ) { - if( currentAction == null ) + if( currentActivity == null ) { - currentAction = nextAction; + currentActivity = nextActivity; return; } - var act = currentAction; - while( act.NextAction != null ) + var act = currentActivity; + while( act.NextActivity != null ) { - act = act.NextAction; + act = act.NextActivity; } - act.NextAction = nextAction; + act.NextActivity = nextActivity; } public void Tick(Actor self) { - if( currentAction != null ) - currentAction.Tick( self, this ); + if( currentActivity != null ) + currentActivity.Tick( self, this ); else fromCell = toCell; } @@ -59,8 +59,8 @@ namespace OpenRa.Game.Traits public void Cancel(Actor self) { - if (currentAction != null) - currentAction.Cancel(self, this); + if (currentActivity != null) + currentActivity.Cancel(self, this); } public IEnumerable OccupiedCells() @@ -70,23 +70,23 @@ namespace OpenRa.Game.Traits public UnitMovementType GetMovementType() { - /* todo: boats, planes */ + /* todo: boats */ var vi = self.unitInfo as UnitInfo.VehicleInfo; if (vi == null) return UnitMovementType.Foot; return vi.Tracked ? UnitMovementType.Track : UnitMovementType.Wheel; } - public interface CurrentAction + public interface CurrentActivity { - CurrentAction NextAction { get; set; } + CurrentActivity NextActivity { get; set; } void Tick( Actor self, Mobile mobile ); void Cancel( Actor self, Mobile mobile ); } - public class Turn : CurrentAction + public class Turn : CurrentActivity { - public CurrentAction NextAction { get; set; } + public CurrentActivity NextActivity { get; set; } public int desiredFacing; @@ -99,9 +99,9 @@ namespace OpenRa.Game.Traits { if( desiredFacing == mobile.facing ) { - mobile.currentAction = NextAction; - if( NextAction != null ) - NextAction.Tick( self, mobile ); + mobile.currentActivity = NextActivity; + if( NextActivity != null ) + NextActivity.Tick( self, mobile ); return; } Util.TickFacing( ref mobile.facing, desiredFacing, self.unitInfo.ROT ); @@ -110,13 +110,13 @@ namespace OpenRa.Game.Traits public void Cancel( Actor self, Mobile mobile ) { desiredFacing = mobile.facing; - NextAction = null; + NextActivity = null; } } - public class MoveTo : CurrentAction + public class MoveTo : CurrentActivity { - public CurrentAction NextAction { get; set; } + public CurrentActivity NextActivity { get; set; } int2 destination; List path; @@ -144,7 +144,7 @@ namespace OpenRa.Game.Traits if( destination == self.Location ) { - mobile.currentAction = NextAction; + mobile.currentActivity = NextActivity; return; } @@ -160,7 +160,7 @@ namespace OpenRa.Game.Traits int2 dir = nextCell - mobile.fromCell; var firstFacing = Util.GetFacing( dir, mobile.facing ); if( firstFacing != mobile.facing ) - mobile.currentAction = new Turn( firstFacing ) { NextAction = this }; + mobile.currentActivity = new Turn( firstFacing ) { NextActivity = this }; else { if (!CanEnterCell(nextCell, self)) return; /* todo: repath, sometimes */ @@ -177,7 +177,7 @@ namespace OpenRa.Game.Traits Game.UnitInfluence.Update(mobile); } - mobile.currentAction.Tick( self, mobile ); + mobile.currentActivity.Tick( self, mobile ); } static float2 CenterOfCell( int2 loc ) @@ -258,7 +258,7 @@ namespace OpenRa.Game.Traits var ret = new MoveFirstHalf( BetweenCells( mobile.fromCell, mobile.toCell ), BetweenCells( mobile.toCell, nextCell ), - mobile.facing, + mobile.facing, Util.GetNearestFacing( mobile.facing, Util.GetFacing( nextCell - mobile.toCell, mobile.facing ) ), moveFraction - moveFractionTotal ); mobile.fromCell = mobile.toCell; @@ -296,7 +296,7 @@ namespace OpenRa.Game.Traits public void Cancel( Actor self, Mobile mobile ) { path.Clear(); - NextAction = null; + NextActivity = null; } } }