mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
59 lines
1.6 KiB
C#
59 lines
1.6 KiB
C#
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<int, Graphic> 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);
|
|
base.EnsureMaterialsInitialized();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|