// Token: 0x0600008E RID: 142 RVA: 0x00007A9C File Offset: 0x00005C9C
        private static void DoNotFoundGroupsOverlay(Building_MSDrugMix b, ThingDef def, int grp)
        {
            if (Find.CurrentMap == null || Find.CurrentMap != b.Map)
            {
                return;
            }

            var listRCP = MSDrugMixUtility.GetRCPList(def);
            var alerts  = new List <ThingDef>();

            if (listRCP.Count > 0)
            {
                foreach (var item in listRCP)
                {
                    if (item.mixgrp == grp)
                    {
                        alerts.AddDistinct(item.def);
                    }
                }
            }

            if (alerts.Count <= 0)
            {
                return;
            }

            var OutOfFuelMat = MaterialPool.MatFrom("UI/Overlays/OutOfFuel", ShaderDatabase.MetaOverlay);
            var i            = 0;

            foreach (var alert in alerts)
            {
                if (!alert.defName.StartsWith("Chunk") || alert.defName.StartsWith("Chunk") && i < 1)
                {
                    var mat     = MaterialPool.MatFrom(alert.uiIcon, ShaderDatabase.MetaOverlay, Color.white);
                    var BaseAlt = AltitudeLayer.WorldClipper.AltitudeFor();
                    if (mat != null)
                    {
                        var altInd  = 21;
                        var plane   = MeshPool.plane08;
                        var drawPos = b.TrueCenter();
                        drawPos.y  = BaseAlt + (0.046875f * altInd);
                        drawPos.x += i;
                        drawPos.z += grp - 2;
                        var num2 = ((float)Math.Sin(
                                        (Time.realtimeSinceStartup + (397f * (b.thingIDNumber % 571))) * 4f) + 1f) * 0.5f;
                        num2 = 0.3f + (num2 * 0.7f);
                        for (var j = 0; j < 2; j++)
                        {
                            var material = FadedMaterialPool.FadedVersionOf(j < 1 ? mat : OutOfFuelMat, num2);

                            if (material != null)
                            {
                                Graphics.DrawMesh(plane, drawPos, Quaternion.identity, material, 0);
                            }
                        }
                    }
                }

                i++;
            }
        }
        // Token: 0x0600008D RID: 141 RVA: 0x00007594 File Offset: 0x00005794
        private bool ValidateRecipe(ThingDef t, out bool CanUseMax, out List <RCPItemCanUse> FinalList, out int MinProd,
                                    out int MaxProd, out int Ticks)
        {
            CanUseMax = true;
            FinalList = null;
            MinProd   = 0;
            MaxProd   = 0;
            Ticks     = 0;
            if (debug && Find.TickManager.TicksGame % 100 == 0)
            {
                Log.Message("ValRep: " + t.defName);
            }

            if (!MSDrugMixUtility.RCPProdValues(t, out var ticks, out var minProd, out var maxProd, out var Res))
            {
                return(false);
            }

            Ticks   = ticks;
            MinProd = minProd;
            MaxProd = maxProd;
            if (debug)
            {
                Log.Message(string.Concat("RCPVals: Ticks: ", ticks.ToString(), " minProd: ", minProd.ToString(),
                                          " maxProd: ", maxProd.ToString(), " Res: ", Res));
            }

            if (!ResearchProjectDef.Named(Res).IsFinished || minProd <= 0 || maxProd <= 0 || ticks <= 0)
            {
                if (!ResearchProjectDef.Named(Res).IsFinished)
                {
                    Log.Message("MSDrugMix.ErrorRes".Translate(MixerThingDef.label));
                    isProducing        = false;
                    NumProd            = 0;
                    ProdWorkTicks      = 0;
                    TotalProdWorkTicks = 0;
                }
                else
                {
                    Log.Message("MSDrugMix.ErrorRCP".Translate(MixerThingDef.label, ticks.ToString(),
                                                               minProd.ToString(), maxProd.ToString()));
                    isProducing        = false;
                    NumProd            = 0;
                    ProdWorkTicks      = 0;
                    TotalProdWorkTicks = 0;
                }

                return(false);
            }

            var listRCP = MSDrugMixUtility.GetRCPList(t);

            if (listRCP.Count <= 0)
            {
                if (debug)
                {
                    Log.Message("RCP is False.");
                }

                return(false);
            }

            if (debug)
            {
                Log.Message("RCP Listings: " + listRCP.Count);
            }

            var RCPListPotentials = new List <RCPItemCanUse>();
            var RCPGroups         = new List <int>();

            foreach (var listItem in listRCP)
            {
                var MaterialsMin    = 0;
                var MaterialsMax    = 0;
                var RCPItem         = listItem;
                var RCPMinNumNeeded = (int)Math.Round(RCPItem.num * minProd * RCPItem.ratio);
                var RCPMaxNumNeeded = (int)Math.Round(RCPItem.num * maxProd * RCPItem.ratio);
                if (HasEnoughMaterialInHoppers(RCPItem.def, RCPMinNumNeeded, true))
                {
                    MaterialsMin = RCPMinNumNeeded;
                }

                if (HasEnoughMaterialInHoppers(RCPItem.def, RCPMaxNumNeeded, false))
                {
                    MaterialsMax = RCPMaxNumNeeded;
                }

                if (MaterialsMin > 0 || MaterialsMax > 0)
                {
                    RCPListPotentials.Add(new RCPItemCanUse
                    {
                        def = RCPItem.def,
                        Min = MaterialsMin,
                        Max = MaterialsMax,
                        Grp = RCPItem.mixgrp
                    });
                }

                if (!RCPGroups.Contains(RCPItem.mixgrp))
                {
                    RCPGroups.Add(RCPItem.mixgrp);
                }
            }

            if (debug)
            {
                Log.Message(
                    "InnerRecipe List: Groups: " + RCPGroups.Count + " , Potentials: " + RCPListPotentials.Count);
            }

            FinalList = new List <RCPItemCanUse>();
            var NotAllGroups = false;

            if (RCPGroups.Count > 0)
            {
                foreach (var grp in RCPGroups)
                {
                    var foundGroup = false;
                    if (RCPListPotentials.Count > 0)
                    {
                        RCPItemCanUse bestthingsofar = default;
                        var           best           = false;
                        var           bestmax        = false;
                        foreach (var itemchk in RCPListPotentials)
                        {
                            if (itemchk.Grp != grp)
                            {
                                continue;
                            }

                            foundGroup = true;
                            if (itemchk.Min <= 0)
                            {
                                continue;
                            }

                            if (itemchk.Max > 0)
                            {
                                if (bestmax)
                                {
                                    continue;
                                }

                                bestthingsofar.def = itemchk.def;
                                bestthingsofar.Min = itemchk.Min;
                                bestthingsofar.Max = itemchk.Max;
                                bestthingsofar.Grp = itemchk.Grp;
                                best    = true;
                                bestmax = true;
                            }
                            else if (!best)
                            {
                                bestthingsofar.def = itemchk.def;
                                bestthingsofar.Min = itemchk.Min;
                                bestthingsofar.Max = itemchk.Max;
                                bestthingsofar.Grp = itemchk.Grp;
                                best = true;
                            }
                        }

                        if (!bestmax)
                        {
                            bestthingsofar.Max = 0;
                        }

                        FinalList.Add(bestthingsofar);
                    }

                    if (foundGroup)
                    {
                        continue;
                    }

                    NotAllGroups = true;
                    DoNotFoundGroupsOverlay(this, t, grp);
                }
            }

            if (FinalList.Count > 0)
            {
                for (var l = 0; l < FinalList.Count; l++)
                {
                    if (FinalList[l].Max == 0)
                    {
                        CanUseMax = false;
                    }
                }
            }

            if (NotAllGroups)
            {
                if (debug)
                {
                    Log.Message("RCP is False. Not all inputs found");
                }

                return(false);
            }

            if (debug)
            {
                Log.Message("RCP is True. with (" + FinalList.Count + ") final list items");
            }

            return(true);
        }