RimWorld

RimWorld

Better Pyromania
This topic has been locked
Pawn stuck in the "watching the flames" activity.
My pyromaniac pawn is always going for the "firewatching" activity and nothing else. They even forget to eat and they starve to death. I thought it's caused by the "lag-free torch" patch Tweaks Galore have, and not just Infinite Refuelables. Turning the tweaks galore patch does not fix it.

Exception in JobDriver tick for pawn Tillner driver=JobDriver_WatchFlame (toilIndex=1) driver.job=(PyromaniacJob_WatchFlame (Job_27553) A = Thing_TorchLamp77588 B = (114, 0, 96) Giver = JobGiver_GetJoy [workGiverDef: null]) System.NullReferenceException: Object reference not set to an instance of an object [Ref F833F901] at HelixienBrazier.HarmonyPatches.WatchTickAction_Prefix (System.Object __instance) [0x00017] in <dffdb343c62548138a1a4106a81cd173>:0 at BetterPyromania.JobDriver_WatchFlame.WatchTickAction () [0x0000e] in <ecf4da59085f4b4db01ebd18cdde013d>:0 - PREFIX rimworld.cixwow.helixienbrazier: Boolean HelixienBrazier.HarmonyPatches:WatchTickAction_Prefix(Object __instance) at RimWorld.JobDriver_WatchBuilding+<>c__DisplayClass2_0.<MakeNewToils>b__1 () [0x00000] in <2a40c3593b334f29ac3cb3d32d652351>:0 at Verse.AI.JobDriver.DriverTick () [0x00174] in <2a40c3593b334f29ac3cb3d32d652351>:0 - TRANSPILER net.pardeike.rimworld.lib.harmony: IEnumerable`1 VisualExceptions.ExceptionsAndActivatorHandler:Transpiler(IEnumerable`1 instructions, MethodBase original) - TRANSPILER Orion.Hospitality: IEnumerable`1 Hospitality.Patches.JobDriver_Patch+DriverTick:Transpiler(IEnumerable`1 insts) - TRANSPILER Krkr.RocketMan.Soyuz: IEnumerable`1 Soyuz.Patches.JobDriver_DriverTick_Patch:Transpiler(IEnumerable`1 instructions, ILGenerator generator) - POSTFIX safetemperature.1trickPwnyta: Void SafeTemperature.Patch_JobDriver_DriverTick:Postfix(Pawn ___pawn) UnityEngine.StackTraceUtility:ExtractStackTrace () (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Log.Warning_Patch0 (string) (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.AI.JobUtility.TryStartErrorRecoverJob_Patch2 (Verse.Pawn,string,System.Exception,Verse.AI.JobDriver) (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.AI.JobDriver.DriverTick_Patch1 (Verse.AI.JobDriver) (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.AI.Pawn_JobTracker.JobTrackerTick_Patch0 (Verse.AI.Pawn_JobTracker) (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Pawn.Tick_Patch1 (Verse.Pawn) (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.TickList.Tick_Patch0 (Verse.TickList) (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.TickManager.DoSingleTick_Patch4 (Verse.TickManager) (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.TickManager.TickManagerUpdate_Patch0 (Verse.TickManager) (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Game.UpdatePlay_Patch2 (Verse.Game) (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Root_Play.Update_Patch1 (Verse.Root_Play)
Here's the log:
https://gist.github.com/HugsLibRecordKeeper/f867dbb3eb4eb318ae442e7c62dbb817
< >
Showing 1-4 of 4 comments
Aelanna  [developer] 10 Oct, 2024 @ 10:59am 
The error appears to be coming from Helixien Gas Braziers' Harmony patch, not from Better Pyromania itself. Their git repository does not include source code, so I couldn't tell you what might be wrong with it, I would recommend letting them know.
CiXwOw 11 Oct, 2024 @ 10:35pm 
Hi, thought I'd check over here to see if more information about the issue was posted! I'm going to take a look at it today, but this was my first attempt as a Harmony patch, so I don't know how it will go.

The patch is intended to add checks for the Vanilla Expanded Framework's pipe system (CompResourceTrader) to match this mod's checks for CompRefuelable. I'm sure I've missed something simple, but nothing obvious jumps out at a glance.

I'll keep looking over it, but here’s the code if you want to take a look. Maybe something will stand out to you:

[StaticConstructorOnStartup] class HarmonyPatches { static HarmonyPatches() { Harmony harmony = new Harmony("rimworld.cixwow.helixienbrazier"); if (ModsConfig.IsActive("Aelanna.BetterPyromania")) { Type jobDriverWatchFlameType = AccessTools.TypeByName("BetterPyromania.JobDriver_WatchFlame"); if (jobDriverWatchFlameType != null) { MethodInfo originalMethod = AccessTools.Method(jobDriverWatchFlameType, "WatchTickAction"); HarmonyMethod prefixMethod = new HarmonyMethod(typeof(HarmonyPatches), nameof(WatchTickAction_Prefix)); harmony.Patch(originalMethod, prefix: prefixMethod); } } } public static bool WatchTickAction_Prefix(object __instance) { var targetAField = AccessTools.Field(__instance.GetType().BaseType, "TargetA"); LocalTargetInfo targetA = (LocalTargetInfo)targetAField.GetValue(__instance); Building building = (Building)targetA.Thing; CompResourceTrader compResourceTrader = building.TryGetComp<CompResourceTrader>(); if (compResourceTrader != null && !compResourceTrader.ResourceOn) { MethodInfo endJobWithMethod = AccessTools.Method(__instance.GetType(), "EndJobWith"); endJobWithMethod.Invoke(__instance, new object[] { JobCondition.Incompletable }); return false; // Skip the original method } return true; // Run the original method } }
CiXwOw 12 Oct, 2024 @ 9:36am 
Should be fixed now. I was trying to access a property with AccessTools.Field() rather than AccessTools.Property().
Aelanna  [developer] 28 Apr @ 6:11pm 
Forgot this was here, but closing it out as it appears to have been resolved!
< >
Showing 1-4 of 4 comments
Per page: 1530 50