﻿using RimWorld;
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using static rjw.xxx;

namespace Rimworld_Animations
{
    public class GroupAnimationContext_RJWSex : BaseGroupAnimationContext
    {

        public List<InteractionDef> interactionDefs;

        public override bool CanAnimationBeUsed(List<Pawn> actors, int numActors)
        {

            JobDriver_SexBaseInitiator latestSexBaseInitiator = (actors.FindLast(x => x.jobs?.curDriver is JobDriver_SexBaseInitiator).jobs.curDriver as JobDriver_SexBaseInitiator);

            if (!interactionDefs.Contains(latestSexBaseInitiator.Sexprops.dictionaryKey)) {
                return false;
            }

            return base.CanAnimationBeUsed(actors, numActors);
        }

        public override string DebugMessage()
        {
            return "Checking for RJWSex AnimationContext\n" 
                + "InteractionDefs: " + interactionDefs;
        }
    }
}
