@@ -30,14 +30,25 @@ internal static void ApplyPatches(Harmony harmony)
3030 }
3131
3232 [ SuppressMessage ( "Style" , "IDE1006:Naming Styles" , Justification = "Harmony naming convention" ) ]
33- private static void Prefix ( out int __state , SkillRecord __instance )
33+ private static void Prefix ( out int __state , SkillRecord __instance , Pawn ___pawn )
3434 {
35+ if ( ! ___pawn . IsFreeColonist )
36+ {
37+ __state = - 1 ;
38+ return ;
39+ }
40+
3541 __state = __instance . Level ;
3642 }
3743
3844 [ SuppressMessage ( "Style" , "IDE1006:Naming Styles" , Justification = "Harmony naming convention" ) ]
3945 private static void DirtyAptitudesPostfix ( int __state , SkillRecord __instance , Pawn ___pawn )
4046 {
47+ if ( __state == - 1 )
48+ {
49+ return ;
50+ }
51+
4152 // DirtyAptitudes can be called on the Create Character-screen if Biotech is used,
4253 // and either crashes or makes it impossible to move forward.
4354 // This causes the mod to try and display notifications for a colonist when not yet in a playable program state.
@@ -66,6 +77,11 @@ private static void DirtyAptitudesPostfix(int __state, SkillRecord __instance, P
6677 [ SuppressMessage ( "Style" , "IDE1006:Naming Styles" , Justification = "Harmony naming convention" ) ]
6778 private static void LearnPostfix ( int __state , SkillRecord __instance , Pawn ___pawn , bool direct )
6879 {
80+ if ( __state == - 1 )
81+ {
82+ return ;
83+ }
84+
6985 int previousLevel = __state ;
7086 int currentLevel = __instance . Level ;
7187
0 commit comments