Generalize factionVariant to a TypeDictionary of Inits.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
@@ -381,8 +382,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}
|
||||
|
||||
var inits = new TypeDictionary
|
||||
{
|
||||
new OwnerInit(self.Owner),
|
||||
new FactionInit(BuildableInfo.GetInitialFaction(unit, Faction))
|
||||
};
|
||||
|
||||
var sp = self.TraitsImplementing<Production>().FirstOrDefault(p => p.Info.Produces.Contains(Info.Type));
|
||||
if (sp != null && !self.IsDisabled() && sp.Produce(self, unit, Faction))
|
||||
if (sp != null && !self.IsDisabled() && sp.Produce(self, unit, inits))
|
||||
{
|
||||
FinishProduction();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user