UnlimitedHugs / RimworldAllowTool

A set of tools to simplify common tasks in Rimworld.
https://ludeon.com/forums/index.php?topic=17218.0
Other
60 stars 34 forks source link

Update for RimWorld 1.4 #48

Closed m00nl1ght-dev closed 2 years ago

m00nl1ght-dev commented 2 years ago

Hi, I made an attempt at updating your mod to Rimworld 1.4.

If you are already updating it yourself, just ignore this. Otherwise, maybe it helps :)

Enduriel commented 2 years ago

@m00nl1ght-dev I've just got your version up and running and am getting the following error spammed in log

Exception in RimWorld.InspectGizmoGrid.DrawInspectGizmoGridFor: System.NullReferenceException: Object reference not set to an instance of an object
  at Verse.GridsUtility.Fogged (Verse.IntVec3 c, Verse.Map map) [0x00000] in <18a9c497395840e0ba98f4062b01a2f3>:0 
  at AllowTool.Designator_HaulUrgently.ThingIsRelevant (Verse.Thing thing) [0x00015] in <e7220908bb214007ae1dff596f151933>:0 
  at AllowTool.Designator_HaulUrgently.CanDesignateThing (Verse.Thing t) [0x00001] in <e7220908bb214007ae1dff596f151933>:0 
  at Verse.Designator.CreateReverseDesignationGizmo (Verse.Thing t) [0x00017] in <18a9c497395840e0ba98f4062b01a2f3>:0 
     - postfix UnlimitedHugs.AllowTool: Void AllowTool.Patches.Designator_CreateReverseDesignationGizmo_Patch:CreateReverseDesignationGizmo_Postfix(Designator __instance, Command_Action __result)
  at RimWorld.InspectGizmoGrid.DrawInspectGizmoGridFor (System.Collections.Generic.IEnumerable`1[T] selectedObjects, Verse.Gizmo& mouseoverGizmo) [0x00159] in <18a9c497395840e0ba98f4062b01a2f3>:0 
     - transpiler net.pardeike.rimworld.lib.harmony: IEnumerable`1 VisualExceptions.ExceptionsAndActivatorHandler:Transpiler(IEnumerable`1 instructions, MethodBase original)
     - transpiler fluffy.blueprints: IEnumerable`1 Blueprints.Patch_InspectGizmoGrid_DrawInspectGizmoGridFor:Transpiler(IEnumerable`1 _instructions)

Hugslib log: https://gist.github.com/f5214c915a47fccae0d233d2728bf34c

I have very little experience in modding Rimworld, so thank you for taking the time to even attempt this. (I'm trying to nail down exactly when it happens but just in case its obvious I posted here immediately, though I know a random null where you don't expect it usually isn't super easy to debug)

m00nl1ght-dev commented 2 years ago

@Enduriel

Looks like it somehow tried to designate something that was not spawned on the map (then thing.Map is null). Not sure in what situation that can happen. If you can find out more details about the actions that cause it, that would be very helpful. It's also possible some other mod causes it, so you could test if it still happens when you disable all other mods.

UnlimitedHugs commented 2 years ago

@m00nl1ght-dev Thank you very much for the PR, this has saved me quite a bit of work. Finding a replacement for the gizmo grid patch is especially appreciated. Seems like the new approach is causing some flickering of the right-click icons, but I can investigate that separately.

m00nl1ght-dev commented 2 years ago

Thank you for the update, I'm glad the PR was helpful!

I looked into the flickering issue and found out that it is caused by the new gizmo caching that was added in 1.4. I created another PR here that fixes it: https://github.com/UnlimitedHugs/RimworldAllowTool/pull/49