From a495dac7f98ffb6ee07dd971e7f71f6e0bea0f87 Mon Sep 17 00:00:00 2001
From: Jaxe-Dev <42095078+Jaxe-Dev@users.noreply.github.com>
Date: Tue, 20 Nov 2018 00:18:35 +0800
Subject: [PATCH] v1.2.5
- Fixed 'Allow any food when training'
---
About/About.xml | 2 +-
About/Manifest.xml | 2 +-
README.md | 2 +-
Source/Mod.cs | 2 +-
Source/Patch/RimWorld_FoodUtility_WillEat.cs | 6 +++++-
5 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/About/About.xml b/About/About.xml
index 5f9e809..8a4d4af 100644
--- a/About/About.xml
+++ b/About/About.xml
@@ -4,5 +4,5 @@
Pawn Rules
Jaxe
1.0.0
- Mod Version: 1.2.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.2.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.
diff --git a/About/Manifest.xml b/About/Manifest.xml
index 72faf97..507c6ec 100644
--- a/About/Manifest.xml
+++ b/About/Manifest.xml
@@ -2,7 +2,7 @@
PawnRules
- 1.2.4
+ 1.2.5
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 b47f681..8582c56 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# Pawn Rules
-![Mod Version](https://img.shields.io/badge/Mod_Version-1.2.4-blue.svg)
+![Mod Version](https://img.shields.io/badge/Mod_Version-1.2.5-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/Mod.cs b/Source/Mod.cs
index 7404a94..2d71392 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.2.4";
+ public const string Version = "1.2.5";
public static readonly DirectoryInfo ConfigDirectory = new DirectoryInfo(Path.Combine(GenFilePaths.ConfigFolderPath, Id));
diff --git a/Source/Patch/RimWorld_FoodUtility_WillEat.cs b/Source/Patch/RimWorld_FoodUtility_WillEat.cs
index e4d7b1a..e158c5c 100644
--- a/Source/Patch/RimWorld_FoodUtility_WillEat.cs
+++ b/Source/Patch/RimWorld_FoodUtility_WillEat.cs
@@ -20,6 +20,10 @@ public static void Postfix(ref bool __result, Pawn p, ThingDef food, Pawn getter
{
if (!Registry.IsActive) { return; }
+ if (Registry.ExemptedTrainer == getter) { return; }
+
+ if (Registry.AllowTrainingFood && (getter?.CurJobDef != null) && ((getter.CurJobDef == JobDefOf.Tame) || (getter.CurJobDef == JobDefOf.Train))) { return; }
+
if (!p.RaceProps.CanEverEat(food))
{
__result = false;
@@ -29,7 +33,7 @@ public static void Postfix(ref bool __result, Pawn p, ThingDef food, Pawn getter
var restriction = p.GetRules()?.GetRestriction(RestrictionType.Food);
if (p.InMentalState || (restriction == null) || restriction.IsVoid) { return; }
- __result = restriction.AllowsFood(food, p) || ((Registry.ExemptedTrainer == getter) && (food.IsWithinCategory(ThingCategoryDefOf.Foods) || food.IsWithinCategory(ThingCategoryDefOf.Corpses)));
+ __result = restriction.AllowsFood(food, p);
}
}
}