rimworld-animations-patch_m.../Source/Scripts/Patches/HarmonyPatch_BabiesAndChild...

51 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using HarmonyLib;
using BabiesAndChildren;
using BabiesAndChildren.api;
namespace Rimworld_Animations_Patch
{
// To be revisited if BabiesAndChildren is updated
/*[StaticConstructorOnStartup]
public static class HarmonyPatch_BabiesAndChildren
{
static HarmonyPatch_BabiesAndChildren()
{
try
{
((Action)(() =>
{
if (LoadedModManager.RunningModsListForReading.Any(x => x.PackageIdPlayerFacing == "babies.and.children.continued.13"))
{
(new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(AnimationPatchUtility), "ShouldNotAnimatePawn"),
prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_BabiesAndChildren), "Prefix_ShouldNotAnimatePawn")));
(new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(AnimationPatchUtility), "GetBodySize"),
prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_BabiesAndChildren), "Prefix_GetBodySize")));
}
}))();
}
catch (TypeLoadException) { }
}
public static bool ShouldNotAnimatePawn(ref bool __result, Pawn pawn)
{
__result = AgeStages.IsYoungerThan(pawn, AgeStages.Child, false);
return false;
}
public static bool Prefix_GetBodySize(ref float __result, Pawn pawn)
{
__result = pawn.ShouldBeScaled() ? ChildrenUtility.GetBodySize(pawn) : 1f;
return false;
}
}*/
}