diff --git a/About/About.xml b/About/About.xml
index 66cdcba..bb77cb7 100644
--- a/About/About.xml
+++ b/About/About.xml
@@ -3,7 +3,7 @@
Level Up!
krafs
Krafs.LevelUp
- 5.1.0
+ 5.1.1
Level up notifications!
https://github.com/krafs/LevelUp
LevelUp/Icon
diff --git a/LevelUp.csproj b/LevelUp.csproj
index 1af6968..b5fbfb9 100644
--- a/LevelUp.csproj
+++ b/LevelUp.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/Source/ActionMaker.cs b/Source/ActionMaker.cs
index 142bb19..9ca8764 100644
--- a/Source/ActionMaker.cs
+++ b/Source/ActionMaker.cs
@@ -13,11 +13,6 @@ public sealed class ActionMaker : IExposable
internal void ExecuteActions(LevelingInfo levelingInfo)
{
- if (!levelingInfo.Pawn.IsFreeColonist)
- {
- return;
- }
-
foreach (LevelingAction action in actions)
{
if (action.active)
diff --git a/Source/Patcher.cs b/Source/Patcher.cs
index 49e3360..86000c8 100644
--- a/Source/Patcher.cs
+++ b/Source/Patcher.cs
@@ -30,14 +30,25 @@ internal static void ApplyPatches(Harmony harmony)
}
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Harmony naming convention")]
- private static void Prefix(out int __state, SkillRecord __instance)
+ private static void Prefix(out int __state, SkillRecord __instance, Pawn ___pawn)
{
+ if (!___pawn.IsFreeColonist)
+ {
+ __state = -1;
+ return;
+ }
+
__state = __instance.Level;
}
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Harmony naming convention")]
private static void DirtyAptitudesPostfix(int __state, SkillRecord __instance, Pawn ___pawn)
{
+ if (__state == -1)
+ {
+ return;
+ }
+
// DirtyAptitudes can be called on the Create Character-screen if Biotech is used,
// and either crashes or makes it impossible to move forward.
// 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
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Harmony naming convention")]
private static void LearnPostfix(int __state, SkillRecord __instance, Pawn ___pawn, bool direct)
{
+ if (__state == -1)
+ {
+ return;
+ }
+
int previousLevel = __state;
int currentLevel = __instance.Level;