Restore key:value syntax for MapFolders.
This commit is contained in:
@@ -70,7 +70,7 @@ namespace OpenRA
|
|||||||
Mod.Id = modId;
|
Mod.Id = modId;
|
||||||
|
|
||||||
// TODO: Use fieldloader
|
// TODO: Use fieldloader
|
||||||
MapFolders = YamlDictionary(yaml, "MapFolders", true);
|
MapFolders = YamlDictionary(yaml, "MapFolders");
|
||||||
|
|
||||||
MiniYaml packages;
|
MiniYaml packages;
|
||||||
if (yaml.TryGetValue("Packages", out packages))
|
if (yaml.TryGetValue("Packages", out packages))
|
||||||
@@ -160,29 +160,12 @@ namespace OpenRA
|
|||||||
return yaml[key].ToDictionary().Keys.ToArray();
|
return yaml[key].ToDictionary().Keys.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
static IReadOnlyDictionary<string, string> YamlDictionary(Dictionary<string, MiniYaml> yaml, string key, bool parsePaths = false)
|
static IReadOnlyDictionary<string, string> YamlDictionary(Dictionary<string, MiniYaml> yaml, string key)
|
||||||
{
|
{
|
||||||
if (!yaml.ContainsKey(key))
|
if (!yaml.ContainsKey(key))
|
||||||
return new ReadOnlyDictionary<string, string>();
|
return new ReadOnlyDictionary<string, string>();
|
||||||
|
|
||||||
var inner = new Dictionary<string, string>();
|
var inner = yaml[key].ToDictionary(my => my.Value);
|
||||||
foreach (var node in yaml[key].Nodes)
|
|
||||||
{
|
|
||||||
var line = node.Key;
|
|
||||||
if (node.Value.Value != null)
|
|
||||||
line += ":" + node.Value.Value;
|
|
||||||
|
|
||||||
// '@' may be used in mod.yaml to indicate extra information (similar to trait @ tags).
|
|
||||||
// Applies to MapFolders (to indicate System and User directories) and Packages (to indicate package annotation).
|
|
||||||
if (line.Contains('@'))
|
|
||||||
{
|
|
||||||
var split = line.Split('@');
|
|
||||||
inner.Add(parsePaths ? Platform.ResolvePath(split[0]) : split[0], split[1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
inner.Add(line, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ReadOnlyDictionary<string, string>(inner);
|
return new ReadOnlyDictionary<string, string>(inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ Packages:
|
|||||||
cnc|uibits
|
cnc|uibits
|
||||||
|
|
||||||
MapFolders:
|
MapFolders:
|
||||||
./mods/cnc/maps@System
|
cnc|maps: System
|
||||||
~^maps/cnc/{DEV_VERSION}@User
|
~^maps/cnc/{DEV_VERSION}: User
|
||||||
|
|
||||||
Rules:
|
Rules:
|
||||||
cnc|rules/misc.yaml
|
cnc|rules/misc.yaml
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ Packages:
|
|||||||
d2k|uibits
|
d2k|uibits
|
||||||
|
|
||||||
MapFolders:
|
MapFolders:
|
||||||
./mods/d2k/maps@System
|
d2k|maps: System
|
||||||
~^maps/d2k/{DEV_VERSION}@User
|
~^maps/d2k/{DEV_VERSION}: User
|
||||||
|
|
||||||
Rules:
|
Rules:
|
||||||
d2k|rules/misc.yaml
|
d2k|rules/misc.yaml
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ Packages:
|
|||||||
ra|uibits
|
ra|uibits
|
||||||
|
|
||||||
MapFolders:
|
MapFolders:
|
||||||
./mods/ra/maps@System
|
ra|maps: System
|
||||||
~^maps/ra/{DEV_VERSION}@User
|
~^maps/ra/{DEV_VERSION}: User
|
||||||
|
|
||||||
Rules:
|
Rules:
|
||||||
ra|rules/misc.yaml
|
ra|rules/misc.yaml
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ Packages:
|
|||||||
ts|uibits
|
ts|uibits
|
||||||
|
|
||||||
MapFolders:
|
MapFolders:
|
||||||
./mods/ts/maps@System
|
ts|maps: System
|
||||||
~^maps/ts/{DEV_VERSION}@User
|
~^maps/ts/{DEV_VERSION}: User
|
||||||
|
|
||||||
Rules:
|
Rules:
|
||||||
ts|rules/ai.yaml
|
ts|rules/ai.yaml
|
||||||
|
|||||||
Reference in New Issue
Block a user