RimWorld

RimWorld

Math! (Forked)
Bug when playing with Dub's Mint Menus
After having set up a bill to manage go-juice production by using negative yayo (to convert all yayo into go-juice), the custom item count causes all bills to disappear and this error happens before my console gets spammed with a different error, both attached:

Error 1:
Exception filling tab RimWorld.ITab_Bills: System.NullReferenceException: Object reference not set to an instance of an object [Ref 886BF64D] at Verse.GenGrid.Walkable (Verse.IntVec3 c, Verse.Map map) [0x00000] in <69945a8ed6c540cf90b578de735e0605>:0 at Verse.GenGrid.Standable (Verse.IntVec3 c, Verse.Map map) [0x00000] in <69945a8ed6c540cf90b578de735e0605>:0 - TRANSPILER OskarPotocki.VanillaFurnitureExpanded.Security: IEnumerable`1 VFESecurity.Patch_GenGrid+Standable:Transpiler(IEnumerable`1 instructions) at Verse.ThingUtility.InteractionCellWhenAt (Verse.ThingDef def, Verse.IntVec3 center, Verse.Rot4 rot, Verse.Map map) [0x0004e] in <69945a8ed6c540cf90b578de735e0605>:0 at Verse.Thing.get_InteractionCell () [0x00018] in <69945a8ed6c540cf90b578de735e0605>:0 at CrunchyDuck.Math.CachedMapData.GetThings (System.String thing_name, CrunchyDuck.Math.BillComponent bc) [0x00149] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at <0x19d6427c200 + 0x0011a> <unknown method> at CrunchyDuck.Math.CachedMapData.SearchVariable (System.String input, CrunchyDuck.Math.BillComponent bc, System.Single& count) [0x00048] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at CrunchyDuck.Math.Math.AddParameters (NCalc.Expression e, CrunchyDuck.Math.BillComponent bc, System.Collections.Generic.List`1[T] parameter_list) [0x00032] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at CrunchyDuck.Math.Math.DoMath (System.String equation, CrunchyDuck.Math.BillComponent bc, System.Single& result) [0x00131] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at CrunchyDuck.Math.Math.DoMath (System.String equation, CrunchyDuck.Math.InputField field) [0x00007] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at CrunchyDuck.Math.CountProducts_Patch.Prefix (System.Int32& __result, RimWorld.Bill_Production bill) [0x0002a] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at Verse.RecipeWorkerCounter.CountProducts (RimWorld.Bill_Production bill) [0x0001f] in <69945a8ed6c540cf90b578de735e0605>:0 - PREFIX CrunchyDuck.Math: Boolean CrunchyDuck.Math.CountProducts_Patch:Prefix(Int32& __result, Bill_Production bill) - POSTFIX com.spdskatr.projectrimfactory: Void ProjectRimFactory.Common.HarmonyPatches.Patch_RecipeWorkerCounter_CountProducts:Postfix(RecipeWorkerCounter __instance, Int32& __result, Bill_Production bill) at RimWorld.Bill_Production.ShouldDoNow () [0x0007d] in <69945a8ed6c540cf90b578de735e0605>:0 - POSTFIX co.uk.epicguru.rimforge: Void RimForge.Patches.Patch_BillProduction_ShouldDoNow:Postfix(Bill_Production __instance, Boolean& __result) at RimWorld.Bill.get_BaseColor () [0x00000] in <69945a8ed6c540cf90b578de735e0605>:0 at RimWorld.Bill.DoInterface (System.Single x, System.Single y, System.Single width, System.Int32 index) [0x00061] in <69945a8ed6c540cf90b578de735e0605>:0 - TRANSPILER CrunchyDuck.Math: IEnumerable`1 CrunchyDuck.Math.Patch_Bill_DoInterface:Transpiler(IEnumerable`1 instructions) - TRANSPILER CrunchyDuck.Math: IEnumerable`1 CrunchyDuck.Math.Patch_BillCopying:Transpiler(IEnumerable`1 instructions) - POSTFIX co.uk.epicguru.rimforge: Void RimForge.Patches.Patch_BillProduction_DoInterface:Postfix(Bill __instance, Single x, Single y, Single width) - POSTFIX CrunchyDuck.Math: Void CrunchyDuck.Math.Patch_Bill_DoInterface:Postfix(Bill& __instance, Single x, Single y, Single width) at (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Glue:AbiFixup<UnityEngine.Rect RimWorld.Bill:DoInterface(System.Single, System.Single, System.Single, System.Int32),UnityEngine.Rect RimWorld.Bill.DoInterface_Patch2(RimWorld.Bill, System.Single, System.Single, System.Single, System.Int32)>(RimWorld.Bill,UnityEngine.Rect&,single,single,single,int) at RimWorld.BillStack.DoListing (UnityEngine.Rect rect, System.Func`1[TResult] recipeOptionsMaker, UnityEngine.Vector2& scrollPosition, System.Single& viewHeight) [0x0013c] in <69945a8ed6c540cf90b578de735e0605>:0 - TRANSPILER com.showhair.rimworld.mod: IEnumerable`1 NoMaxBills.Patch_BillStack_DoListing:Transpiler(IEnumerable`1 instructions) - PREFIX Dubwise.DubsMintMenus: Void DubsMintMenus.Patch_BillStack_DoListing:Prefix(Rect& rect) - PREFIX CrunchyDuck.Math: Void CrunchyDuck.Math.Patch_BillStack_DoListing:Prefix(BillStack __instance) at RimWorld.ITab_Bills.FillTab () [0x0023c] in <69945a8ed6c540cf90b578de735e0605>:0 - PREFIX GestaltEngine.Mod: Void GestaltEngine.ITab_Bills_FillTab_Patch:Prefix(ITab_Bills __instance, List`1& __state) - POSTFIX GestaltEngine.Mod: Void GestaltEngine.ITab_Bills_FillTab_Patch:Postfix(ITab_Bills __instance, List`1 __state) at Verse.InspectTabBase+<>c__DisplayClass19_0.<DoTabGUI>b__0 () [0x00039] in <69945a8ed6c540cf90b578de735e0605>:0 UnityEngine.StackTraceUtility:ExtractStackTrace () (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Log.Error_Patch5 (string) Verse.Log:ErrorOnce (string,int) Verse.InspectTabBase/<>c__DisplayClass19_0:<DoTabGUI>b__0 () Verse.ImmediateWindow:DoWindowContents (UnityEngine.Rect) Verse.Window:InnerWindowOnGUI (int) UnityEngine.GUI:CallWindowDelegate (UnityEngine.GUI/WindowFunction,int,int,UnityEngine.GUISkin,int,single,single,UnityEngine.GUIStyle)

Error 2 [which gets spammed every tick]:
Mouse position stack is not empty. There were more calls to BeginScrollView than EndScrollView. Fixing. UnityEngine.StackTraceUtility:ExtractStackTrace () (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Log.Error_Patch5 (string) Verse.Widgets:EnsureMousePositionStackEmpty () (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Root.Update_Patch1 (Verse.Root) Verse.Root_Play:Update ()
< >
Showing 1-7 of 7 comments
on top, the bill configuration menu sometimes flickers.
Error:
Exception filling window for CrunchyDuck.Math.Dialog_MathBillConfig: System.NullReferenceException: Object reference not set to an instance of an object [Ref 840DF468] at Verse.GenGrid.Walkable (Verse.IntVec3 c, Verse.Map map) [0x00000] in <69945a8ed6c540cf90b578de735e0605>:0 at Verse.GenGrid.Standable (Verse.IntVec3 c, Verse.Map map) [0x00000] in <69945a8ed6c540cf90b578de735e0605>:0 - TRANSPILER OskarPotocki.VanillaFurnitureExpanded.Security: IEnumerable`1 VFESecurity.Patch_GenGrid+Standable:Transpiler(IEnumerable`1 instructions) at Verse.ThingUtility.InteractionCellWhenAt (Verse.ThingDef def, Verse.IntVec3 center, Verse.Rot4 rot, Verse.Map map) [0x0004e] in <69945a8ed6c540cf90b578de735e0605>:0 at Verse.Thing.get_InteractionCell () [0x00018] in <69945a8ed6c540cf90b578de735e0605>:0 at CrunchyDuck.Math.CachedMapData.GetThings (System.String thing_name, CrunchyDuck.Math.BillComponent bc) [0x00149] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at <0x21b3d61f4c0 + 0x0011a> <unknown method> at CrunchyDuck.Math.CachedMapData.SearchVariable (System.String input, CrunchyDuck.Math.BillComponent bc, System.Single& count) [0x00048] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at CrunchyDuck.Math.Math.AddParameters (NCalc.Expression e, CrunchyDuck.Math.BillComponent bc, System.Collections.Generic.List`1[T] parameter_list) [0x00032] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at CrunchyDuck.Math.Math.DoMath (System.String equation, CrunchyDuck.Math.BillComponent bc, System.Single& result) [0x00131] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at CrunchyDuck.Math.Math.DoMath (System.String equation, CrunchyDuck.Math.InputField field) [0x00007] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at CrunchyDuck.Math.BillManager.UpdateBill (CrunchyDuck.Math.BillComponent bc) [0x0002f] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at CrunchyDuck.Math.Dialog_MathBillConfig.DoWindowContents (UnityEngine.Rect inRect) [0x00021] in <d76c5502f13b41c18d0cdc7b3df892f3>:0 at Verse.Window.InnerWindowOnGUI (System.Int32 x) [0x001a6] in <69945a8ed6c540cf90b578de735e0605>:0 UnityEngine.StackTraceUtility:ExtractStackTrace () (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Log.Error_Patch5 (string) Verse.Window:InnerWindowOnGUI (int) UnityEngine.GUI:CallWindowDelegate (UnityEngine.GUI/WindowFunction,int,int,UnityEngine.GUISkin,int,single,single,UnityEngine.GUIStyle)
kd8lvt  [developer] 6 Feb @ 9:48am 
Apologies, I missed this!
If you're still interested in debugging this, I think it's most likely a problem with using a negative number in the bill, and not a Dubs' incompatibility, given I test with Dubs' specifically. RimWorld only ever expects a positive integer when it comes to stack sizes, and anything else is (at best) undefined behavior.

I do see some other harmony patches in the log - specifically a transpiler from VFE Security - if you're still using that modlist, try starting a new dev-mode save with just VFE Security removed and see if it still happens. It may be that the transpiler is bugging out over an unexpected negative number.

Also, 0 should work as an "infinity" just as well, if not better, than a negative number :)
Originally posted by kd8lvt:
Apologies, I missed this!
If you're still interested in debugging this, I think it's most likely a problem with using a negative number in the bill, and not a Dubs' incompatibility, given I test with Dubs' specifically. RimWorld only ever expects a positive integer when it comes to stack sizes, and anything else is (at best) undefined behavior.

I do see some other harmony patches in the log - specifically a transpiler from VFE Security - if you're still using that modlist, try starting a new dev-mode save with just VFE Security removed and see if it still happens. It may be that the transpiler is bugging out over an unexpected negative number.

Also, 0 should work as an "infinity" just as well, if not better, than a negative number :)
I think I used negative numbers as the item count so that it would create up to specified amount, not entirely sure how I used the negative numbers...

I did also see the VFE security mention as well; and it has stuff that I do not want to remove so I'm kinda stuck between a rock and a hard place if you want me to test that...
kd8lvt  [developer] 6 Feb @ 2:53pm 
That's why I mentioned making a new save and testing the same bill setup with devmode haha. You can re-enable VFESec before loading your save and nothing (should) break.

It's typically the first step when testing this kind of bug, and while I could manually download your modlist and have you send me a copy of your bills to do it myself, in the event that it is VFESec, having you do it first in a seperate save file would expedite a fix massively, as I would have a much smaller list of mods to download :)

Plus, you could make a copy of your save so you don't even have to copy the bills over ^^
Last edited by kd8lvt; 6 Feb @ 2:58pm
kd8lvt  [developer] 6 Feb @ 2:56pm 
As for negatives being in custom item count -- I haven't tested with custom item count much at all, due to my own inability to find a use case that "do until X" doesn't cover with some extra fanangling. That said, it's a feature in the mod that I know people use, so I haven't removed it for (I hope) fairly obvious reasons.
Last edited by kd8lvt; 6 Feb @ 2:56pm
Originally posted by kd8lvt:
As for negatives being in custom item count -- I haven't tested with custom item count much at all, due to my own inability to find a use case that "do until X" doesn't cover with some extra fanangling. That said, it's a feature in the mod that I know people use, so I haven't removed it for (I hope) fairly obvious reasons.
actually, the reason why I use it is because that updates more often than the "do until X" limit does. so `-Yayo` so I convert all Yayo into Go-Juice. The `Do until X` would stall with the limiter if I had set the item thing to be 0 and then set the limit to `Yayo`; the limit would never update again until I checked the bill.
kd8lvt  [developer] 6 Feb @ 4:20pm 
Ah, yeah, the limit updating slower is an optimization thing.
The bill shouldn't be stalling, as far as I'm aware - that might be a problem with setting the custom item count to 0. Since the number of items doesn't change, it doesn't try to update the threshold - I think that may be a vanilla optimization.
If you set
Custom item count = `Yayo-2`
Limit = `Yayo-1`
It should just go until you only have 1 Yayo left. Change the 1 to whatever number you want, (and the 2 to that +1) and you're golden. Alternatively, don't use custom item count at all, and do something like
Limit = `"if(Yayo >= 1,GoJuice+1,0)"`
Last edited by kd8lvt; 6 Feb @ 4:20pm
< >
Showing 1-7 of 7 comments
Per page: 1530 50