diff --git a/OpenRA.Game/GameRules/Ruleset.cs b/OpenRA.Game/GameRules/Ruleset.cs index 84b6b720e3..19dbf28449 100644 --- a/OpenRA.Game/GameRules/Ruleset.cs +++ b/OpenRA.Game/GameRules/Ruleset.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Linq; using OpenRA.GameRules; using OpenRA.Graphics; +using OpenRA.Traits; namespace OpenRA { @@ -41,6 +42,10 @@ namespace OpenRA Music = new ReadOnlyDictionary(music); TileSets = new ReadOnlyDictionary(tileSets); Sequences = new ReadOnlyDictionary(sequences); + + foreach (var a in Actors.Values) + foreach (var t in a.TraitInfos()) + t.RulesetLoaded(this, a); } public IEnumerable> InstalledMusic { get { return Music.Where(m => m.Value.Exists); } } diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 5e0ffbdeb5..a66d204fbd 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -368,4 +368,6 @@ namespace OpenRA.Traits { bool RemoveActor(Actor self, Player owner); } + + public interface IRulesetLoaded : ITraitInfo { void RulesetLoaded(Ruleset rules, ActorInfo ai); } }