using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace Rimworld_Animations { public class PawnRenderNode_BodyTypeVariants : PawnRenderNode_GraphicVariants { protected new PawnRenderNodeProperties_BodyTypeVariants props; public PawnRenderNode_BodyTypeVariants(Pawn pawn, PawnRenderNodeProperties props, PawnRenderTree tree) : base(pawn, props, tree) { this.props = (PawnRenderNodeProperties_BodyTypeVariants)props; } protected override Dictionary GraphicVariantsFor(Pawn pawn) { if (props.bodyTypeVariantsDef == null) { Log.ErrorOnce("[Anims] Error: Tried to use BodyTypeVariants node, but bodyTypeVariants weren't given", 211341349); return null; } //for each different hediff-based texpathvariants, foreach (TexPathVariants_BodyType texPathVariant_BodyType in props.bodyTypeVariantsDef) { if (pawn.story.bodyType == texPathVariant_BodyType.bodyType) { //return that specific variant return GenerateVariants(pawn, texPathVariant_BodyType.texPathVariantsDef); } } //otherwise just use default return base.GraphicVariantsFor(pawn); } protected override void EnsureMaterialsInitialized() { variants = GraphicVariantsFor(this.tree.pawn); } } }