Ejemplo n.º 1
0
 public void Notify_NewPawnGenerating(Pawn pawn, PawnGenerationContext context)
 {
     foreach (ScenPart allPart in AllParts)
     {
         allPart.Notify_NewPawnGenerating(pawn, context);
     }
 }
Ejemplo n.º 2
0
 public override void Notify_PawnGenerated(Pawn pawn, PawnGenerationContext context, bool redressed)
 {
     if (this.context.Includes(context) && (!hideOffMap || context != PawnGenerationContext.PlayerStarter) && Rand.Chance(chance) && pawn.RaceProps.Humanlike)
     {
         ModifyPawnPostGenerate(pawn, redressed);
     }
 }
        // RimWorld.Scenario
        public static void Vamp_DontGenerateVampsInDaylight(Scenario __instance, Pawn pawn,
                                                            PawnGenerationContext context)
        {
            if (!pawn.IsVampire())
            {
                return;
            }

            Map currentMap = Find.CurrentMap;

            if (currentMap == null)
            {
                return;
            }

            var recentVampires = Find.World.GetComponent <WorldComponent_VampireTracker>().recentVampires;

            if (VampireUtility.IsDaylight(currentMap) && pawn.Faction != Faction.OfPlayerSilentFail &&
                pawn?.health?.hediffSet?.hediffs is List <Hediff> hdiffs)
            {
                hdiffs.RemoveAll(x => x.def == VampDefOf.ROM_Vampirism);
                if (recentVampires?.ContainsKey(pawn) ?? false)
                {
                    recentVampires.Remove(pawn);
                }
            }
            else
            {
                //Log.Message("Added " + pawn.Label + " to recent vampires list");
                recentVampires?.Add(pawn, 1);
            }
        }
Ejemplo n.º 4
0
        public static string ToStringHuman(this PawnGenerationContext context)
        {
            string result;

            if (context != PawnGenerationContext.All)
            {
                if (context != PawnGenerationContext.PlayerStarter)
                {
                    if (context != PawnGenerationContext.NonPlayer)
                    {
                        throw new NotImplementedException();
                    }
                    result = "PawnGenerationContext_NonPlayer".Translate();
                }
                else
                {
                    result = "PawnGenerationContext_PlayerStarter".Translate();
                }
            }
            else
            {
                result = "PawnGenerationContext_All".Translate();
            }
            return(result);
        }
