Add ActorInfo.TraitInfo[OrDefault]<T>() requiring ITraitIfo types
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user