Skip to content

Commit

Permalink
v1.2.5
Browse files Browse the repository at this point in the history
- Fixed 'Allow any food when training'
  • Loading branch information
Jaxe-Dev committed Nov 19, 2018
1 parent f35273b commit a495dac
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<name>Pawn Rules</name>
<author>Jaxe</author>
<targetVersion>1.0.0</targetVersion>
<description>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.</description>
<description>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.</description>
</ModMetaData>
2 changes: 1 addition & 1 deletion About/Manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<Manifest>
<identifier>PawnRules</identifier>
<version>1.2.4</version>
<version>1.2.5</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.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)
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.2.4";
public const string Version = "1.2.5";

public static readonly DirectoryInfo ConfigDirectory = new DirectoryInfo(Path.Combine(GenFilePaths.ConfigFolderPath, Id));

Expand Down
6 changes: 5 additions & 1 deletion Source/Patch/RimWorld_FoodUtility_WillEat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
}
}
Expand Down

0 comments on commit a495dac

Please sign in to comment.