/// <summary>
            /// Applied before UpdateFertilization runs.
            /// </summary>
            internal static bool Prefix(FertilizationMonitor.Instance __instance, float dt)
            {
                var consumed = __instance.def.consumedElements;
                var storage  = __instance.storage;
                var wrongTag = __instance.def.wrongFertilizerTestTag;

                if (consumed != null && storage != null)
                {
                    bool  correct = true, wrong = false;
                    var   sm         = __instance.sm;
                    float modifier   = GetFertilizerUsage(__instance.gameObject) * dt;
                    int   n          = consumed.Length;
                    var   fertilizer = ListPool <KPrefabID, FertilizationMonitor> .Allocate();

                    GetFertilizers(storage, fertilizer);
                    for (int i = 0; i < n && correct; i++)
                    {
                        ref var consumeInfo = ref consumed[i];
                        float   mass        = GetMass(fertilizer, consumeInfo.tag, wrongTag, ref wrong);
                        __instance.total_available_mass = mass;
                        if (mass < consumeInfo.massConsumptionRate * modifier)
                        {
                            correct = false;
                        }
                    }
                    fertilizer.Recycle();
                    sm.hasCorrectFertilizer.Set(correct, __instance);
                    sm.hasIncorrectFertilizer.Set(wrong, __instance);
                }
 private bool check_fertilizer(GameObject go)
 {
     FertilizationMonitor.Instance sMI = go.GetSMI <FertilizationMonitor.Instance>();
     if (sMI != null)
     {
         return(sMI.sm.hasCorrectFertilizer.Get(sMI));
     }
     return(true);
 }
 private string GetFertilizationTooltip(GameObject go)
 {
     FertilizationMonitor.Instance sMI = go.GetSMI <FertilizationMonitor.Instance>();
     if (sMI == null)
     {
         return(string.Empty);
     }
     return(UI.TOOLTIPS.VITALS_CHECKBOX_FERTILIZER.text.Replace("{mass}", GameUtil.GetFormattedMass(sMI.total_fertilizer_available, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}")));
 }
    private string GetFertilizationLabel(GameObject go)
    {
        FertilizationMonitor.Instance sMI = go.GetSMI <FertilizationMonitor.Instance>();
        string text = Db.Get().Amounts.Fertilization.Name;

        PlantElementAbsorber.ConsumeInfo[] consumedElements = sMI.def.consumedElements;
        for (int i = 0; i < consumedElements.Length; i++)
        {
            PlantElementAbsorber.ConsumeInfo consumeInfo = consumedElements[i];
            string text2 = text;
            text = text2 + "\n    • " + ElementLoader.GetElement(consumeInfo.tag).name + " " + GameUtil.GetFormattedMass(consumeInfo.massConsumptionRate, GameUtil.TimeSlice.PerCycle, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}");
        }
        return(text);
    }
 public static void DumpIncorrectFertilizers(Storage storage, GameObject go)
 {
     if (!((Object)storage == (Object)null) && !((Object)go == (Object)null))
     {
         Instance sMI = go.GetSMI <Instance>();
         PlantElementAbsorber.ConsumeInfo[] consumed_infos = null;
         if (sMI != null)
         {
             consumed_infos = sMI.def.consumedElements;
         }
         DumpIncorrectFertilizers(storage, consumed_infos, false);
         FertilizationMonitor.Instance      sMI2            = go.GetSMI <FertilizationMonitor.Instance>();
         PlantElementAbsorber.ConsumeInfo[] consumed_infos2 = null;
         if (sMI2 != null)
         {
             consumed_infos2 = sMI2.def.consumedElements;
         }
         DumpIncorrectFertilizers(storage, consumed_infos2, true);
     }
 }