LecrisUT / Rimworld-SurvivalTools-old

Survival Tools mod for RimWorld
MIT License
0 stars 2 forks source link

Remote Tech and Preemptive Strike Incompatibility #36

Closed mk-over closed 4 years ago

mk-over commented 4 years ago

I'm getting four red errors about mining speed, yield and construction and plant speed. Example:

[Lecris.survivaltoolsreborn][ERR] Please report this back to us: AutoPatchInitialize : Found more than one stat with the same name
Type: RimWorld.StatDefOf | oldStat: PlantWorkSpeed | FieldInfo: RimWorld.StatDef PlantWorkSpeed
Type: Outfitted.StatDefOf | oldStat: PlantWorkSpeed | FieldInfo: RimWorld.StatDef PlantWorkSpeed

I suspect it's related to SF Materials Rebalanced, but I didn't confirm yet. There's also a few yellow errors such as:

[Lecris.survivaltoolsreborn][warn] Couldn't backtrack jobDriver patch: CompInstalledPart.JobDriver_InstallPart => Verse.AI.JobDriver

Full hugslib report below https://gist.github.com/HugsLibRecordKeeper/c7119a141419f12f455e80df37c2698a

Thanks for keeping this awesome mod alive and keep up the good work!

LecrisUT commented 4 years ago

Pls test the Pre-Release. The 2 issues there are resolved there.

mk-over commented 4 years ago

Downloaded the Pre-Release and tested. Red errors were reduced to one.

