forked from Jaxe-Dev/PawnRules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Rules button to Health Overview, closes Jaxe-Dev#5
- Loading branch information
Showing
3 changed files
with
32 additions
and
19 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
Source/Patch/RimWorld_HealthCardUtility_DrawOverviewTab.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using HarmonyLib; | ||
using PawnRules.Data; | ||
using PawnRules.Interface; | ||
using RimWorld; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using Verse; | ||
|
||
namespace PawnRules.Patch | ||
{ | ||
[HarmonyPatch(typeof(HealthCardUtility), "DrawOverviewTab")] | ||
internal static class RimWorld_HealthCardUtility_DrawOverviewTab | ||
{ | ||
private static void Postfix(ref float __result, UnityEngine.Rect leftRect, Pawn pawn, float curY) | ||
{ | ||
if (!Registry.IsActive) { return; } | ||
|
||
FloatMenu overviewWindowStack = Find.WindowStack.FloatMenu; | ||
|
||
if (overviewWindowStack == null) { return; } | ||
|
||
List<FloatMenuOption> overviewWindowStackOptions = (List<FloatMenuOption>) typeof(FloatMenu).GetField("options", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(overviewWindowStack); | ||
if (overviewWindowStackOptions?.Count > 0 && overviewWindowStackOptions.Last().Label.Equals("ManageFoodRestrictions".Translate())) | ||
{ | ||
overviewWindowStack.Close(false); | ||
Dialog_Rules.Open(pawn); | ||
} | ||
} | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
Source/Patch/RimWorld_Pawn_FoodRestrictionTracker_Configurable.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters