Closed DoctorVanGogh closed 6 years ago
I like the idea. Maybe add a ThingFilter collection, I guess the most popular currently are AllowFresh and NoDeadMansApparell => + add options for activation
Problem: Some weird race condition(s) going on here.
Mod A
consists of assemblies A
& B
. B
is the designated embeddable assembly and defines (among other things) some type X
with a static constructor (which just uses plain old .NET classes & struct, no Unity assets).
Accessing X
from inside B
's mod initializer is okay. Accessing X
inside A
's mod initializer or inside Harmony patch leads to TypeLoadException
(No inner exception!!!) with text "Could not initialize type X from assembly A." (Note the wrong referenced assembly here). Try/catch block around access does not prevent the error 😕
Sometimes it works though.... and sometimes not....
Not something we can fix - wrong type resolution smells of Rimworld or even Unity or Mono issue.
Defer implementation until this bug is tracked down.
After almost blaming Harmony, Rimworld, Unity or finally Mono it turned out to be a 'simple' version numbering issue.
Now just have to decide on feature set for the embeddable assembly.
Honestly, I understand only half of it ;) Nice to see your solution working!
I've been thinking about third party mods that might want to add 'search'/'filtering' to their UI. Especially with ExtendedStorage & EnhancedCrafting - those two I know and use, but there must be a dozen extra mods out there that do similar (but ultimately their own) UI changes. In the end, looking at each and every one of them and special handling those is a loosing proposition.
What about splitting this mod into two parts:
The steam & github 'mod' releases would not change (except there's now two assemblies from us inside the 'Assemblies' folder).
I'm kinda liking this idea (though releasing parts as an official library means more work), since people can copy this code anyway, and I'd rather have things interacting nicely than a bunch of customized copy/paste nightmares (I might or might not be thinking of those 'homebrew' detours here)..