diff --git a/1.5/Assemblies/Rimworld-Animations.dll b/1.5/Assemblies/Rimworld-Animations.dll index 7a6e149..56a78fd 100644 Binary files a/1.5/Assemblies/Rimworld-Animations.dll and b/1.5/Assemblies/Rimworld-Animations.dll differ diff --git a/1.5/Defs/AnimationDefs/TestAnimation1.xml b/1.5/Defs/AnimationDefs/TestAnimation1.xml index 59f4cd2..466bbb4 100644 --- a/1.5/Defs/AnimationDefs/TestAnimation1.xml +++ b/1.5/Defs/AnimationDefs/TestAnimation1.xml @@ -98,7 +98,6 @@ -
  • RenderNodeTag_Xray_Inside diff --git a/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml b/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml index 6be826f..1f68f3d 100644 --- a/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml +++ b/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml @@ -3,6 +3,7 @@ TestGroupAnimation1 2 + True
  • 10 diff --git a/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs b/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs index 55f3bea..c9cc5e0 100644 --- a/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs +++ b/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs @@ -55,6 +55,7 @@ namespace Rimworld_Animations { //element at or default to stop errors if (offsetDefs == null) return null; + if ((actor + reorder) % numActors >= offsetDefs.Count) return null; return offsetDefs[(actor + reorder) % numActors].FindOffset(pawn); } } diff --git a/1.5/Source/Comps/CompExtendedAnimator.cs b/1.5/Source/Comps/CompExtendedAnimator.cs index 13cd1d3..2c57aa8 100644 --- a/1.5/Source/Comps/CompExtendedAnimator.cs +++ b/1.5/Source/Comps/CompExtendedAnimator.cs @@ -153,10 +153,8 @@ namespace Rimworld_Animations { { PawnRenderNodeProperties props = animationProp.animPropProperties; - Log.Message("Texpath of prop:" + props.texPath); if (props.texPath.NullOrEmpty()) { - Log.Message("Setting default texture"); props.texPath = "AnimationProps/Banana/Banana"; } diff --git a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs index 50a8caa..da96fe5 100644 --- a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs +++ b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs @@ -13,6 +13,8 @@ namespace Rimworld_Animations public override bool CanDrawNow(PawnRenderNode node, PawnDrawParms parms) { + if (!base.CanDrawNow(node, parms)) return false; + if (parms.Portrait) return false; //don't draw if not visible at tick @@ -23,7 +25,7 @@ namespace Rimworld_Animations } - return base.CanDrawNow(node, parms); + return true; } protected override Material GetMaterial(PawnRenderNode node, PawnDrawParms parms) { @@ -37,7 +39,11 @@ namespace Rimworld_Animations //and texpathvariant is set && extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick) != null) { - return GetMaterialVariant(nodeWithGraphicVariants, parms, (int)extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick)); + Material materialVariant = GetMaterialVariant(nodeWithGraphicVariants, parms, (int)extendedAnimWorker.TexPathVariantAtTick(node.tree.AnimationTick)); + if (materialVariant != null) { + return materialVariant; + } + } //otherwise return original texture @@ -47,6 +53,9 @@ namespace Rimworld_Animations public virtual Material GetMaterialVariant(PawnRenderNode_GraphicVariants node, PawnDrawParms parms, int variant) { Material material = node.getGraphicVariant(variant).NodeGetMat(parms); + + if (material == null) return null; + if (material != null && !parms.Portrait && parms.flags.FlagSet(PawnRenderFlags.Invisible)) { material = InvisibilityMatPool.GetInvisibleMat(material); diff --git a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs index 64eb815..24a74d6 100644 --- a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs +++ b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNode_GraphicVariants.cs @@ -16,6 +16,12 @@ namespace Rimworld_Animations public Graphic getGraphicVariant(int variant) { + if (!variants.ContainsKey(variant)) + { + Log.ErrorOnce("[Anims] Error: tried to get key from variants that doesn't exist; key = " + variant, 2043428111); + return null; + } + return variants[variant]; } @@ -48,6 +54,8 @@ namespace Rimworld_Animations Dictionary variantGraphics = new Dictionary(); + if (texPathVariants == null) return variantGraphics; + //for each graphic variant for (int i = 0; i < texPathVariants.variants.Count; i++) {