예제 #1
0
        public static bool AcceptableGameConditionsToStartHangingOut(Map map)
        {
            if (GatheringsUtility.AnyLordJobPreventsNewGatherings(map))
            {
                return(false);
            }
            if (map.dangerWatcher.DangerRating != StoryDanger.None)
            {
                return(false);
            }
            int freeColonistsSpawnedCount = map.mapPawns.FreeColonistsSpawnedCount;

            if (freeColonistsSpawnedCount < 4)
            {
                return(false);
            }
            int num = 0;

            foreach (Pawn current in map.mapPawns.FreeColonistsSpawned)
            {
                if (current.health.hediffSet.BleedRateTotal > 0f)
                {
                    return(false);
                }
                if (current.Drafted)
                {
                    num++;
                }
            }
            if ((float)num / (float)freeColonistsSpawnedCount >= 0.5f)
            {
                return(false);
            }
            return(true);
        }
        static bool Prefix(Map map, GatheringDef gatheringDef, ref bool __result)
        {
            if (gatheringDef == DiscoDefOf.DSC_DiscoGathering)
            {
                if (!GatheringsUtility.AcceptableGameConditionsToContinueGathering(map) || GatheringsUtility.AnyLordJobPreventsNewGatherings(map) || map.dangerWatcher.DangerRating != StoryDanger.None)
                {
                    __result = false;
                    return(false);
                }

                int colonistsSpawnedCount = map.mapPawns.FreeColonistsSpawnedCount;
                if (colonistsSpawnedCount < 3)
                {
                    return(false);
                }

                int num = 0;
                foreach (Pawn pawn in map.mapPawns.FreeColonistsSpawned)
                {
                    if (pawn.health.hediffSet.BleedRateTotal > 0.05)
                    {
                        __result = false;
                        return(false);
                    }
                    if (pawn.Drafted)
                    {
                        num++;
                    }
                }

                __result = num / (double)colonistsSpawnedCount < 0.75 && GatheringsUtility.EnoughPotentialGuestsToStartGathering(map, gatheringDef);
                return(false);
            }

            return(true);
        }