public static void ExposePsycheData(EdB.PrepareCarefully.SaveRecordPawnV4 __instance)
 {
     if (customPawns.Keys.Contains(__instance.id) && Scribe.mode == LoadSaveMode.Saving)
     {
         EdB.PrepareCarefully.CustomPawn pawn = customPawns[__instance.id] as EdB.PrepareCarefully.CustomPawn;
         if (PsycheHelper.PsychologyEnabled(pawn.Pawn))
         {
             PrepareCarefully.SaveRecordPsycheV4 psycheSave = new PrepareCarefully.SaveRecordPsycheV4(pawn.Pawn);
             psycheSave.ExposeData();
         }
     }
     else if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         PrepareCarefully.SaveRecordPsycheV4 psycheSave = new PrepareCarefully.SaveRecordPsycheV4();
         psycheSave.ExposeData();
         savedPawns.Add(__instance, psycheSave);
     }
 }
Example #2
0
 public static void AddPsyche(ref EdB.PrepareCarefully.CustomPawn __result, EdB.PrepareCarefully.SaveRecordPawnV4 record)
 {
     if (SaveRecordPawnV4Patch.savedPawns.Keys.Contains(record))
     {
         Pawn pawn = __result.Pawn;
         if (pawn != null && PsycheHelper.PsychologyEnabled(pawn))
         {
             PrepareCarefully.SaveRecordPsycheV4 psycheSave = SaveRecordPawnV4Patch.savedPawns[record];
             PsycheHelper.Comp(pawn).Psyche.upbringing = psycheSave.upbringing;
             foreach (PersonalityNode node in PsycheHelper.Comp(pawn).Psyche.PersonalityNodes)
             {
                 PersonalityNode savedNode = psycheSave.NodeDict[node.def];
                 if (savedNode != null)
                 {
                     node.rawRating = savedNode.rawRating;
                 }
             }
             PsycheHelper.Comp(pawn).Sexuality.sexDrive      = psycheSave.sexDrive;
             PsycheHelper.Comp(pawn).Sexuality.romanticDrive = psycheSave.romanticDrive;
             PsycheHelper.Comp(pawn).Sexuality.kinseyRating  = psycheSave.kinseyRating;
         }
     }
 }