juanosarg / VanillaPlantsExpanded-MorePlants

Vanilla Plants Expanded - More Plants mod for RimWorld
0 stars 0 forks source link

Invalid cast due to poor logic #1

Open ZzZombo opened 1 year ago

ZzZombo commented 1 year ago

https://github.com/juanosarg/VanillaPlantsExpanded-MorePlants/blob/a024b0dbad19ec9ee1eb8d0721c5368092856a13/1.3/Source/VanillaPlantsExpandedMorePlants/VanillaPlantsExpandedMorePlants/AI/Aquatic/WorkGiver_GrowerSowAquatic.cs#L47

If the growing zone is not an aquatic, then it is assumed to be a thing, lacking handling for the more likely case it's a different growing zone, such as the vanilla one.

Exception info ``` Root level exception in OnGUI(): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Specified cast is not valid. at VanillaPlantsExpandedMorePlants.WorkGiver_GrowerSowAquatic.ExtraRequirements (RimWorld.IPlantToGrowSettable settable, Verse.Pawn pawn) [0x0004a] in <8bf2e52d588c47c38ae1c79f2ae0e802>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in :0 --- End of inner exception stack trace --- at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in :0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0 at LocalGrowingFirst.WorkGiver_LocalZoneWrapper+d__19.MoveNext () [0x001e6] in :0 at System.Linq.Enumerable.Contains[TSource] (System.Collections.Generic.IEnumerable`1[T] source, TSource value, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x00036] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 at System.Linq.Enumerable.Contains[TSource] (System.Collections.Generic.IEnumerable`1[T] source, TSource value) [0x0000a] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 at (wrapper dynamic-method) RimWorld.FloatMenuMakerMap.RimWorld.FloatMenuMakerMap.AddJobGiverWorkOrders_Patch4(UnityEngine.Vector3,Verse.Pawn,System.Collections.Generic.List`1,bool) at (wrapper dynamic-method) RimWorld.FloatMenuMakerMap.RimWorld.FloatMenuMakerMap.AddUndraftedOrders_Patch1(UnityEngine.Vector3,Verse.Pawn,System.Collections.Generic.List`1) at (wrapper dynamic-method) RimWorld.FloatMenuMakerMap.RimWorld.FloatMenuMakerMap.ChoicesAtFor_Patch6(UnityEngine.Vector3,Verse.Pawn,bool) at RimWorld.FloatMenuMakerMap.TryMakeFloatMenu (Verse.Pawn pawn) [0x000a1] in <81af9f8a18324e17b286924a43555a7c>:0 at (wrapper dynamic-method) RimWorld.Selector.RimWorld.Selector.HandleMapClicks_Patch4(RimWorld.Selector) at RimWorld.Selector.SelectorOnGUI () [0x00000] in <81af9f8a18324e17b286924a43555a7c>:0 at RimWorld.MapInterface.HandleLowPriorityInput () [0x0000f] in <81af9f8a18324e17b286924a43555a7c>:0 at (wrapper dynamic-method) RimWorld.UIRoot_Play.RimWorld.UIRoot_Play.UIRootOnGUI_Patch3(RimWorld.UIRoot_Play) at (wrapper dynamic-method) Verse.Root.Verse.Root.OnGUI_Patch1(Verse.Root) UnityEngine.StackTraceUtility:ExtractStackTrace () (wrapper dynamic-method) Verse.Log:Verse.Log.Error_Patch4 (string) (wrapper dynamic-method) Verse.Root:Verse.Root.OnGUI_Patch1 (Verse.Root) ```
juanosarg commented 1 year ago

It's... literally a copy and paste of the code in WorkGiver_GrowerSow...

When does that error pop up?

ZzZombo commented 1 year ago

Oh, sorry then. It appears "Local Growing First" is to blame then. It happens if you try to bring the context menu on any (vanilla?) growing zone.