private void TryAddMutationsToPawn([NotNull] Pawn original, [CanBeNull] Hediff requestCause, [NotNull] PawnKindDef requestOutputDef) { MorphDef mDef = null; if (requestCause != null) //first check the cause { foreach (MorphDef morphDef in MorphDef.AllDefs) { if (morphDef.fullTransformation == requestCause.def || morphDef.partialTransformation == requestCause.def) { mDef = morphDef; goto applyMutations; //ugly, but it's the easiest solution } } } mDef = MorphUtilities.TryGetBestMorphOfAnimal(requestOutputDef.race); if (mDef == null) { DebugLogUtils.LogMsg(LogLevel.Messages, $"could not apply mutations to {original} with cause {requestCause?.def?.defName ?? "NULL"} and target {requestOutputDef.defName}"); return; } applyMutations: MutationUtilities.AddAllMorphMutations(original, mDef); }
private void AssignMutations(Pawn gordon) { MutationUtilities.AddAllMorphMutations(gordon, MorphDefOfs.SheepMorph, MutationUtilities.AncillaryMutationEffects.None).SetAllToNaturalMax(); }