Fix IEffect members not being publicized

This commit is contained in:
Cj 2024-07-02 19:01:46 -04:00
parent bb3f1249a5
commit 8f1fdeadfd

View File

@ -25,10 +25,13 @@ internal static class SPTPublicizer
// nameof(CompilerGeneratedAttribute))) { return; }
if (!type.IsNested && !type.IsPublic || type.IsNested && !type.IsNestedPublic)
{
if (!type.Interfaces.Any(i => i.Interface.Name == "IEffect"))
{
type.Attributes &= ~TypeAttributes.VisibilityMask; // Remove all visibility mask attributes
type.Attributes |= type.IsNested ? TypeAttributes.NestedPublic : TypeAttributes.Public; // Apply a public visibility attribute
}
}
if (type.IsSealed)
{
@ -53,10 +56,6 @@ internal static class SPTPublicizer
// !type.Namespace.Contains("UI") || !string.IsNullOrWhiteSpace(type.Namespace)) // if
// (type.Namespace.Length > 0 && type.Namespace[0] > 'E') PublicizeField(field); }
var nestedTypesToPublicize = type.NestedTypes
.Where(t => !t.Interfaces.Any(i => i.Interface.Name == "IEffect"))
.ToList();
// Workaround to not publicize some nested types that cannot be patched easily and cause
// issues Specifically, we want to find any type that implements the "IHealthController"
// interface and make sure none of it's nested types that implement "IEffect" are changed
@ -68,7 +67,7 @@ internal static class SPTPublicizer
nestedTypesToPublicize = type.NestedTypes.Where(t => t.IsAbstract || t.Interfaces.All(i => i.Interface.Name != "IEffect")).ToArray();
}
*/
foreach (var nestedType in nestedTypesToPublicize)
foreach (var nestedType in type.NestedTypes)
{
PublicizeType(nestedType);
}