Skip to content

Commit

Permalink
Support type auto-detection for CustomResources merges.
Browse files Browse the repository at this point in the history
  • Loading branch information
CptMoore committed Sep 2, 2022
1 parent 9528f87 commit 5d3aac4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For users:

For modders:
- Support for merging DLC content. Overall improved support for DLC content.
- Dropped support for BTRL removals and CustomResources merging.
- Dropped support for BTRL removals.
- StreamingAssets resources are now better supported, only need to use the correct filename to merge. No need to mirror the path in StreamingAssets or supply a type.
- Many more configuration options and all of them described in `ModTek/config.defaults.json` (once the game started at least once with ModTek enabled).
- Mods are loaded recursively from subdirectories by default, e.g. `Mods/MyWorkspace/MyMods/mod.json`.
Expand Down
10 changes: 3 additions & 7 deletions ModTek/Features/Manifest/BTRL/TypedManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace ModTek.Features.Manifest.BTRL
internal class TypedManifest
{
private readonly TypedDict manifest = new TypedDict();
private readonly Dictionary<string, HashSet<BattleTechResourceType>> idToTypes = new Dictionary<string, HashSet<BattleTechResourceType>>();
private readonly Dictionary<string, HashSet<string>> idToTypes = new Dictionary<string, HashSet<string>>();
private readonly BetterCPI packIndex;
private readonly Dictionary<string, VersionManifestAddendum> addendums = new Dictionary<string, VersionManifestAddendum>();

Expand Down Expand Up @@ -114,7 +114,7 @@ internal VersionManifestEntry[] EntriesByID(string id)
{
if (idToTypes.TryGetValue(id, out var set))
{
return set.Select(type => EntryByID(id, type, false)).ToArray();
return set.Select(type => EntryByIDAndType(id, type)).ToArray();
}
return emptyArray;
}
Expand All @@ -132,11 +132,7 @@ internal void SetEntry(VersionManifestEntry entry)
var dict = manifest.GetOrCreate(entry.Type);
dict[entry.Id] = entry;

if (BTConstants.BTResourceType(entry.Type, out var resourceType))
{
var types = idToTypes.GetOrCreate(entry.Id);
types.Add(resourceType);
}
idToTypes.GetOrCreate(entry.Id).Add(entry.Type);
}

internal void DumpToDisk()
Expand Down

0 comments on commit 5d3aac4

Please sign in to comment.