ScriptActorInterfaces, unbind on actor destroy.

This commit is contained in:
Vapre
2022-07-26 08:00:00 +02:00
committed by Matthias Mailänder
parent fc1d8d2355
commit 215898c7ec
5 changed files with 63 additions and 54 deletions

View File

@@ -126,20 +126,19 @@ namespace OpenRA.Scripting
{
// Only expose defined public non-static methods that were explicitly declared by the author
var flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly;
return t.GetMembers(flags).Where(mi =>
foreach (var mi in t.GetMembers(flags))
{
// Properties are always wrappable
if (mi is PropertyInfo)
return true;
yield return mi;
// Methods are allowed if they aren't generic, and aren't generated by the compiler
var method = mi as MethodInfo;
if (method != null && !method.IsGenericMethodDefinition && !method.IsSpecialName)
return true;
yield return mi;
// Fields aren't allowed
return false;
});
}
}
public static string[] RequiredTraitNames(Type t)