isekaiob.OverPoweredMeditation/Source/Isekaiob.OverPoweredMeditation/Postfix_JobDriver_Meditate.cs
2023-06-13 13:35:29 +08:00

36 lines
1.0 KiB
C#

// Isekaiob.OverPoweredMeditation / Isekaiob.OverPoweredMeditation / Postfix_JobDriver_Meditate.cs
// CREATED AT 2023 / 06 / 13
using HarmonyLib;
using RimWorld;
using Verse;
namespace Isekaiob.OverPoweredMeditation
{
public static class PatchBody
{
[HarmonyPatch(typeof(RimWorld.JobDriver_Meditate),"MeditationTick")]
static class Patch_JobDriver_Meditation
{
static void Postfix(JobDriver_Meditate __instance)
{
var p = __instance.pawn;
if (!p.HasPsylink)
{
#if DEBUG
Log.Message($"{p.NameFullColored}Doesn`t have a psylink.");
#endif
return;
}
if (p.needs.rest != null)
{
p.needs.rest.TickResting(p.GetStatValue(StatDefOf.PsychicSensitivity));
#if DEBUG
Log.Message($"{p.NameFullColored}Successfully recovered rest need when meditating");
#endif
return;
}
}
}
}
}