Generalize factionVariant to a TypeDictionary of Inits.

This commit is contained in:
Paul Chote
2017-08-18 17:39:20 +00:00
committed by Pavel Penev
parent 315cc966f4
commit cfac996438
10 changed files with 77 additions and 45 deletions

View File

@@ -51,6 +51,12 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Text shown in the production tooltip.")]
[Translate] public readonly string Description = "";
public static string GetInitialFaction(ActorInfo ai, string defaultFaction)
{
var bi = ai.TraitInfoOrDefault<BuildableInfo>();
return bi != null ? bi.ForceFaction ?? defaultFaction : defaultFaction;
}
}
public class Buildable { }