move CYard trait and UndeployMCV activity into mod

This commit is contained in:
Bob
2010-07-08 15:34:21 +12:00
parent 1eedae2c7b
commit 7a738ed6af
9 changed files with 53 additions and 34 deletions

View File

@@ -52,14 +52,20 @@ namespace OpenRA.Mods.RA.Orders
public void Tick( World world )
{
var hasFact = world.Queries.OwnedBy[world.LocalPlayer]
.WithTrait<ConstructionYard>()
.Any();
if (!hasFact)
if( PlayerIsAllowedToRepair( world ) )
Game.controller.CancelInputMode();
}
public static bool PlayerIsAllowedToRepair( World world )
{
if( !world.WorldActor.Info.Traits.Get<RepairButtonInfo>().RequiresConstructionYard )
return true;
return Game.world.Queries.OwnedBy[ Game.world.LocalPlayer ]
.WithTrait<Production>().Where( x => x.Actor.Info.Traits.Get<ProductionInfo>().Produces.Contains( "Building" ) )
.Any();
}
public void Render( World world ) {}
public string GetCursor(World world, int2 xy, MouseInput mi)