Open Tourman36 opened 4 years ago
I took a look at the code and adding a bit of debugging, and when DrawHeadApparel is called, apparelRecord.graphic.MatAt(bodyFacing) returns null, causing the code to send a NULL value to the GetDamagedMat.
I'm not familiar enough with the code to fix yet, but I suspect this is the same issue from #1190, where it can't find the textures and causes the pink texture bug due to missing textures. The NULL check below gets rid of the annoying pink texture bug, but doesn't fix the issue since the head apparel is still not rendered.
Failed to find any textures at Things/Pawn/Humanlike/Apparel/CowboyHat/CowboyHat_Female while constructing Multi(initPath=Things/Pawn/Humanlike/Apparel/CowboyHat/CowboyHat_Female, color=RGBA(0.800, 0.800, 0.800, 1.000), colorTwo=RGBA(1.000, 1.000, 1.000, 1.000))
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
CombatExtended::RenderPawnInternal.DrawHeadApparel: apparelRecord is null
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)
CombatExtended::RenderPawnInternal.DrawHeadApparel: apparelRecord is null
foreach (var apparelRecord in headwearGraphics)
{
if (!apparelRecord.sourceApparel.def.apparel.hatRenderedFrontOfFace)
{
headwearPos.y += interval;
hideHair = true;
var apparelMat = apparelRecord.graphic.MatAt(bodyFacing);
if(!apparelMat)
{
Log.Warning("CombatExtended::RenderPawnInternal.DrawHeadApparel: apparelRecord is null");
return;
}
I'm using CE along with BBB Body Support and Vanilla Apparel Expanded, and whenever a pawn using a BBB Body equips something in the head slot that is from VAE (this does not happen with vanilla gear), the game throws an exception and the headgear is drawn as a pink box.
The order of CE does not matter; I've tried all the way at the top and at the bottom. If I remove CE, the issue goes away.
Exception drawing Anna: System.ArgumentNullException: Value cannot be null. Parameter name: key at System.Collections.Generic.Dictionary
2[TKey,TValue].FindEntry (TKey key) [0x00008] in <567df3e0919241ba98db88bec4c6696f>:0 at System.Collections.Generic.Dictionary2[TKey,TValue].TryGetValue (TKey key, TValue& value) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0 at Verse.DamagedMatPool.GetDamageFlashMat (UnityEngine.Material baseMat, System.Single damPct) [0x0000a] in <29684bdca4b441d38f64a3f064edc8ed>:0 at Verse.DamageFlasher.GetDamagedMat (UnityEngine.Material baseMat) [0x00007] in <29684bdca4b441d38f64a3f064edc8ed>:0 at CombatExtended.HarmonyCE.Harmony_PawnRenderer_RenderPawnInternal.DrawHeadApparel (Verse.PawnRenderer renderer, UnityEngine.Mesh mesh, UnityEngine.Vector3 rootLoc, UnityEngine.Vector3 headLoc, UnityEngine.Vector3 headOffset, Verse.Rot4 bodyFacing, UnityEngine.Quaternion quaternion, System.Boolean portrait, System.Boolean& hideHair) [0x00098] in <51a637428c0449319bfa1366f15a6d64>:0 at (wrapper dynamic-method) Verse.PawnRenderer.DMD<DMD<RenderPawnInternal_Patch6>?2006386432::RenderPawnInternal_Patch6>(Verse.PawnRenderer,UnityEngine.Vector3,single,bool,Verse.Rot4,Verse.Rot4,Verse.RotDrawMode,bool,bool,bool) at (wrapper dynamic-method) Verse.PawnRenderer.DMD<DMD<RenderPawnAt_Patch0>?1091714432::RenderPawnAt_Patch0>(Verse.PawnRenderer,UnityEngine.Vector3,Verse.RotDrawMode,bool,bool) at Verse.PawnRenderer.RenderPawnAt (UnityEngine.Vector3 drawLoc) [0x0002b] in <29684bdca4b441d38f64a3f064edc8ed>:0 at Verse.Pawn_DrawTracker.DrawAt (UnityEngine.Vector3 loc) [0x00000] in <29684bdca4b441d38f64a3f064edc8ed>:0 at Verse.Pawn.DrawAt (UnityEngine.Vector3 drawLoc, System.Boolean flip) [0x00006] in <29684bdca4b441d38f64a3f064edc8ed>:0 at Verse.Thing.Draw () [0x00007] in <29684bdca4b441d38f64a3f064edc8ed>:0 at Verse.ThingWithComps.Draw () [0x00000] in <29684bdca4b441d38f64a3f064edc8ed>:0 at Verse.DynamicDrawManager.DrawDynamicThings () [0x000d8] in <29684bdca4b441d38f64a3f064edc8ed>:0
Modlist: ` - brrainz.harmony