RimWorld

RimWorld

THIGAPPE - Automatic Apparel Refitting with Apparel Paper Pattern
Tec 9. nov. 2022 kl. 11:18
Strange error for specific patched apparel
anyone ever encounter this error with clothes that have been patched by another mod? The clothes just appear invisible, if i remove the patch, they work fine. It works without Paper Pattern, so im a bit confused how a patch could be effecting it. The patch in question is patching the royalty armors. This is the error:

Could not execute post-long-event action. Exception: System.NullReferenceException: Object reference not set to an instance of an object
at ApparelPaperPattern.MyApparelGraphicRecordGetter+<>c__DisplayClass0_0.<GetDef>b__8 (System.Text.RegularExpressions.Regex y) [0x00000] in <9abba66dad7f45e2935833c11ba0c342>:0
at System.Collections.Generic.List`1[T].FindIndex (System.Int32 startIndex, System.Int32 count, System.Predicate`1[T] match) [0x0003b] in <eae584ce26bc40229c1b1aa476bfa589>:0
at System.Collections.Generic.List`1[T].FindIndex (System.Predicate`1[T] match) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0
at Verse.GenCollection.Any[T] (System.Collections.Generic.List`1[T] list, System.Predicate`1[T] predicate) [0x00000] in <81af9f8a18324e17b286924a43555a7c>:0
at ApparelPaperPattern.MyApparelGraphicRecordGetter+<>c__DisplayClass0_0.<GetDef>b__4 (ApparelPaperPattern.ApparelPaperPatternDef x) [0x0000d] in <9abba66dad7f45e2935833c11ba0c342>:0
at System.Linq.Utilities+<>c__DisplayClass1_0`1[TSource].<CombinePredicates>b__0 (TSource x) [0x0000e] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at System.Linq.Utilities+<>c__DisplayClass1_0`1[TSource].<CombinePredicates>b__0 (TSource x) [0x00000] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at System.Linq.Utilities+<>c__DisplayClass1_0`1[TSource].<CombinePredicates>b__0 (TSource x) [0x00000] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at System.Linq.Enumerable+WhereListIterator`1[TSource].MoveNext () [0x00037] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at System.Linq.Enumerable.TryGetLast[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Boolean& found) [0x00049] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at System.Linq.Enumerable.LastOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00000] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
at ApparelPaperPattern.MyApparelGraphicRecordGetter.GetDef (System.String raceName, RimWorld.BodyTypeDef bodyType, RimWorld.Apparel apparel) [0x000c6] in <9abba66dad7f45e2935833c11ba0c342>:0
at ApparelPaperPattern.HarmonyPatches.PostfixTryGetGraphicApparel (RimWorld.Apparel apparel, RimWorld.BodyTypeDef bodyType, RimWorld.ApparelGraphicRecord& rec) [0x0001c] in <9abba66dad7f45e2935833c11ba0c342>:0
at (wrapper dynamic-method) RimWorld.ApparelGraphicRecordGetter.RimWorld.ApparelGraphicRecordGetter.TryGetGraphicApparel_Patch1(RimWorld.Apparel,RimWorld.BodyTypeDef,RimWorld.ApparelGraphicRecord&)
at (wrapper dynamic-method) Verse.PawnGraphicSet.Verse.PawnGraphicSet.ResolveApparelGraphics_Patch2(Verse.PawnGraphicSet)
at Verse.PawnGraphicSet.SetApparelGraphicsDirty () [0x00008] in <81af9f8a18324e17b286924a43555a7c>:0
at RimWorld.Pawn_ApparelTracker.<Notify_ApparelChanged>b__76_0 () [0x0000b] in <81af9f8a18324e17b286924a43555a7c>:0
at Verse.LongEventHandler.ExecuteToExecuteWhenFinished () [0x0007c] in <81af9f8a18324e17b286924a43555a7c>:0
UnityEngine.StackTraceUtility:ExtractStackTrace ()
(wrapper dynamic-method) Verse.Log:Verse.Log.Error_Patch5 (string)
Verse.LongEventHandler:ExecuteToExecuteWhenFinished ()
Verse.LongEventHandler:ExecuteWhenFinished (System.Action)
RimWorld.Pawn_ApparelTracker:Notify_ApparelChanged ()
(wrapper dynamic-method) RimWorld.Pawn_ApparelTracker:RimWorld.Pawn_ApparelTracker.Notify_ApparelAdded_Patch7 (RimWorld.Pawn_ApparelTracker,RimWorld.Apparel)
(wrapper dynamic-method) Verse.ThingOwner:Verse.ThingOwner.NotifyAdded_Patch3 (Verse.ThingOwner,Verse.Thing)
(wrapper dynamic-method) Verse.ThingOwner`1<Verse.Thing>:Verse.ThingOwner`1[[Verse.Thing, Assembly-CSharp, Version=1.3.8194.1220, Culture=neutral, PublicKeyToken=null]].TryAdd_Patch1 (Verse.ThingOwner`1<Verse.Thing>,Verse.Thing,bool)
(wrapper dynamic-method) RimWorld.Pawn_ApparelTracker:RimWorld.Pawn_ApparelTracker.Wear_Patch4 (RimWorld.Pawn_ApparelTracker,RimWorld.Apparel,bool,bool)
RimWorld.JobDriver_Wear:<MakeNewToils>b__8_0 ()
Verse.AI.JobDriver:TryActuallyStartNextToil ()
Verse.AI.JobDriver:ReadyForNextToil ()
(wrapper dynamic-method) Verse.AI.JobDriver:Verse.AI.JobDriver.DriverTick_Patch0 (Verse.AI.JobDriver)
(wrapper dynamic-method) Verse.AI.Pawn_JobTracker:Verse.AI.Pawn_JobTracker.JobTrackerTick_Patch0 (Verse.AI.Pawn_JobTracker)
(wrapper dynamic-method) Verse.Pawn:Verse.Pawn.Tick_Patch3 (Verse.Pawn)
Verse.TickList:Tick ()
(wrapper dynamic-method) Verse.TickManager:Verse.TickManager.DoSingleTick_Patch4 (Verse.TickManager)
(wrapper dynamic-method) Verse.TickManager:Verse.TickManager.TickManagerUpdate_Patch0 (Verse.TickManager)
(wrapper dynamic-method) Verse.Game:Verse.Game.UpdatePlay_Patch3 (Verse.Game)
Verse.Root_Play:Update ()
< >
Viser 1-8 af 8 kommentarer
Tec 9. nov. 2022 kl. 14:43 
To recreate this. You have to have a patch in a load folder that replaces an apparel. That apparel will then throw the error. This is on rimworld 1.3 Not sure if it also does it in 1.4
WRelicK  [udvikler] 12. nov. 2022 kl. 16:39 
Sorry, I wasn't even notified about this discussion popping up! I appreciate the report.

Could you clarify what you mean by "replacing" an apparel item? Pointing me in the direction of a specific mod that does this would also help me test more easily.
Tec 12. nov. 2022 kl. 17:38 
so, it was a custom patch. But i imagine other mods must do it. whether the patch, removed the old def and added a new one with the exact same defname. Or if you just did a PatchOperationReplace of that ThingDef with the same name, but different stats. It would cause this error to show.

Im not sure if its limited to just patches loaded by a LoadFolder. But it seems replacing a ThingDef for an apparel in any form, as long as its the whole def, causes the error. I eventually changed the patch to change individual parts. The issue with that though is that rimworld has an issue currently where if you want to change the Parent of a def using PatchOperationAttributeSet the inheritance doesnt work, unless you replace the whole def. (wierd bug).

Im not sure if that inheritance bug was the cause of another mod. But either way, it seems the graphical reference for ThingDefs is lost when this happens, causing paper pattern to throw this error and all apparel on that pawn being invisible for that pawn if wearing an apparel that was replaced by a patch.
Sidst redigeret af Tec; 12. nov. 2022 kl. 17:41
WRelicK  [udvikler] 12. nov. 2022 kl. 17:53 
Hmm, odd indeed. You might want to try testing with humans while the BodyType overrider isn't active. If it still occurs, it's likely a framework issue best brought up with NALS directly.

If you do decide to test without the overrider active, let me know how it goes.
Tec 29. nov. 2022 kl. 11:24 
theres seems to be an inheritance issue in general when you change the parent of something in a patch, might actually be a rimworld issue atm, but will wait until the bugfixes for 1.4 have settled down.
WRelicK  [udvikler] 29. nov. 2022 kl. 11:38 
Could very well be. There's a similar problem going on right now related to packageIDs. Upon loading local/workshop copies with the same packageID, the game internally applies a prefix to them, which can cause packageID checks to outright fail even if the mod is loaded.

Definitely should consider reporting your issue in the dev Discord.
Erranty 6. feb. 2023 kl. 14:18 
Just ran into similar problem with Vanilla Weapons Expanded - Grenades. It adds some grenade belts via patches if there is another VWE mod, and only those added by patches appear to make this error when other belts added by mod itself do not. Also "error" belts are invisible and make hats invisible too, and after equipping a belt pawn stops moving if not drafted.
Sidst redigeret af Erranty; 6. feb. 2023 kl. 14:20
WRelicK  [udvikler] 6. feb. 2023 kl. 16:29 
Hmm, strange. It's possible the modded belts have improperly named textures. I would recommend comparing texture names from both the original mod and any addons.

I'll put investigating this on my to-do list, but it could be a while before I get to it, I'm afraid.
Sidst redigeret af WRelicK; 6. feb. 2023 kl. 16:29
< >
Viser 1-8 af 8 kommentarer
Per side: 1530 50