Add ActorInfo.TraitInfo[OrDefault]<T>() requiring ITraitIfo types

This commit is contained in:
atlimit8
2015-08-03 16:07:33 -05:00
parent 6970959ef1
commit 09984683a7
115 changed files with 195 additions and 193 deletions

View File

@@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits
{
// Find a production structure to build this actor
var ai = self.World.Map.Rules.Actors[name];
var bi = ai.Traits.GetOrDefault<BuildableInfo>();
var bi = ai.TraitInfoOrDefault<BuildableInfo>();
// Some units may request a specific production type, which is ignored if the AllTech cheat is enabled
var type = bi == null || developerMode.AllTech ? Info.Type : bi.BuildAtProductionType ?? Info.Type;
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.Traits
public override int GetBuildTime(string unitString)
{
var ai = self.World.Map.Rules.Actors[unitString];
var bi = ai.Traits.GetOrDefault<BuildableInfo>();
var bi = ai.TraitInfoOrDefault<BuildableInfo>();
if (bi == null)
return 0;