working on letting _any_ actor be a production-queue. (chrome still needs work)

This commit is contained in:
Bob
2009-12-15 22:59:48 +13:00
parent 47d5b8508c
commit e505726a8b
7 changed files with 86 additions and 73 deletions

View File

@@ -278,24 +278,5 @@ namespace OpenRa.Game
return Game.PathFinder.FindPath(search).Count != 0;
}
public static void BuildUnit(Player player, string name)
{
var newUnitType = Rules.UnitInfo[ name ];
var producerTypes = Rules.TechTree.UnitBuiltAt( newUnitType );
// TODO: choose producer based on "primary building"
var producer = world.Actors
.Where( x => producerTypes.Contains( x.Info ) && x.Owner == player )
.FirstOrDefault();
if (producer == null)
{
player.CancelProduction(Rules.UnitCategory[name]);
return;
}
if( producer.traits.WithInterface<IProducer>().Any( p => p.Produce( producer, newUnitType ) ) )
player.FinishProduction(Rules.UnitCategory[name]);
}
}
}