private static void GenerateInitialHediffs(Pawn pawn, PawnGenerationRequest request)
        {
            int num = 0;

            while (true)
            {
                AgeInjuryUtility.GenerateRandomOldAgeInjuries(pawn, !request.AllowDead);
                PawnTechHediffsGenerator.GeneratePartsAndImplantsFor(pawn);
                PawnAddictionHediffsGenerator.GenerateAddictionsAndTolerancesFor(pawn);
                if (request.AllowDead && pawn.Dead)
                {
                    return;
                }
                if (!request.AllowDowned && pawn.Downed)
                {
                    pawn.health.Reset();
                    num++;
                    if (num > 80)
                    {
                        break;
                    }
                    continue;
                }
                return;
            }
            Log.Warning("Could not generate old age injuries for " + pawn.ThingID + " of age " + pawn.ageTracker.AgeBiologicalYears + " that allow pawn to move after " + 80 + " tries. request=" + request);
        }
예제 #2
0
        private static void GenerateInitialHediffs(Pawn pawn, PawnGenerationRequest request)
        {
            int num = 0;

            while (true)
            {
                AgeInjuryUtility.GenerateRandomOldAgeInjuries(pawn, !request.AllowDead);
                PawnTechHediffsGenerator.GenerateTechHediffsFor(pawn);
                PawnAddictionHediffsGenerator.GenerateAddictionsAndTolerancesFor(pawn);
                if (request.AllowDead && pawn.Dead)
                {
                    break;
                }
                if (request.AllowDowned || !pawn.Downed)
                {
                    break;
                }
                pawn.health.Reset();
                num++;
                if (num > 80)
                {
                    goto Block_4;
                }
            }
            goto IL_D7;
Block_4:
            Log.Warning(string.Concat(new object[]
            {
                "Could not generate old age injuries for ",
                pawn.ThingID,
                " of age ",
                pawn.ageTracker.AgeBiologicalYears,
                " that allow pawn to move after ",
                80,
                " tries. request=",
                request
            }), false);
IL_D7:
            if (!pawn.Dead && (request.Faction == null || !request.Faction.IsPlayer))
            {
                int num2 = 0;
                while (pawn.health.HasHediffsNeedingTend(false))
                {
                    num2++;
                    if (num2 > 10000)
                    {
                        Log.Error("Too many iterations.", false);
                        break;
                    }
                    TendUtility.DoTend(null, pawn, null);
                }
            }
        }
예제 #3
0
        private static void GenerateInitialHediffs(Pawn pawn, PawnGenerationRequest request)
        {
            int num = 0;

            while (true)
            {
                AgeInjuryUtility.GenerateRandomOldAgeInjuries(pawn, !request.AllowDead);
                PawnTechHediffsGenerator.GenerateTechHediffsFor(pawn);
                if (request.AllowAddictions)
                {
                    PawnAddictionHediffsGenerator.GenerateAddictionsAndTolerancesFor(pawn);
                }
                if ((request.AllowDead && pawn.Dead) || request.AllowDowned || !pawn.Downed)
                {
                    break;
                }
                pawn.health.Reset();
                num++;
                if (num > 80)
                {
                    Log.Warning("Could not generate old age injuries for " + pawn.ThingID + " of age " + pawn.ageTracker.AgeBiologicalYears + " that allow pawn to move after " + 80 + " tries. request=" + request);
                    break;
                }
            }
            if (pawn.Dead || (request.Faction != null && request.Faction.IsPlayer))
            {
                return;
            }
            int num2 = 0;

            while (true)
            {
                if (pawn.health.HasHediffsNeedingTend())
                {
                    num2++;
                    if (num2 > 10000)
                    {
                        break;
                    }
                    TendUtility.DoTend(null, pawn, null);
                    continue;
                }
                return;
            }
            Log.Error("Too many iterations.");
        }
예제 #4
0
        private static void GenerateInitialHediffs(Pawn pawn, PawnGenerationRequest request)
        {
            int num = 0;

            while (true)
            {
                ProTraverses.travGenerateRandomOldAgeInjuries.GetValue();
                PawnTechHediffsGenerator.GeneratePartsAndImplantsFor(pawn);
                PawnAddictionHediffsGenerator.GenerateAddictionsAndTolerancesFor(pawn);
                if (request.AllowDead && pawn.Dead)
                {
                    break;
                }
                if (request.AllowDowned || !pawn.Downed)
                {
                    return;
                }
                pawn.health.Reset();
                num++;
                if (num > 80)
                {
                    goto Block_4;
                }
            }
            return;

Block_4:
            Log.Warning(string.Concat(new object[]
            {
                "Could not generate old age injuries for ",
                pawn.ThingID,
                " of age ",
                pawn.ageTracker.AgeBiologicalYears,
                " that allow pawn to move after ",
                80,
                " tries. request=",
                request
            }));
        }