Exemple #1
0
 /// <summary>
 /// Applies the post tf effects.
 /// this should be called just before the original pawn is cleaned up
 /// </summary>
 /// <param name="original">The original.</param>
 /// <param name="transformedPawn">The transformed pawn.</param>
 protected override void ApplyPostTfEffects(Pawn original, Pawn transformedPawn, TransformationRequest request)
 {
     //apply apparel damage
     ApplyApparelDamage(original, transformedPawn.def);
     FormerHumanUtilities.TryAssignBackstoryToTransformedPawn(transformedPawn, original);
     base.ApplyPostTfEffects(original, transformedPawn, request);
 }
        /// <summary>Adds the hediff if not permanently feral.</summary>
        /// <param name="pawn">The pawn.</param>
        /// <param name="hediff">The hediff.</param>
        public static void AddHediffIfNotPermanentlyFeral(Pawn pawn, HediffDef hediff)
        {
            if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("PermanentlyFeral")) && !pawn.health.hediffSet.HasHediff(hediff))
            // If a pawn does not have the PermanentlyFeral hediff nor the provided hediff...
            {
                Hediff xhediff = HediffMaker.MakeHediff(hediff, pawn);     // ...create an initialized version of the provided hediff...
                xhediff.Severity = Rand.Range(0.00f, 1.00f);               // ...set it to a random severity...
                pawn.health.AddHediff(xhediff);                            // ...then apply it..
                PawnComponentsUtility.AddAndRemoveDynamicComponents(pawn); //make sure they have all the dynamic comps they need

                //make sure it has a name
                if (pawn.Name == null)
                {
                    pawn.Name = new NameSingle(pawn.LabelShort);
                }

                FormerHumanUtilities.TryAssignBackstoryToTransformedPawn(pawn, null); //try to assign them a background if they're sapient
            }
        }