Added: LocalAssemblies / LocalRules to Manifest.cs (can be used to add a custom set of rules / assemblies to be loaded, other than the ones defined in the mod)
This commit is contained in:
@@ -21,7 +21,8 @@ namespace OpenRA.FileFormats
|
|||||||
Mods, Folders, Packages, Rules,
|
Mods, Folders, Packages, Rules,
|
||||||
Sequences, Cursors, Chrome, Assemblies, ChromeLayout,
|
Sequences, Cursors, Chrome, Assemblies, ChromeLayout,
|
||||||
Weapons, Voices, Music, Movies, TileSets;
|
Weapons, Voices, Music, Movies, TileSets;
|
||||||
|
public string[] LocalRules = new string[0];
|
||||||
|
public string[] LocalAssemblies = new string[0];
|
||||||
public readonly string ShellmapUid, LoadScreen;
|
public readonly string ShellmapUid, LoadScreen;
|
||||||
public readonly int TileSize = 24;
|
public readonly int TileSize = 24;
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ namespace OpenRA
|
|||||||
|
|
||||||
public static void LoadRules(Manifest m, Map map)
|
public static void LoadRules(Manifest m, Map map)
|
||||||
{
|
{
|
||||||
Info = LoadYamlRules(m.Rules, map.Rules, (k, y) => new ActorInfo(k.Key.ToLowerInvariant(), k.Value, y));
|
// Added support to extend the list of rules (add it to m.LocalRules)
|
||||||
|
// Should only be used to add ITraitNoSync traits! (otherwise BOOM)
|
||||||
|
Info = LoadYamlRules(m.Rules.Concat(m.LocalRules).ToArray(), map.Rules, (k, y) => new ActorInfo(k.Key.ToLowerInvariant(), k.Value, y));
|
||||||
Weapons = LoadYamlRules(m.Weapons, new List<MiniYamlNode>(), (k, _) => new WeaponInfo(k.Key.ToLowerInvariant(), k.Value));
|
Weapons = LoadYamlRules(m.Weapons, new List<MiniYamlNode>(), (k, _) => new WeaponInfo(k.Key.ToLowerInvariant(), k.Value));
|
||||||
Voices = LoadYamlRules(m.Voices, new List<MiniYamlNode>(), (k, _) => new VoiceInfo(k.Value));
|
Voices = LoadYamlRules(m.Voices, new List<MiniYamlNode>(), (k, _) => new VoiceInfo(k.Value));
|
||||||
Music = LoadYamlRules(m.Music, new List<MiniYamlNode>(), (k, _) => new MusicInfo(k.Key, k.Value));
|
Music = LoadYamlRules(m.Music, new List<MiniYamlNode>(), (k, _) => new MusicInfo(k.Key, k.Value));
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenRA
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// Namespaces from each mod assembly
|
// Namespaces from each mod assembly
|
||||||
foreach (var a in manifest.Assemblies)
|
foreach (var a in manifest.Assemblies.Concat(manifest.LocalAssemblies))
|
||||||
{
|
{
|
||||||
var asm = Assembly.LoadFile(Path.GetFullPath(a));
|
var asm = Assembly.LoadFile(Path.GetFullPath(a));
|
||||||
asms.AddRange(asm.GetNamespaces().Select(ns => Pair.New(asm, ns)));
|
asms.AddRange(asm.GetNamespaces().Select(ns => Pair.New(asm, ns)));
|
||||||
|
|||||||
Reference in New Issue
Block a user