mirror of
				https://github.com/amevarashi/RJW-Sexperience.git
				synced 2024-08-14 23:54:08 +00:00 
			
		
		
		
	Use Prepare instead DoConditionalPatch
This commit is contained in:
		
							parent
							
								
									8d49addd63
								
							
						
					
					
						commit
						9e0a461db3
					
				
					 2 changed files with 2 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -16,7 +16,6 @@ namespace RJWSexperience
 | 
			
		|||
		{
 | 
			
		||||
			var har = new Harmony("RJW_Sexperience");
 | 
			
		||||
			har.PatchAll(Assembly.GetExecutingAssembly());
 | 
			
		||||
			Pawn_GetGizmos.DoConditionalPatch(har);
 | 
			
		||||
 | 
			
		||||
			InjectIntoRjwInteractionServices();
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,27 +1,16 @@
 | 
			
		|||
using HarmonyLib;
 | 
			
		||||
using RJWSexperience.Logs;
 | 
			
		||||
using RJWSexperience.SexHistory;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJWSexperience
 | 
			
		||||
{
 | 
			
		||||
	[HarmonyPatch(typeof(Pawn), nameof(Pawn.GetGizmos))]
 | 
			
		||||
	public static class Pawn_GetGizmos
 | 
			
		||||
	{
 | 
			
		||||
		private static Configurations Settings => SexperienceMod.Settings;
 | 
			
		||||
 | 
			
		||||
		public static void DoConditionalPatch(Harmony harmony)
 | 
			
		||||
		{
 | 
			
		||||
			if (!Settings.EnableSexHistory)
 | 
			
		||||
				return;
 | 
			
		||||
 | 
			
		||||
			MethodInfo original = typeof(Pawn).GetMethod(nameof(Pawn.GetGizmos));
 | 
			
		||||
			MethodInfo postfix = typeof(Pawn_GetGizmos).GetMethod(nameof(Pawn_GetGizmos.Postfix));
 | 
			
		||||
			harmony.Patch(original, postfix: new HarmonyMethod(postfix));
 | 
			
		||||
 | 
			
		||||
			LogManager.GetLogger<DebugLogProvider>(nameof(Pawn_GetGizmos)).Message("Applied conditional patch to Pawn.GetGizmos()");
 | 
			
		||||
		}
 | 
			
		||||
		public static bool Prepare() => Settings.EnableSexHistory;
 | 
			
		||||
 | 
			
		||||
		public static void Postfix(ref IEnumerable<Gizmo> __result, Pawn __instance)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue