diff --git a/About/About.xml b/About/About.xml index ae95070..af4dc97 100644 --- a/About/About.xml +++ b/About/About.xml @@ -4,6 +4,6 @@ Pawn Rules Jaxe 0.19.0 - Mod Version: 1.1.4\n\n\nPawn Rules is a mod that allows custom rules to be assigned individually to your colonists, animals, guests and prisoners.\n\nCurrently the following rules can be applied:\n\n- Disallow certain foods\n- Disallow bonding with certain animals\n- Disallow new romances\n- Disallow constructing items that have a quality level\n\nAny of these rules can be disabled and hidden from the rules window. Rules presets and defaults can be imported and exported between games. + Mod Version: 1.1.5\n\n\nPawn Rules is a mod that allows custom rules to be assigned individually to your colonists, animals, guests and prisoners.\n\nCurrently the following rules can be applied:\n\n- Disallow certain foods\n- Disallow bonding with certain animals\n- Disallow new romances\n- Disallow constructing items that have a quality level\n\nAny of these rules can be disabled and hidden from the rules window. Rules presets and defaults can be imported and exported between games. https://github.com/Jaxe-Dev/PawnRules diff --git a/About/ModSync.xml b/About/ModSync.xml index 60c9642..505a247 100644 --- a/About/ModSync.xml +++ b/About/ModSync.xml @@ -3,7 +3,7 @@ 59f538ed-f86d-4506-a4a5-7e9faaa37508 Pawn Rules - v1.1.4 + v1.1.5 False Jaxe-Dev diff --git a/About/Preview.png b/About/Preview.png index d804fd5..20ac2a6 100644 Binary files a/About/Preview.png and b/About/Preview.png differ diff --git a/README.md b/README.md index 5c6ebf5..e8e4c6f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Pawn Rules -![](https://img.shields.io/badge/Mod_Version-1.1.4-blue.svg) +![](https://img.shields.io/badge/Mod_Version-1.1.5-blue.svg) ![](https://img.shields.io/badge/Built_for_RimWorld-B19-blue.svg) ![](https://img.shields.io/badge/Powered_by_Harmony-1.2.0.1-blue.svg) diff --git a/Source/Data/Registry.cs b/Source/Data/Registry.cs index fd5b123..76fbb0b 100644 --- a/Source/Data/Registry.cs +++ b/Source/Data/Registry.cs @@ -17,7 +17,7 @@ internal class Registry : WorldObject private const string WorldObjectDefName = "PawnRules_Registry"; private const string CurrentVersion = "v" + Mod.Version; - public static bool IsActive => !_isDeactivating && (_instance != null) && (Find.GameInitData.playerFaction != null); + public static bool IsActive => !_isDeactivating && (_instance != null) && (Current.ProgramState == ProgramState.Playing); private static Registry _instance; diff --git a/Source/Integration/RimHUD.cs b/Source/Integration/RimHUD.cs index 3bfc08f..a5fbcec 100644 --- a/Source/Integration/RimHUD.cs +++ b/Source/Integration/RimHUD.cs @@ -14,8 +14,7 @@ public static string GetRulesInfo(Pawn pawn) var rules = Registry.GetRules(pawn); if (rules == null) { return null; } - var name = rules.IsPreset ? rules.Name : Lang.Get("Preset.Personalized"); - return name; + return rules.IsPreset ? rules.Name : Lang.Get("Preset.Personalized"); } } } diff --git a/Source/Mod.cs b/Source/Mod.cs index 5875d28..b189563 100644 --- a/Source/Mod.cs +++ b/Source/Mod.cs @@ -13,7 +13,7 @@ internal class Mod : Verse.Mod { public const string Id = "PawnRules"; public const string Name = "Pawn Rules"; - public const string Version = "1.1.4"; + public const string Version = "1.1.5"; public static readonly DirectoryInfo ConfigDirectory = new DirectoryInfo(Path.Combine(GenFilePaths.ConfigFolderPath, Id)); diff --git a/Source/Patch/RimWorld_GenConstruct_CanConstruct.cs b/Source/Patch/RimWorld_GenConstruct_CanConstruct.cs index 2d1b826..ece291e 100644 --- a/Source/Patch/RimWorld_GenConstruct_CanConstruct.cs +++ b/Source/Patch/RimWorld_GenConstruct_CanConstruct.cs @@ -14,7 +14,9 @@ private static void Postfix(ref bool __result, Thing t, Pawn p, bool checkConstr if (!Registry.IsActive || (__result == false)) { return; } var rules = Registry.GetRules(p); - if ((rules == null) || rules.AllowArtisan || !checkConstructionSkill || !((ThingDef) t.def.entityDefToBuild).HasComp(typeof(CompQuality))) { return; } + if ((rules == null) || rules.AllowArtisan || !checkConstructionSkill) { return; } + + if (!(t.def.entityDefToBuild is ThingDef thingDef) || !thingDef.HasComp(typeof(CompQuality))) { return; } if (forced && !JobFailReason.HaveReason && !rules.AllowArtisan) { JobFailReason.Is(Lang.Get("Rules.NotArtisanReason"), Lang.Get("Rules.NotArtisanJob", t.LabelCap)); }