@@ -29,6 +29,7 @@ internal static class Sts2ModManagerCompat
2929 private static readonly Func < Mod , IReadOnlyList < LocString > > ReadErrors = CreateModErrorsAccessor ( ) ;
3030 private static readonly Func < Mod , string > ReadSource = CreateModSourceAccessor ( ) ;
3131 private static readonly Func < Mod , string ? > ReadPath = CreateModPathAccessor ( ) ;
32+ private static readonly Func < Mod , ulong ? > ReadWorkshopItemId = CreateModWorkshopItemIdAccessor ( ) ;
3233 private static readonly Func < Mod , int , string > ReadLoadState = CreateLoadStateAccessor ( ) ;
3334
3435 private static readonly Func < ModManifest , string ? > ReadManifestId =
@@ -304,11 +305,16 @@ .. EnumerateModsForManifestLookup()
304305 ArgumentNullException . ThrowIfNull ( mod ) ;
305306 try
306307 {
307- if ( SteamWorkshopInstallSource . TryGetWorkshopItemIdFromPath ( ReadPath ( mod ) , out var pathItemId ) )
308+ if ( ReadWorkshopItemId ( mod ) is { } workshopItemId && workshopItemId > 0 )
309+ return workshopItemId ;
310+
311+ if ( SteamWorkshopInstallSource . TryGetWorkshopItemIdFromPath ( ReadPath ( mod ) , out var pathItemId ) &&
312+ pathItemId > 0 )
308313 return pathItemId ;
309314
310315 foreach ( var assembly in ReadAssemblies ( mod ) )
311- if ( SteamWorkshopInstallSource . TryGetWorkshopItemIdFromAssembly ( assembly , out var assemblyItemId ) )
316+ if ( SteamWorkshopInstallSource . TryGetWorkshopItemIdFromAssembly ( assembly , out var assemblyItemId ) &&
317+ assemblyItemId > 0 )
312318 return assemblyItemId ;
313319 }
314320 catch ( Exception ex )
@@ -378,7 +384,8 @@ internal static bool TryGetBestModPresentationInfoForAssembly(Assembly assembly,
378384 assemblyName ? . Name ,
379385 assemblyName ? . Version ? . ToString ( ) ,
380386 errors ,
381- CommonIncompatibleModRegistry . IsMatch ( assemblies ) ) ;
387+ CommonIncompatibleModRegistry . IsMatch ( assemblies ) ,
388+ TryGetWorkshopItemId ( mod ) ) ;
382389 }
383390 catch ( Exception ex )
384391 {
@@ -639,6 +646,12 @@ private static Func<Mod, string> CreateModSourceAccessor()
639646 return mod => getter ? . Invoke ( mod ) as string ;
640647 }
641648
649+ private static Func < Mod , ulong ? > CreateModWorkshopItemIdAccessor ( )
650+ {
651+ var getter = CreateUntypedMemberGetter ( typeof ( Mod ) , "workshopId" ) ;
652+ return mod => getter ? . Invoke ( mod ) as ulong ? ;
653+ }
654+
642655 private static Func < Mod , int , string > CreateLoadStateAccessor ( )
643656 {
644657 if ( typeof ( Mod ) . GetField ( "state" , InstanceMemberFlags ) != null )
@@ -754,7 +767,8 @@ internal sealed record Sts2ModInventoryEntry(
754767 string ? AssemblyName ,
755768 string ? AssemblyVersion ,
756769 IReadOnlyList < LocString > Errors ,
757- bool IsCommonIncompatibleMod ) ;
770+ bool IsCommonIncompatibleMod ,
771+ ulong ? WorkshopItemId ) ;
758772
759773 internal sealed record Sts2LoadedModAssemblyEntry (
760774 string Id ,
0 commit comments