diff --git a/About/About.xml b/About/About.xml
index 9ba606d..e3ccd22 100644
--- a/About/About.xml
+++ b/About/About.xml
@@ -5,5 +5,5 @@
1.0
- Mod Version: 1.3.0\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.3.1\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.
diff --git a/About/Manifest.xml b/About/Manifest.xml
index 09bbe2f..d542542 100644
--- a/About/Manifest.xml
+++ b/About/Manifest.xml
@@ -1,7 +1,7 @@
PawnRules
- 1.3.0
+ 1.3.1
https://raw.githubusercontent.com/Jaxe-Dev/PawnRules/master/About/Manifest.xml
https://github.com/Jaxe-Dev/PawnRules/releases/latest
diff --git a/README.md b/README.md
index b068071..b1c4ec9 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# Pawn Rules
-![Mod Version](https://img.shields.io/badge/Mod_Version-1.3.0-blue.svg)
+![Mod Version](https://img.shields.io/badge/Mod_Version-1.3.1-blue.svg)
![RimWorld Version](https://img.shields.io/badge/Built_for_RimWorld-1.0-blue.svg)
![Harmony Version](https://img.shields.io/badge/Powered_by_Harmony-1.2.0.1-blue.svg)\
![Steam Subscribers](https://img.shields.io/badge/dynamic/xml.svg?label=Steam+Subscribers&query=//table/tr[2]/td[1]&colorB=blue&url=https://steamcommunity.com/sharedfiles/filedetails/%3Fid=1499843448&suffix=+total)
diff --git a/Source/Data/Registry.cs b/Source/Data/Registry.cs
index 5bc4f7f..dd0f7e5 100644
--- a/Source/Data/Registry.cs
+++ b/Source/Data/Registry.cs
@@ -145,7 +145,7 @@ public static void DeletePreset(T preset) where T : Presetable
public static Rules GetDefaultRules(PawnType type) => _instance._defaults[type];
public static void SetDefaultRules(Rules rules) => _instance._defaults[rules.Type] = rules;
- public static T GetAddonDefaultValue(OptionTarget target, AddonOption addon, T invalidValue = default(T))
+ public static T GetAddonDefaultValue(OptionTarget target, AddonOption addon, T invalidValue = default)
{
var rules = GetDefaultRules(PawnType.FromTarget(target));
if ((rules == null) || !addon.AllowedInPreset) { return invalidValue; }
@@ -211,7 +211,7 @@ public static void DeleteRules(Pawn pawn)
public static void FactionUpdate(Thing thing, Faction newFaction, bool? guest = null)
{
- if (!(thing is Pawn pawn) || pawn.Dead) { return; }
+ if (!IsActive || !(thing is Pawn pawn) || pawn.Dead) { return; }
var oldFaction = guest == null ? pawn.Faction : pawn.HostFaction;
PawnType type;
@@ -282,17 +282,13 @@ public override void PostAdd()
InitDefaults();
}
- public override void SpawnSetup()
- { }
+ public override void SpawnSetup() { }
- public override void PostRemove()
- { }
+ public override void PostRemove() { }
- public override void Print(LayerSubMesh subMesh)
- { }
+ public override void Print(LayerSubMesh subMesh) { }
- public override void Draw()
- { }
+ public override void Draw() { }
public override void ExposeData()
{
diff --git a/Source/Mod.cs b/Source/Mod.cs
index 184d27a..2a39192 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.3.0";
+ public const string Version = "1.3.1";
public static readonly DirectoryInfo ConfigDirectory = new DirectoryInfo(Path.Combine(GenFilePaths.ConfigFolderPath, Id));
diff --git a/Source/Patch/Extensions.cs b/Source/Patch/Extensions.cs
index 4647ef6..4b7cbd7 100644
--- a/Source/Patch/Extensions.cs
+++ b/Source/Patch/Extensions.cs
@@ -17,9 +17,10 @@ internal static class Extensions
public static float ToFloat(this string self, float defaultValue = 0f) => float.TryParse(self, out var result) ? result : defaultValue;
public static bool CanHaveRules(this Pawn self) => (self != null) && !self.Dead && (self.GetTargetType() != null);
+
public static PawnType GetTargetType(this Pawn self)
{
- if (self == null) { return null; }
+ if (!Registry.IsActive || (self == null)) { return null; }
if ((self.Faction == Faction.OfPlayer) && self.IsColonist) { return PawnType.Colonist; }
if ((self.Faction == Faction.OfPlayer) && self.RaceProps.Animal) { return PawnType.Animal; }
if (self.HostFaction == Faction.OfPlayer) { return self.IsPrisonerOfColony ? PawnType.Prisoner : PawnType.Guest; }
@@ -72,6 +73,7 @@ public static Rect[] GetHGrid(this Rect self, float padding, params float[] widt
return rects.ToArray();
}
+
public static Rect[] GetVGrid(this Rect self, float padding, params float[] heights)
{
var unfixedCount = 0;