コード例 #1
0
 private static void DrawFertilityAroundMouse()
 {
     if (!PlaySettingsPatch.showFertilityOverlay)
     {
         return;
     }
     FertilityUtility.FillFertilityRelevantCells(UI.MouseCell(), Find.CurrentMap);
     for (int i = 0; i < FertilityUtility.fertilityRelevantCells.Count; i++)
     {
         IntVec3 intVec = FertilityUtility.fertilityRelevantCells[i];
         float   num    = FertilityUtility.CellFertility(intVec, Find.CurrentMap, FertilityDrawer.fertilityCountedThings);
         if (num != 0f)
         {
             Vector3 v = GenMapUI.LabelDrawPosFor(intVec);
             GenMapUI.DrawThingLabel(v, num.ToString("n1"), FertilityDrawer.FertilityColor(num, 1.4f));
         }
     }
     FertilityDrawer.fertilityCountedThings.Clear();
 }
コード例 #2
0
        public static float CellFertility(IntVec3 c, Map map, List <Thing> countedThings = null)
        {
            float        num  = 0f;
            float        num2 = 0f;
            bool         flag = false;
            List <Thing> list = map.thingGrid.ThingsListAt(c);

            for (int i = 0; i < list.Count; i++)
            {
                Thing thing = list[i];
                if (FertilityUtility.FertilityRelevant(thing.def.category))
                {
                    if (countedThings != null)
                    {
                        if (countedThings.Contains(thing))
                        {
                            break;
                        }
                        countedThings.Add(thing);
                    }
                    SlotGroup slotGroup = thing.GetSlotGroup();
                    if (slotGroup == null)
                    {
                        float num3 = map.fertilityGrid.FertilityAt(thing.Position);
                        if (thing.def.Fillage == FillCategory.Full)
                        {
                            flag  = true;
                            num2 += num3;
                        }
                        else
                        {
                            num += num3;
                        }
                    }
                }
            }
            if (flag)
            {
                return(num2);
            }
            return(num + map.fertilityGrid.FertilityAt(c));
        }
コード例 #3
0
 private static void DrawFertilityAroundMouse()
 {
     if (!Find.PlaySettings.showFertilityOverlay)
     {
         return;
     }
     // Prevent overlap with beauty display
     if (Find.PlaySettings.showBeauty)
     {
         return;
     }
     FertilityUtility.FillFertilityRelevantCells(UI.MouseCell(), Find.CurrentMap);
     foreach (var cell in FertilityUtility.fertilityRelevantCells)
     {
         float num = FertilityUtility.CellFertility(cell, Find.CurrentMap, FertilityDrawer.fertilityCountedThings);
         if (num != 0f)
         {
             Vector3 v = GenMapUI.LabelDrawPosFor(cell);
             GenMapUI.DrawThingLabel(v, num.ToString("n1"), FertilityDrawer.FertilityColor(num, 1.4f));
         }
     }
     FertilityDrawer.fertilityCountedThings.Clear();
 }
コード例 #4
0
        public static float AverageFertilityPerceptible(IntVec3 root, Map map)
        {
            if (!root.IsValid || !root.InBounds(map))
            {
                return(0f);
            }
            FertilityUtility.tempCountedThings.Clear();
            float num  = 0f;
            int   num2 = 0;

            FertilityUtility.FillFertilityRelevantCells(root, map);
            for (int i = 0; i < FertilityUtility.fertilityRelevantCells.Count; i++)
            {
                num += FertilityUtility.CellFertility(FertilityUtility.fertilityRelevantCells[i], map, FertilityUtility.tempCountedThings);
                num2++;
            }
            FertilityUtility.tempCountedThings.Clear();
            if (num2 == 0)
            {
                return(0f);
            }
            return(num / (float)num2);
        }