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

@@ -10,6 +10,7 @@
#endregion
using System.Linq;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
@@ -64,8 +65,19 @@ namespace OpenRA.Mods.Common.Traits
var activated = false;
if (sp != null)
{
foreach (var name in info.Actors)
activated |= sp.Produce(self, self.World.Map.Rules.Actors[name], faction);
{
var ai = self.World.Map.Rules.Actors[name];
var inits = new TypeDictionary
{
new OwnerInit(self.Owner),
new FactionInit(BuildableInfo.GetInitialFaction(ai, faction))
};
activated |= sp.Produce(self, ai, inits);
}
}
if (activated)
Game.Sound.PlayNotification(self.World.Map.Rules, manager.Self.Owner, "Speech", info.ReadyAudio, self.Owner.Faction.InternalName);