[HugsLib][ERR] Lecris.survivaltoolsreborn caused an exception during OnDefsLoaded: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <567df3e0919241ba98db88bec4c6696f>:0 
  at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0 
  at SurvivalTools.HarmonyPatches.Controller.Transpile_AddDegrade (System.Collections.Generic.IEnumerable`1[T] instructions) [0x002e6] in <7db4b08300b44f44ba5c20b02d130a71>: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 <567df3e0919241ba98db88bec4c6696f>: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 <567df3e0919241ba98db88bec4c6696f>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0 
  at HarmonyLib.CodeTranspiler+<>c__DisplayClass12_0.<GetResult>b__0 (System.Reflection.MethodInfo transpiler) [0x0004c] in <2161c8330234450b8141397c32c11571>:0 
  at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00024] in <567df3e0919241ba98db88bec4c6696f>:0 
  at HarmonyLib.CodeTranspiler.GetResult (System.Reflection.Emit.ILGenerator generator, System.Reflection.MethodBase method) [0x00020] in <2161c8330234450b8141397c32c11571>:0 
  at HarmonyLib.MethodBodyReader.FinalizeILCodes (HarmonyLib.Emitter emitter, System.Collections.Generic.List`1[T] transpilers, System.Collections.Generic.List`1[T] endLabels, System.Boolean& hasReturnCode) [0x00149] in <2161c8330234450b8141397c32c11571>:0 
  at HarmonyLib.MethodCopier.Finalize (HarmonyLib.Emitter emitter, System.Collections.Generic.List`1[T] endLabels, System.Boolean& hasReturnCode) [0x00000] in <2161c8330234450b8141397c32c11571>:0 
  at HarmonyLib.MethodPatcher.CreateReplacement (System.Collections.Generic.Dictionary`2[System.Int32,HarmonyLib.CodeInstruction]& finalInstructions) [0x00209] in <2161c8330234450b8141397c32c11571>:0 
  at HarmonyLib.PatchFunctions.UpdateWrapper (System.Reflection.MethodBase original, HarmonyLib.PatchInfo patchInfo) [0x00057] in <2161c8330234450b8141397c32c11571>:0 
  at HarmonyLib.PatchProcessor.Patch () [0x000de] in <2161c8330234450b8141397c32c11571>:0 
  at HarmonyLib.Harmony.Patch (System.Reflection.MethodBase original, HarmonyLib.HarmonyMethod prefix, HarmonyLib.HarmonyMethod postfix, HarmonyLib.HarmonyMethod transpiler, HarmonyLib.HarmonyMethod finalizer) [0x00028] in <2161c8330234450b8141397c32c11571>:0 
  at SurvivalTools.HarmonyPatches.Controller.PatchJobDrivers () [0x00453] in <7db4b08300b44f44ba5c20b02d130a71>:0 
  at SurvivalTools.HarmonyPatches.Controller.DefsLoaded () [0x00018] in <7db4b08300b44f44ba5c20b02d130a71>:0 
  at HugsLib.HugsLibController.OnDefsLoaded () [0x0001a] in <16781bf8b2ce4f1e84cb63572631a10b>:0 
Verse.Log:Error(String, Boolean)
HugsLib.Utils.ModLogger:ReportException(Exception, String, Boolean, String)
HugsLib.HugsLibController:OnDefsLoaded()
HugsLib.HugsLibController:DMD<DMD<LoadReloadInitialize_Patch1>?1158361728::LoadReloadInitialize_Patch1>(HugsLibController)
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.<>c:<UpdateCurrentAsynchronousEvent>b__27_0()
System.Threading.ThreadHelper:ThreadStart_Context(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object)
System.Threading.ThreadHelper:ThreadStart()

Yellow errors are similar as the old mining speed, yield and construction and plant red errors. Currently I'm testing different positions in the load order. Full log here:

https://gist.github.com/0742409118ad4414d6eaff49e0e9d3c5

mk-over commented 4 years ago

Testing done, load order doesn't matter, no matter how high or low it goes. Still need to pinpoint the exact mod that's causing it.

mk-over commented 4 years ago

Alright so here's something helpful: the yellow errors about mining speed, yield and construction seem to be a conflict with Outfitted - https://steamcommunity.com/sharedfiles/filedetails/?id=1595812861

Still looking for the source of the red error.

mk-over commented 4 years ago

Tracked down the red error to Vanilla Faction Expanded - Core

LecrisUT commented 4 years ago

Thank you for the debugging. The outfitted warnings I have to discuss further with Charlotte. It's an unnecessary coding on their part IMO.

I'll see what's the problem with vanilla faction. Hopefully a fix will come today.

LecrisUT commented 4 years ago

Well this is frustrating, I cannot replicate the error with Vanilla Faction Core. I've even tried with the most probable culprit in your list (Combat Extended). Are you sure it is the only mod that affects this?

mk-over commented 4 years ago

I was, I went through each mod individually, disabling everything until the error went away. I then did a test with just VFC gone and it didn't go away. Maybe I made a mistake in the process. I will re-do it.

mk-over commented 4 years ago

Ok so running another test I can confirm RemoteTech appears to be part of the problem. It looks like multiple mods are. So I changed my methodology and I run just the essential (Hugs, Harmony, Mod Manager and Survival tools) and add all mods one by one to see which one gives the error.

So far:

RemoteTech: https://gist.github.com/4f00c5ad0da49989cab4dd14fad3f34b

Vanilla Faction series seem to be in the clear. Sorry about that false positive. I will keep on testing as I can say that there's at least another one conflicting.

LecrisUT commented 4 years ago

I know how it feels. Multiple dependencies can be frustrating. Although the fact that this problem would appear here makes more sense. I'll upload a potential fix in a few minutes. It's a temporary fix while I discuss with Hugs on alternatives.

mk-over commented 4 years ago

I can confirm Preemptive Strike (v1.1 Fork) is another culprit. https://gist.github.com/6fbcc0a8b259ca284d8b1b34394d9b05

From the whole 300+ mods list, these two seem to be the only conflicting ones. I tested without RemoteTech and Preemptive Strike and the error went away.

Hopefully my testing/reporting was better this time, but I took the logs just to have confirmation in hand.

mk-over commented 4 years ago

Here's a hugs log with everything working. No red errors.

I can confirm all these mods are clear from initial red errors at least in the current version of Survival Tools Reborn.

https://gist.github.com/ba04d88b774b9e46623fb3c9d08109bd

Starting a new map and everything seems to be working as it should. Ruins never generate any tools though - I generated 3 maps with map re-roll and no tools in sight in any of the ruins. Other (vanilla) items such as furniture, packaged survival meals and steel are generating fine. Ruin tools are usually useful for me since I do naked brutality runs and I don't know if this behaviour was changed from past versions.

Damn Royalty generates a lot of ruins. Wish KV - Configurable Maps was working.

I digress. Thank you for your patience and hope all of this helps in the future. Keep up the awesome work, I find this mod to be a necessity when playing :sweat_smile:

LecrisUT commented 4 years ago

Found what the problem was. Interesting how each modder writes the same job code differently. Thank you for posting this case, I'll have a fix up soon.

As for the tools not being generated I'll double check if it works properly with Royalty.

LecrisUT commented 4 years ago

Ok, try this out https://github.com/LecrisUT/SurvivalTools/releases/tag/Beta_2.3.0502

mk-over commented 4 years ago

I tried it out and it all works out, the red error is gone. Thanks @LecrisUT! I don't know if you made any changes to ruin spawn, but none spawned yet.

I will leave this issue for you to close, if you consider it done.

LecrisUT commented 4 years ago

I'm working on the ruins now. Tynan changed the name of it so I have to track it down. As soon as I fix that too, I'll close this issue and ping you.

LecrisUT commented 4 years ago

Wow, the patch to add survival tools to the ruins was harder than I thought, but I finally got it working.

@mk-over let me know what you think.

mk-over commented 4 years ago

Thanks for this @LecrisUT. I tested and I get two red errors, both seem to be related to the monument changes.

https://gist.github.com/d3167ffce92c81c09bc889c2cad5f82c

Though I'm in one version behind the latest Rimworld version, it seems. I'm on the GOG version 2610 and the latest Rimworld version is 2618 and it has some monument changes, so I will try and see if GOG has the patch and I will try it again in the latest rimworld version.

LecrisUT commented 4 years ago

Hmm, I see. I would have to keep an eye on future changes. I suspect they will implement the point system where we can limit the total number of objects generated.

In the meantime I'll close this issue in order to keep track of current projects. Feel free to comment when the update is up. I still get notifications.

mk-over commented 4 years ago

Alright, I updated the game. Everything is in order and stable. No red errors, tools are spawning in ruins. It was really a problem of the outdated version. Thanks for all the help @LecrisUT!