Added Cancel() to Mobile.CurrentAction. Added QueueAction to Mobile. Made Order.Apply use queue rather than SetNextAction.

This commit is contained in:
Bob
2009-10-24 19:17:13 +13:00
parent d66475edcb
commit d25bd8550a
4 changed files with 156 additions and 118 deletions

View File

@@ -35,7 +35,9 @@ namespace OpenRa.Game.Traits
public override void Apply( bool leftMouseButton )
{
if( leftMouseButton ) return;
Unit.traits.Get<Mobile>().SetNextAction( new Mobile.Turn( 96 ) { NextAction = new DeployAction() } );
var mobile = Unit.traits.Get<Mobile>();
mobile.QueueAction( new Mobile.Turn( 96 ) );
mobile.QueueAction( new DeployAction() );
}
class DeployAction : Mobile.CurrentAction
@@ -50,6 +52,12 @@ namespace OpenRa.Game.Traits
Game.world.Add( new Actor( "fact", self.Location - new int2( 1, 1 ), self.Owner ) );
} );
}
public void Cancel( Actor self, Mobile mobile )
{
// Cancel can't happen between this being moved to the head of the list, and it being Ticked.
throw new InvalidOperationException( "DeployMcvAction: Cancel() should never occur." );
}
}
}
}