Exemple #1
0
        public static List <HediffItem> GetCompatibleItems(this HediffComp_AnotherRandom comp)
        {
            //HediffCondition defaultCondition = hcp.defaultCondition;

            List <HediffItem> answer = new List <HediffItem>();

            foreach (HediffItem hi in comp.Props.hediffPool)
            {
                HediffCondition calculatedHC = ConditionBuilder.GetDefaultPlusSpecificHediffCondition(comp.Props?.defaultCondition ?? null, hi?.specificCondition ?? null, comp.HighVerbosity);

                if (
                    calculatedHC.HasBodypartCondition ? calculatedHC.bodyPart.GetBPRFromHediffCondition(comp.Pawn, out _) : true &&
                    calculatedHC.HasPawnCondition ? calculatedHC.pawn.ValidateCompatibilityOfHediffWithPawn(comp.Pawn) : true
                    )
                {
                    answer.Add(hi);
                }
            }

            if (!answer.NullOrEmpty())
            {
                return(answer);
            }

            return(null);
        }
        public static bool InitialHediffConditionCheck(this HediffComp_AnotherRandom comp, bool debug = false)
        {
            string debugStr = debug ? comp.Pawn.LabelShort + " InitialHediffConditionCheck - " : "";

            Tools.Warn(debugStr + " Entering", debug);

            bool anyAppliableItem = !comp.GetCompatibleItems().NullOrEmpty();

            Tools.Warn(debugStr + "found anyAppliableItem:" + anyAppliableItem, debug);

            return(anyAppliableItem);
        }