Ejemplo n.º 5
0
        protected void DoPawnModifierEditInterface(Rect rect)
        {
            Rect rect2 = rect.TopHalf();
            Rect rect3 = rect2.LeftPart(0.333f).Rounded();
            Rect rect4 = rect2.RightPart(0.666f).Rounded();

            Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect3, "chance".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.TextFieldPercent(rect4, ref this.chance, ref this.chanceBuf, 0f, 1f);
            Rect rect5 = rect.BottomHalf();
            Rect rect6 = rect5.LeftPart(0.333f).Rounded();
            Rect rect7 = rect5.RightPart(0.666f).Rounded();

            Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect6, "context".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            if (Widgets.ButtonText(rect7, this.context.ToStringHuman(), true, false, true))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                foreach (PawnGenerationContext localCont2 in Enum.GetValues(typeof(PawnGenerationContext)))
                {
                    PawnGenerationContext localCont = localCont2;
                    list.Add(new FloatMenuOption(localCont.ToStringHuman(), delegate
                    {
                        this.context = localCont;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
        }
Ejemplo n.º 6
0
        protected void DoPawnModifierEditInterface(Rect rect)
        {
            Rect rect2 = rect.TopHalf();
            Rect rect3 = rect2.LeftPart(0.333f).Rounded();
            Rect rect4 = rect2.RightPart(0.666f).Rounded();

            Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect3, "chance".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.TextFieldPercent(rect4, ref chance, ref chanceBuf);
            Rect rect5 = rect.BottomHalf();
            Rect rect6 = rect5.LeftPart(0.333f).Rounded();
            Rect rect7 = rect5.RightPart(0.666f).Rounded();

            Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect6, "context".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            if (!Widgets.ButtonText(rect7, context.ToStringHuman()))
            {
                return;
            }
            List <FloatMenuOption> list = new List <FloatMenuOption>();

            foreach (PawnGenerationContext value in Enum.GetValues(typeof(PawnGenerationContext)))
            {
                PawnGenerationContext localCont = value;
                list.Add(new FloatMenuOption(localCont.ToStringHuman(), delegate
                {
                    context = localCont;
                }));
            }
            Find.WindowStack.Add(new FloatMenu(list));
        }
Ejemplo n.º 7
0
 public override void Notify_NewPawnGenerating(Pawn pawn, PawnGenerationContext context)
 {
     if (this.context.Includes(context) && (!hideOffMap || context != PawnGenerationContext.PlayerStarter) && Rand.Chance(chance) && pawn.RaceProps.Humanlike)
     {
         ModifyNewPawn(pawn);
     }
 }
Ejemplo n.º 8
0
 public void Notify_PawnGenerated(Pawn pawn, PawnGenerationContext context)
 {
     foreach (ScenPart current in this.AllParts)
     {
         current.Notify_PawnGenerated(pawn, context);
     }
 }
Ejemplo n.º 9
0
 public void Notify_PawnGenerated(Pawn pawn, PawnGenerationContext context, bool redressed)
 {
     foreach (ScenPart allPart in AllParts)
     {
         allPart.Notify_PawnGenerated(pawn, context, redressed);
     }
 }
 public static bool Includes(this PawnGenerationContext includer, PawnGenerationContext other)
 {
     if (includer == PawnGenerationContext.All)
     {
         return(true);
     }
     return(includer == other);
 }
Ejemplo n.º 11
0
 // RimWorld.Scenario
 public static void AddRecentHulks(Scenario __instance, Pawn pawn, PawnGenerationContext context)
 {
     if (pawn.IsHulk())
     {
         var recentWerewolves = Find.World.GetComponent <WorldComponent_MoonCycle>().recentWerewolves;
         recentWerewolves?.Add(pawn, 1);
     }
 }
 public static string ToStringHuman(this PawnGenerationContext context)
 {
     return(context switch
     {
         PawnGenerationContext.All => "PawnGenerationContext_All".Translate(),
         PawnGenerationContext.PlayerStarter => "PawnGenerationContext_PlayerStarter".Translate(),
         PawnGenerationContext.NonPlayer => "PawnGenerationContext_NonPlayer".Translate(),
         _ => throw new NotImplementedException(),
     });
Ejemplo n.º 13
0
 public override void Notify_NewPawnGenerating(Pawn pawn, PawnGenerationContext context)
 {
     if (context == PawnGenerationContext.PlayerStarter)
     {
         foreach (var skill in pawn.skills.skills)
         {
             skill.Level = Rand.RangeInclusive(15, 20);
         }
     }
 }
Ejemplo n.º 14
0
 public override void Notify_PawnGenerated(Pawn pawn, PawnGenerationContext context)
 {
     if (this.hideOffMap && PawnGenerationContext.PlayerStarter.Includes(context))
     {
         return;
     }
     if (pawn.RaceProps.Humanlike && this.context.Includes(context))
     {
         this.ModifyPawn(pawn);
     }
 }
Ejemplo n.º 15
0
 public override void Notify_NewPawnGenerating(Pawn pawn, PawnGenerationContext context)
 {
     if (context == PawnGenerationContext.PlayerStarter)
     {
         foreach (var skill in pawn.skills.skills)
         {
             skill.Level = Rand.RangeInclusive(15, 20);
         }
         pawn.playerSettings.hostilityResponse = HostilityResponseMode.Attack;
     }
 }
 public static bool OverlapsWith(this PawnGenerationContext a, PawnGenerationContext b)
 {
     if (a == PawnGenerationContext.All || b == PawnGenerationContext.All)
     {
         return(true);
     }
     if (a == b)
     {
         return(true);
     }
     return(false);
 }
 public static bool OverlapsWith(this PawnGenerationContext a, PawnGenerationContext b)
 {
     if (a != 0 && b != 0)
     {
         if (a == b)
         {
             return(true);
         }
         return(false);
     }
     return(true);
 }
 public override void Notify_PawnGenerated(Pawn pawn, PawnGenerationContext context)
 {
     if (Find.VisibleMap == null)
     {
         curVampires = Find.GameInitData.startingPawns.FindAll(x => x?.health?.hediffSet?.hediffs.FirstOrDefault(y => y.def.defName.Contains("Vampirism")) != null)?.Count() ?? 0;
         BloodlineDef def = (randomBloodline) ? PossibleBloodlines().RandomElement() : bloodline;
         if (pawn.RaceProps.Humanlike && context == PawnGenerationContext.PlayerStarter)
         {
             if (Rand.Value < vampChance && curVampires < maxVampires)
             {
                 curVampires++;
                 HediffDef hediffDefToApply = VampDefOf.ROM_VampirismRandom;
                 if (def == VampDefOf.ROMV_ClanGargoyle)
                 {
                     hediffDefToApply = VampDefOf.ROM_VampirismGargoyle;
                 }
                 if (def == VampDefOf.ROMV_ClanLasombra)
                 {
                     hediffDefToApply = VampDefOf.ROM_VampirismLasombra;
                 }
                 if (def == VampDefOf.ROMV_ClanPijavica)
                 {
                     hediffDefToApply = VampDefOf.ROM_VampirismPijavica;
                 }
                 if (def == VampDefOf.ROMV_ClanTremere)
                 {
                     hediffDefToApply = VampDefOf.ROM_VampirismTremere;
                 }
                 if (def == VampDefOf.ROMV_ClanTzimize)
                 {
                     hediffDefToApply = VampDefOf.ROM_VampirismTzimisce;
                 }
                 HealthUtility.AdjustSeverity(pawn, hediffDefToApply, 0.5f);
                 pawn.story.hairColor = PawnHairColors.RandomHairColor(pawn.story.SkinColor, 20);
                 int ticksToAdd = Rand.Range(GenDate.TicksPerYear, GenDate.TicksPerYear * 200);
                 pawn.ageTracker.AgeBiologicalTicks    += ticksToAdd;
                 pawn.ageTracker.AgeChronologicalTicks += ticksToAdd;
                 if (pawn.health.hediffSet.hediffs is List <Hediff> hediffs)
                 {
                     hediffs.RemoveAll(x => x.IsOld() ||
                                       x.def == HediffDefOf.BadBack ||
                                       x.def == HediffDefOf.Frail ||
                                       x.def == HediffDefOf.Cataract ||
                                       x.def == HediffDef.Named("HearingLoss") ||
                                       x.def == HediffDef.Named("HeartArteryBlockage"));
                 }
                 //VampireGen.TryGiveVampirismHediff(pawn, generationRange.RandomInRange, def, null, false);
             }
         }
     }
 }
Ejemplo n.º 19
0
 public override void Notify_NewPawnGenerating(Pawn pawn, PawnGenerationContext context)
 {
     if (!this.context.Includes(context))
     {
         return;
     }
     if (this.hideOffMap && context == PawnGenerationContext.PlayerStarter)
     {
         return;
     }
     if (Rand.Chance(this.chance) && pawn.RaceProps.Humanlike)
     {
         this.ModifyNewPawn(pawn);
     }
 }
Ejemplo n.º 20
0
 public override void Notify_PawnGenerated(Pawn pawn, PawnGenerationContext context, bool redressed)
 {
     if (!this.context.Includes(context))
     {
         return;
     }
     if (this.hideOffMap && context == PawnGenerationContext.PlayerStarter)
     {
         return;
     }
     if (Rand.Chance(this.chance) && pawn.RaceProps.Humanlike)
     {
         this.ModifyPawnPostGenerate(pawn, redressed);
     }
 }
 public PawnGenerationRequest(PawnKindDef kind, Faction faction = null, PawnGenerationContext context = PawnGenerationContext.NonPlayer, int tile = -1, bool forceGenerateNewPawn = false, bool newborn = false, bool allowDead = false, bool allowDowned = false, bool canGeneratePawnRelations = true, bool mustBeCapableOfViolence = false, float colonistRelationChanceFactor = 1f, bool forceAddFreeWarmLayerIfNeeded = false, bool allowGay = true, bool allowFood = true, bool allowAddictions = true, bool inhabitant = false, bool certainlyBeenInCryptosleep = false, bool forceRedressWorldPawnIfFormerColonist = false, bool worldPawnFactionDoesntMatter = false, float biocodeWeaponChance = 0f, Pawn extraPawnForExtraRelationChance = null, float relationWithExtraPawnChanceFactor = 1f, Predicate <Pawn> validatorPreGear = null, Predicate <Pawn> validatorPostGear = null, IEnumerable <TraitDef> forcedTraits = null, IEnumerable <TraitDef> prohibitedTraits = null, float?minChanceToRedressWorldPawn = null, float?fixedBiologicalAge = null, float?fixedChronologicalAge = null, Gender?fixedGender = null, float?fixedMelanin = null, string fixedLastName = null, string fixedBirthName = null, RoyalTitleDef fixedTitle = null)
 {
     this = default(PawnGenerationRequest);
     if (context == PawnGenerationContext.All)
     {
         Log.Error("Should not generate pawns with context 'All'");
         context = PawnGenerationContext.NonPlayer;
     }
     if (inhabitant && (tile == -1 || Current.Game.FindMap(tile) == null))
     {
         Log.Error("Trying to generate an inhabitant but map is null.");
         inhabitant = false;
     }
     KindDef = kind;
     Context = context;
     Faction = faction;
     Tile    = tile;
     ForceGenerateNewPawn = forceGenerateNewPawn;
     Newborn     = newborn;
     AllowDead   = allowDead;
     AllowDowned = allowDowned;
     CanGeneratePawnRelations      = canGeneratePawnRelations;
     MustBeCapableOfViolence       = mustBeCapableOfViolence;
     ColonistRelationChanceFactor  = colonistRelationChanceFactor;
     ForceAddFreeWarmLayerIfNeeded = forceAddFreeWarmLayerIfNeeded;
     AllowGay                              = allowGay;
     AllowFood                             = allowFood;
     AllowAddictions                       = allowAddictions;
     ForcedTraits                          = forcedTraits;
     ProhibitedTraits                      = prohibitedTraits;
     Inhabitant                            = inhabitant;
     CertainlyBeenInCryptosleep            = certainlyBeenInCryptosleep;
     ForceRedressWorldPawnIfFormerColonist = forceRedressWorldPawnIfFormerColonist;
     WorldPawnFactionDoesntMatter          = worldPawnFactionDoesntMatter;
     ExtraPawnForExtraRelationChance       = extraPawnForExtraRelationChance;
     RelationWithExtraPawnChanceFactor     = relationWithExtraPawnChanceFactor;
     BiocodeWeaponChance                   = biocodeWeaponChance;
     ValidatorPreGear                      = validatorPreGear;
     ValidatorPostGear                     = validatorPostGear;
     MinChanceToRedressWorldPawn           = minChanceToRedressWorldPawn;
     FixedBiologicalAge                    = fixedBiologicalAge;
     FixedChronologicalAge                 = fixedChronologicalAge;
     FixedGender                           = fixedGender;
     FixedMelanin                          = fixedMelanin;
     FixedLastName                         = fixedLastName;
     FixedBirthName                        = fixedBirthName;
     FixedTitle                            = fixedTitle;
 }
        public static string ToStringHuman(this PawnGenerationContext context)
        {
            switch (context)
            {
            case PawnGenerationContext.All:
                return("PawnGenerationContext_All".Translate());

            case PawnGenerationContext.PlayerStarter:
                return("PawnGenerationContext_PlayerStarter".Translate());

            case PawnGenerationContext.NonPlayer:
                return("PawnGenerationContext_NonPlayer".Translate());

            default:
                throw new NotImplementedException();
            }
        }
        protected void DoPawnModifierEditInterface(Rect rect)
        {
            Rect rect2 = rect.TopHalf();
            Rect rect3 = rect2.LeftPart(0.333f).Rounded();
            Rect rect4 = rect2.RightPart(0.666f).Rounded();

            Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect3, "chance".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.TextFieldPercent(rect4, ref this.chance, ref this.chanceBuf, 0f, 1f);
            Rect rect5 = rect.BottomHalf();
            Rect rect6 = rect5.LeftPart(0.333f).Rounded();
            Rect rect7 = rect5.RightPart(0.666f).Rounded();

            Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect6, "context".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            if (Widgets.ButtonText(rect7, this.context.ToStringHuman(), true, false, true))
            {
                List <FloatMenuOption> list       = new List <FloatMenuOption>();
                IEnumerator            enumerator = Enum.GetValues(typeof(PawnGenerationContext)).GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        object obj = enumerator.Current;
                        PawnGenerationContext localCont2 = (PawnGenerationContext)obj;
                        PawnGenerationContext localCont  = localCont2;
                        list.Add(new FloatMenuOption(localCont.ToStringHuman(), delegate()
                        {
                            this.context = localCont;
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
        }
Ejemplo n.º 24
0
 public override void Notify_PawnGenerated(Pawn pawn, PawnGenerationContext context, bool redressed)
 {
     if (pawn.Faction?.IsPlayer ?? false)
     {
         var thing = ThingMaker.MakeThing(thingDef, stuff);
         if (thing is Apparel apparel)
         {
             pawn.apparel.Wear(apparel, false);
         }
         else if (thing.def.equipmentType != EquipmentType.None && thing is ThingWithComps comps)
         {
             pawn.equipment.AddEquipment(comps);
         }
         else if (pawn.inventory.innerContainer.TryAdd(thing, count) != count)
         {
             Debug.LogWarning("Could not give equipment: " + thing);
         }
     }
 }
Ejemplo n.º 25
0
        public sealed override void Notify_NewPawnGenerating(Pawn pawn, PawnGenerationContext coreContext)
        {
            if (!gender.Includes(pawn.gender))
            {
                return;
            }

            if (!Rand.Chance(chance))
            {
                return;
            }

            bool isPlayerFaction = pawn.Faction?.IsPlayer ?? false;
            bool isStartingPawn  = coreContext == PawnGenerationContext.PlayerStarter;

            switch (context)
            {
            case PawnModifierContext.All:
                ModifyNewPawn(pawn, pawn.RaceProps.Humanlike);
                break;

            case PawnModifierContext.Player when isPlayerFaction:
                ModifyNewPawn(pawn, pawn.RaceProps.Humanlike);
                break;

            case PawnModifierContext.NonPlayer when !isPlayerFaction:
                ModifyNewPawn(pawn, pawn.RaceProps.Humanlike);
                break;

            case PawnModifierContext.PlayerStarter when isStartingPawn:
                ModifyNewPawn(pawn, pawn.RaceProps.Humanlike);
                break;

            case PawnModifierContext.PlayerNonStarter when !isStartingPawn && isPlayerFaction:
                ModifyNewPawn(pawn, pawn.RaceProps.Humanlike);
                break;

            case PawnModifierContext.Faction when pawn.Faction.def == faction:
                ModifyNewPawn(pawn, pawn.RaceProps.Humanlike);
                break;
            }
        }
 //Scenario
 public static void Vamp_NewPawnGenerating(Scenario __instance, Pawn pawn, PawnGenerationContext context)
 {
     if (VampireSettings.ShouldUseSettings)
     {
         if (Rand.Chance(VampireSettings.Get.spawnPct) && pawn.RaceProps.Humanlike)
         {
             Hediff hediff = HediffMaker.MakeHediff(VampDefOf.ROM_Vampirism, pawn, null);
             hediff.Severity = 1f;
             pawn.health.AddHediff(hediff, null, null, null);
         }
     }
     else if (VampireSettings.Get.settingsWindowSeen == false)
     {
         if (VampireSettings.Get.mode == GameMode.Disabled)
         {
             VampireSettings.Get.settingsWindowSeen = true;
             VampireSettings.Get.mode = GameMode.Standard;
             VampireSettings.Get.ApplySettings();
         }
     }
 }
Ejemplo n.º 27
0
 public PawnGenerationRequest(PawnKindDef kind, Faction faction = null, PawnGenerationContext context = PawnGenerationContext.NonPlayer, int tile = -1, bool forceGenerateNewPawn = false, bool newborn = false, bool allowDead = false, bool allowDowned = false, bool canGeneratePawnRelations = true, bool mustBeCapableOfViolence = false, float colonistRelationChanceFactor = 1f, bool forceAddFreeWarmLayerIfNeeded = false, bool allowGay = true, bool allowFood = true, bool inhabitant = false, bool certainlyBeenInCryptosleep = false, bool forceRedressWorldPawnIfFormerColonist = false, bool worldPawnFactionDoesntMatter = false, Predicate <Pawn> validatorPreGear = null, Predicate <Pawn> validatorPostGear = null, float?minChanceToRedressWorldPawn = null, float?fixedBiologicalAge = null, float?fixedChronologicalAge = null, Gender?fixedGender = null, float?fixedMelanin = null, string fixedLastName = null)
 {
     this = default(PawnGenerationRequest);
     if (context == PawnGenerationContext.All)
     {
         Log.Error("Should not generate pawns with context 'All'", false);
         context = PawnGenerationContext.NonPlayer;
     }
     if (inhabitant && (tile == -1 || Current.Game.FindMap(tile) == null))
     {
         Log.Error("Trying to generate an inhabitant but map is null.", false);
         inhabitant = false;
     }
     this.KindDef = kind;
     this.Context = context;
     this.Faction = faction;
     this.Tile    = tile;
     this.ForceGenerateNewPawn = forceGenerateNewPawn;
     this.Newborn     = newborn;
     this.AllowDead   = allowDead;
     this.AllowDowned = allowDowned;
     this.CanGeneratePawnRelations      = canGeneratePawnRelations;
     this.MustBeCapableOfViolence       = mustBeCapableOfViolence;
     this.ColonistRelationChanceFactor  = colonistRelationChanceFactor;
     this.ForceAddFreeWarmLayerIfNeeded = forceAddFreeWarmLayerIfNeeded;
     this.AllowGay   = allowGay;
     this.AllowFood  = allowFood;
     this.Inhabitant = inhabitant;
     this.CertainlyBeenInCryptosleep            = certainlyBeenInCryptosleep;
     this.ForceRedressWorldPawnIfFormerColonist = forceRedressWorldPawnIfFormerColonist;
     this.WorldPawnFactionDoesntMatter          = worldPawnFactionDoesntMatter;
     this.ValidatorPreGear            = validatorPreGear;
     this.ValidatorPostGear           = validatorPostGear;
     this.MinChanceToRedressWorldPawn = minChanceToRedressWorldPawn;
     this.FixedBiologicalAge          = fixedBiologicalAge;
     this.FixedChronologicalAge       = fixedChronologicalAge;
     this.FixedGender   = fixedGender;
     this.FixedMelanin  = fixedMelanin;
     this.FixedLastName = fixedLastName;
 }
Ejemplo n.º 28
0
 public static bool OverlapsWith(this PawnGenerationContext a, PawnGenerationContext b)
 {
     return(a == PawnGenerationContext.All || b == PawnGenerationContext.All || a == b);
 }
Ejemplo n.º 29
0
 public override void Randomize()
 {
     chance     = GenMath.RoundedHundredth(Rand.Range(0.05f, 1f));
     context    = PawnGenerationContextUtility.GetRandom();
     hideOffMap = false;
 }
Ejemplo n.º 30
0
        public void Hatch()
        {
            Tools.Warn("hatcheeFaction == null", hatcheeFaction == null && MyDebug);
            Tools.Warn("hatcheeParent == null", hatcheeParent == null && MyDebug);
            Tools.Warn("otherParent == null", otherParent == null && MyDebug);

            PawnGenerationContext pGenContext = PawnGenerationContext.NonPlayer;

            /*
             * bool TryingToSpawnMechanoid = hatcheePawnKind.RaceProps.IsMechanoid;
             * if (TryingToSpawnMechanoid) hatcheeFaction = Faction.OfAncients;
             */

            try
            {
                //PawnGenerationRequest request = new PawnGenerationRequest(
                //    Props.hatcherPawn, hatcheeFaction, PawnGenerationContext.NonPlayer, -1, forceGenerateNewPawn: false, newborn: true);

                /*
                 * public PawnGenerationRequest(
                 *  PawnKindDef kind, Faction faction = null, PawnGenerationContext context = PawnGenerationContext.NonPlayer,
                 *  int tile = -1, bool forceGenerateNewPawn = false, bool newborn = false, bool allowDead = false,
                 *  bool allowDowned = false, bool canGeneratePawnRelations = true, bool mustBeCapableOfViolence = true, float colonistRelationChanceFactor = 1,
                 *  bool forceAddFreeWarmLayerIfNeeded = false, bool allowGay = true, bool allowFood = true, bool allowAddictions = true,
                 *  bool inhabitant = false, bool certainlyBeenInCryptosleep = false, bool forceRedressWorldPawnIfFormerColonist = false, bool worldPawnFactionDoesntMatter = false,
                 *  float biocodeWeaponChance = 0, Pawn extraPawnForExtraRelationChance = null, float relationWithExtraPawnChanceFactor = 1, Predicate<Pawn> validatorPreGear = null,
                 *  Predicate<Pawn> validatorPostGear = null, IEnumerable<TraitDef> forcedTraits = null, IEnumerable<TraitDef> prohibitedTraits = null, float? minChanceToRedressWorldPawn = null,
                 *  float? fixedBiologicalAge = null, float? fixedChronologicalAge = null, Gender? fixedGender = null, float? fixedMelanin = null,
                 *  string fixedLastName = null, string fixedBirthName = null, RoyalTitleDef fixedTitle = null);
                 */

                for (int i = 0; i < parent.stackCount; i++)
                {
                    bool newBorn = Rand.Chance(Props.newBornChance);
                    if (SetPawnKind())
                    {
                        Tools.Warn("SetPawnKind: " + hatcheePawnKind.label, MyDebug);
                    }
                    else
                    {
                        continue;
                    }

                    PawnGenerationRequest request;

                    /*
                     * if (TryingToSpawnMechanoid)
                     * {
                     *  request = new PawnGenerationRequest(
                     *      kind: hatcheePawnKind, faction: hatcheeFaction, context: pGenContext,
                     *      tile: -1, forceGenerateNewPawn: false, newborn: newBorn, allowDead: false,
                     *      allowDowned: false, canGeneratePawnRelations: false, mustBeCapableOfViolence: true, colonistRelationChanceFactor: 0,
                     *      forceAddFreeWarmLayerIfNeeded: false, allowGay: false
                     *      );
                     *   would require to set faction
                     * }
                     * else
                     * {
                     */
                    request = new PawnGenerationRequest(
                        kind: hatcheePawnKind, faction: hatcheeFaction, context: pGenContext, tile: -1,
                        forceGenerateNewPawn: false, newborn: newBorn
                        );

                    Pawn pawn = PawnGenerator.GeneratePawn(request);
                    if (parent.MyTrySpawnHatchedOrBornPawn(pawn))
                    {
                        if (pawn == null)
                        {
                            continue;
                        }

                        if (hatcheeParent != null)
                        {
                            pawn.InheritParentSettings(hatcheeParent, hatcheeFaction);
                            pawn.AddParentRelations(hatcheeParent);
                        }
                        pawn.AddOtherParentRelations(hatcheeParent, otherParent);

                        if (parent.Spawned)
                        {
                            FilthMaker.TryMakeFilth(parent.Position, parent.Map, ThingDefOf.Filth_AmnioticFluid);
                        }

                        if (Rand.Chance(Props.manhunterChance))
                        {
                            pawn.MakeManhunter(MyDebug);
                        }
                    }
                    else
                    {
                        Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard);
                    }
                }
            }
            finally
            {
                parent.Destroy();
            }
        }