From 263cd0c029833e577d659da925874eedf641be9c Mon Sep 17 00:00:00 2001 From: Jaxe <44151792+Jaxe-Wilde@users.noreply.github.com> Date: Wed, 6 Nov 2019 16:44:38 +0800 Subject: [PATCH] v1.3.2 - Minor fixes --- About/About.xml | 2 +- About/Manifest.xml | 2 +- README.md | 2 +- Source/Data/Registry.cs | 6 +++--- Source/Mod.cs | 2 +- Source/Patch/Extensions.cs | 8 +++----- .../RimWorld_PawnUtility_TrySpawnHatchedOrBornPawn.cs | 2 +- Source/Patch/Verse_PawnGenerator_GeneratePawn.cs | 2 +- 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/About/About.xml b/About/About.xml index e3ccd22..66f1e57 100644 --- a/About/About.xml +++ b/About/About.xml @@ -5,5 +5,5 @@
  • 1.0
  • - 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. + Mod Version: 1.3.2\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 d542542..443bbef 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@ PawnRules - 1.3.1 + 1.3.2 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 b1c4ec9..b738a0b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Pawn Rules -![Mod Version](https://img.shields.io/badge/Mod_Version-1.3.1-blue.svg) +![Mod Version](https://img.shields.io/badge/Mod_Version-1.3.2-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 dd0f7e5..36813a2 100644 --- a/Source/Data/Registry.cs +++ b/Source/Data/Registry.cs @@ -216,12 +216,12 @@ public static void FactionUpdate(Thing thing, Faction newFaction, bool? guest = var oldFaction = guest == null ? pawn.Faction : pawn.HostFaction; PawnType type; - if (newFaction == Faction.OfPlayer) + if (newFaction.IsPlayer) { - if ((guest == null) || (pawn.Faction == Faction.OfPlayer)) { type = pawn.RaceProps.Animal ? PawnType.Animal : PawnType.Colonist; } + if ((guest == null) || pawn.Faction.IsPlayer) { type = pawn.RaceProps.Animal ? PawnType.Animal : PawnType.Colonist; } else { type = guest.Value ? PawnType.Guest : PawnType.Prisoner; } } - else if ((oldFaction == Faction.OfPlayer) && (newFaction != null)) + else if (oldFaction.IsPlayer) { DeleteRules(pawn); return; diff --git a/Source/Mod.cs b/Source/Mod.cs index 2a39192..f650c2a 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.1"; + public const string Version = "1.3.2"; 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 4b7cbd7..c14790d 100644 --- a/Source/Patch/Extensions.cs +++ b/Source/Patch/Extensions.cs @@ -1,7 +1,6 @@ using System.Collections; using System.Collections.Generic; using PawnRules.Data; -using RimWorld; using UnityEngine; using Verse; @@ -20,10 +19,9 @@ internal static class Extensions public static PawnType GetTargetType(this Pawn self) { - 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; } + if (self.Faction.IsPlayer && self.IsColonist) { return PawnType.Colonist; } + if (self.Faction.IsPlayer && self.RaceProps.Animal) { return PawnType.Animal; } + if (self.HostFaction.IsPlayer) { return self.IsPrisonerOfColony ? PawnType.Prisoner : PawnType.Guest; } return null; } diff --git a/Source/Patch/RimWorld_PawnUtility_TrySpawnHatchedOrBornPawn.cs b/Source/Patch/RimWorld_PawnUtility_TrySpawnHatchedOrBornPawn.cs index 8116fab..af06dc3 100644 --- a/Source/Patch/RimWorld_PawnUtility_TrySpawnHatchedOrBornPawn.cs +++ b/Source/Patch/RimWorld_PawnUtility_TrySpawnHatchedOrBornPawn.cs @@ -10,7 +10,7 @@ internal static class RimWorld_PawnUtility_TrySpawnHatchedOrBornPawn { private static void Postfix(bool __result, Pawn pawn, Thing motherOrEgg) { - if (!Registry.IsActive || !__result || (pawn == null) || !(motherOrEgg is Pawn mother) || (mother.Faction != Faction.OfPlayer)) { return; } + if (!Registry.IsActive || !__result || (pawn == null) || !(motherOrEgg is Pawn mother) || (!mother.Faction.IsPlayer)) { return; } Registry.CloneRules(mother, pawn); } } diff --git a/Source/Patch/Verse_PawnGenerator_GeneratePawn.cs b/Source/Patch/Verse_PawnGenerator_GeneratePawn.cs index 8633021..eb514cc 100644 --- a/Source/Patch/Verse_PawnGenerator_GeneratePawn.cs +++ b/Source/Patch/Verse_PawnGenerator_GeneratePawn.cs @@ -12,7 +12,7 @@ private static void Postfix(ref Pawn __result) { if (!Registry.IsActive) { return; } - if ((__result == null) || ((__result.Faction != Faction.OfPlayer) && (__result.HostFaction != Faction.OfPlayer))) { return; } + if ((__result == null) || ((!__result.Faction.IsPlayer) && (!__result.HostFaction.IsPlayer))) { return; } Registry.GetOrDefaultRules(__result); }