Skip to content

Commit

Permalink
v1.4.2
Browse files Browse the repository at this point in the history
- Harmony fix
  • Loading branch information
Jaxe-Dev committed Mar 2, 2020
1 parent ae174a5 commit 2c2b6b8
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
12 changes: 11 additions & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@
<packageId>Jaxe.PawnRules</packageId>
<name>Pawn Rules</name>
<author>Jaxe</author>
<description>Mod Version: 1.4.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>
<supportedVersions>
<li>1.0</li>
<li>1.1</li>
</supportedVersions>
<description>Mod Version: 1.4.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>
<modDependenciesByVersion>
<v1.1>
<li>
<packageId>brrainz.harmony</packageId>
<displayName>Harmony</displayName>
<steamWorkshopUrl>steam://url/CommunityFilePage/2009463077</steamWorkshopUrl>
<downloadUrl>https://github.com/pardeike/HarmonyRimWorld/releases/latest</downloadUrl>
</li>
</v1.1>
</modDependenciesByVersion>
</ModMetaData>
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.4.1-blue.svg)
![Mod Version](https://img.shields.io/badge/Mod_Version-1.4.2-blue.svg)
![RimWorld Version](https://img.shields.io/badge/Built_for_RimWorld-1.1-blue.svg)
![Harmony Version](https://img.shields.io/badge/Powered_by_Harmony-2.0-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 @@ -12,7 +12,7 @@ internal class Mod : Verse.Mod
{
public const string Id = "PawnRules";
public const string Name = "Pawn Rules";
public const string Version = "1.4.1";
public const string Version = "1.4.2";

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

Expand Down
4 changes: 2 additions & 2 deletions Source/Patch/RimWorld_FoodUtility_WillEat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ namespace PawnRules.Patch
internal static class RimWorld_FoodUtility_WillEat
{
[HarmonyPatch(typeof(FoodUtility), "WillEat", typeof(Pawn), typeof(Thing), typeof(Pawn), typeof(bool))]
public static class ByThing
private static class ByThing
{
private static void Postfix(ref bool __result, Pawn p, Thing food, Pawn getter = null) => ByThingDef.Postfix(ref __result, p, food.def, getter);
public static void Postfix(ref bool __result, Pawn p, Thing food, Pawn getter = null) => ByThingDef.Postfix(ref __result, p, food.def, getter);
}

[HarmonyPatch(typeof(FoodUtility), "WillEat", typeof(Pawn), typeof(ThingDef), typeof(Pawn), typeof(bool))]
Expand Down
19 changes: 14 additions & 5 deletions Source/Patch/Verse_PawnGenerator_GeneratePawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,25 @@

namespace PawnRules.Patch
{
[HarmonyPatch(typeof(PawnGenerator), "GeneratePawn", typeof(PawnKindDef), typeof(Faction))]
internal static class Verse_PawnGenerator_GeneratePawn
{
private static void Postfix(ref Pawn __result)
[HarmonyPatch(typeof(PawnGenerator), "GeneratePawn", typeof(PawnKindDef), typeof(Faction))]
private static class ByRequest
{
if (!Registry.IsActive) { return; }
public static void Postfix(ref Pawn __result)
{
if (!Registry.IsActive) { return; }

if ((__result == null) || ((!__result.Faction?.IsPlayer ?? false) && (!__result.HostFaction?.IsPlayer ?? false))) { return; }
if ((__result == null) || ((!__result.Faction?.IsPlayer ?? true) && (!__result.HostFaction?.IsPlayer ?? true))) { return; }

Registry.GetOrDefaultRules(__result);
Registry.GetOrDefaultRules(__result);
}
}

[HarmonyPatch(typeof(PawnGenerator), "GeneratePawn", typeof(PawnGenerationRequest))]
private static class ByOther
{
public static void Postfix(ref Pawn __result) => ByRequest.Postfix(ref __result);
}
}
}
4 changes: 2 additions & 2 deletions Source/PawnRules.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<NoWarn>1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=2.0.0.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Lib.Harmony.2.0.0.5\lib\net472\0Harmony.dll</HintPath>
<Reference Include="0Harmony, Version=2.0.0.8, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Lib.Harmony.2.0.0.8\lib\net472\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
Expand Down

0 comments on commit 2c2b6b8

Please sign in to comment.