private void DoClosedTunnels(List <IntVec3> group, Map map)
        {
            Rand.PushState();
            int a = GenMath.RoundRandom((float)group.Count * Rand.Range(0.9f, 1.1f) * 2.5f / 10000f);

            Rand.PopState();
            a = Mathf.Min(a, 1);
            if (a > 0)
            {
                Rand.PushState();
                a = Rand.RangeInclusive(0, a);
                Rand.PopState();
            }
            float num = TunnelsWidthPerRockCount.Evaluate(group.Count);

            for (int i = 0; i < a; i++)
            {
                IntVec3 start = IntVec3.Invalid;
                float   num2  = -1f;
                for (int j = 0; j < 7; j++)
                {
                    IntVec3 intVec     = group.RandomElement();
                    float   distToCave = GetDistToCave(intVec, group, map, 30f, treatOpenSpaceAsCave: true);
                    if (!start.IsValid || distToCave > num2)
                    {
                        start = intVec;
                        num2  = distToCave;
                    }
                }
                Rand.PushState();
                float width = Rand.Range(num * 0.8f, num);
                Dig(start, Rand.Range(0f, 360f), width, group, map, closed: true);
                Rand.PopState();
            }
        }
        private void DoOpenTunnels(List <IntVec3> group, Map map)
        {
            Rand.PushState();
            int a = GenMath.RoundRandom((float)group.Count * Rand.Range(0.9f, 1.1f) * 5.8f / 10000f);

            Rand.PopState();
            a = Mathf.Min(a, 3);
            if (a > 0)
            {
                Rand.PushState();
                a = Rand.RangeInclusive(1, a);
                Rand.PopState();
            }
            float num = TunnelsWidthPerRockCount.Evaluate(group.Count);

            for (int i = 0; i < a; i++)
            {
                IntVec3 start = IntVec3.Invalid;
                float   num2  = -1f;
                float   dir   = -1f;
                float   num3  = -1f;
                for (int j = 0; j < 10; j++)
                {
                    IntVec3 intVec     = FindRandomEdgeCellForTunnel(group, map);
                    float   distToCave = GetDistToCave(intVec, group, map, 40f, treatOpenSpaceAsCave: false);
                    float   dist;
                    float   num4 = FindBestInitialDir(intVec, group, out dist);
                    if (!start.IsValid || distToCave > num2 || (distToCave == num2 && dist > num3))
                    {
                        start = intVec;
                        num2  = distToCave;
                        dir   = num4;
                        num3  = dist;
                    }
                }
                Rand.PushState();
                float width = Rand.Range(num * 0.8f, num);
                Rand.PopState();
                Dig(start, dir, width, group, map, closed: false);
            }
        }