Skip to content

Commit

Permalink
v1.3.2
Browse files Browse the repository at this point in the history
- Minor fixes
  • Loading branch information
Jaxe-Wilde committed Nov 6, 2019
1 parent 9a01e23 commit 263cd0c
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<supportedVersions>
<li>1.0</li>
</supportedVersions>
<description>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.</description>
<description>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.</description>
</ModMetaData>
2 changes: 1 addition & 1 deletion About/Manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>PawnRules</identifier>
<version>1.3.1</version>
<version>1.3.2</version>
<manifestUri>https://raw.githubusercontent.com/Jaxe-Dev/PawnRules/master/About/Manifest.xml</manifestUri>
<downloadUri>https://github.com/Jaxe-Dev/PawnRules/releases/latest</downloadUri>
</Manifest>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 3 additions & 3 deletions Source/Data/Registry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
8 changes: 3 additions & 5 deletions Source/Patch/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using PawnRules.Data;
using RimWorld;
using UnityEngine;
using Verse;

Expand All @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Patch/Verse_PawnGenerator_GeneratePawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 263cd0c

Please sign in to comment.