RimWorld

RimWorld

ReGrowth: Wastelands
thailyn Sep 8, 2023 @ 4:00pm
Startup error with Geological Landforms mod
Hi. When this mod is used with the Geological Landforms mod, I get a couple errors in the log, like the following:

[Geological Landforms v1.6.5] Failed to check if RG_AridWasteland is a special-purpose biome (Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39) AmbiguousMatchException: Ambiguous match found. at System.RuntimeType.GetMethodImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConv, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) [0x00059] in <eae584ce26bc40229c1b1aa476bfa589>:0 at (wrapper dynamic-method) System.Type.System.Type.GetMethod_Patch2(System.Type,string,System.Reflection.BindingFlags) at HarmonyLib.AccessTools+<>c__DisplayClass27_0.<Method>b__0 (System.Type t) [0x00000] in <255414689d344b1385ae719f6cce8c55>:0 at HarmonyLib.AccessTools.FindIncludingBaseTypes[T] (System.Type type, System.Func`2[T,TResult] func) [0x00000] in <255414689d344b1385ae719f6cce8c55>:0 at HarmonyLib.AccessTools.Method (System.Type type, System.String name, System.Type[] parameters, System.Type[] generics) [0x0004b] in <255414689d344b1385ae719f6cce8c55>:0 Rethrow as AmbiguousMatchException: Ambiguous match in Harmony patch for RGW_Wasteland.RGW_Wasteland_BiomeWorker_Desert:GetScore at HarmonyLib.AccessTools.Method (System.Type type, System.String name, System.Type[] parameters, System.Type[] generics) [0x0008e] in <255414689d344b1385ae719f6cce8c55>:0 at GeologicalLandforms.BiomeProperties.IsSpecialPurposeBiome (RimWorld.BiomeDef biome) [0x00065] in <743b2d58c7c844e79e535efcb24ffa24>:0 UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) LunarFramework.Logging.IngameLogContext:Log(LogLevel, String, Exception) LunarFramework.Logging.LogContext:Warn(String, Exception) GeologicalLandforms.BiomeProperties:IsSpecialPurposeBiome(BiomeDef) GeologicalLandforms.BiomeProperties:RebuildCache() GeologicalLandforms.GeologicalLandformsAPI:Init() LunarFramework.Bootstrap.Entrypoint:InitComponent(LunarComponent) LunarFramework.Bootstrap.Entrypoint:OnPlayDataLoadFinished() LunarFramework.Internal.Patches.Patch_Verse_StaticConstructorOnStartupUtility:LateInit() Verse.StaticConstructorOnStartupUtility:Verse.StaticConstructorOnStartupUtility.CallAll_Patch5() Verse.<>c:<DoPlayLoad>b__4_5() Verse.LongEventHandler:Verse.LongEventHandler.ExecuteToExecuteWhenFinished_Patch0() Verse.LongEventHandler:UpdateCurrentAsynchronousEvent() Verse.LongEventHandler:LongEventsUpdate(Boolean&) Verse.Root:Verse.Root.Update_Patch1(Root) Verse.Root_Entry:Verse.Root_Entry.Update_Patch0(Root_Entry)

I'm pretty sure this is because the GetScore method in the RGW_Wasteland_BiomeWorker class is *not* marked as override. When I decompile the assembly, dotPeek is telling me that the GetScore method in, for example, the RGW_Wasteland_BiomeWorker_Desert class is overriding the version in BiomeWorker, not RGW_Wasteland_BiomeWorker.

As a result, RGW_Wasteland_BiomeWorker_Desert is also inheriting the GetScore method from RGW_Wasteland_BiomeWorker, leading to Geological Landforms finding two copies of the GetScore method for each of the biomes (arid, temperate, and frigid wastelands), and causing the exception.