Esempio n. 1
0
        public static bool AllowsMedicineForHediff(Pawn deliveree, ThingDef med)
        {
            if (PriorityCareComp.MaxPriorityCare(deliveree, out MedicalCareCategory heCare))
            {
                //This is uses to allow higher medicine above normal limit below.
                //this is NOT used to stop the job is PriorityCare is lowered
                if (heCare.AllowsMedicine(med))
                {
                    return(true);
                }
            }

            //Not required but hey why dont I patch this in for Pharmacist
            MedicalCareCategory care = deliveree.GetCare();

            return(care.AllowsMedicine(med));
        }
Esempio n. 2
0
        //Filter time-sensitive injuries
        public static void FilterInjuriesForMedCount(List <Hediff> hediffs)
        {
            Log.Message($"Filtering ({hediffs.ToStringSafeEnumerable()})");
            if (PriorityCareComp.MaxPriorityCare(hediffs, out MedicalCareCategory maxPriorityCare))
            {
                MedicalCareCategory defaultCare = hediffs.First().pawn.GetCare();

                //ignore defaultCare if none uses default
                if (PriorityCareComp.AllPriorityCare(hediffs))
                {
                    defaultCare = maxPriorityCare;
                }

                //Find highest care
                MedicalCareCategory highestCare = defaultCare > maxPriorityCare ? defaultCare : maxPriorityCare;
                Log.Message($"maxPriorityCare is {maxPriorityCare}, defaultCare is {defaultCare}, highestCare is {highestCare}");

                //remove anything less than that
                //Should check if medicine is available, but you just set to use it so this will assume you have it
                hediffs.RemoveAll(delegate(Hediff h)
                {
                    if (PriorityCareComp.Get().TryGetValue(h, out MedicalCareCategory heCare))
                    {
                        return(heCare < highestCare);
                    }
                    return(defaultCare < highestCare);
                });
            }

            if (Settings.Get().noMedicineForNonUrgent)
            {
                hediffs.RemoveAll(h => !h.IsUrgent());
            }
            else if (Settings.Get().minimalMedicineForNonUrgent&& __beep_beep_MinimalMedicineAvailable)
            {
                if (hediffs.Any(h => h.IsUrgent()))
                {
                    hediffs.RemoveAll(h => !h.IsUrgent());
                }
            }
            Log.Message($"Filtered to ({hediffs.ToStringSafeEnumerable()})");
            __beep_beep_MinimalMedicineAvailable = true;
        }