mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
Changed from rerouting the job to another for joininbed to simply patching joininbed, code tidying
This commit is contained in:
parent
8177b95bc8
commit
702964a8c2
24 changed files with 143 additions and 774 deletions
|
@ -0,0 +1,41 @@
|
|||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations
|
||||
{
|
||||
[HarmonyPatch(typeof(PawnRenderer), "RenderPawnAt")]
|
||||
public static class PawnRenderer_RenderPawnAt_Patch
|
||||
{
|
||||
static bool ClearCache(Pawn pawn)
|
||||
{
|
||||
return pawn.IsInvisible() || pawn.TryGetComp<CompBodyAnimator>().isAnimating;
|
||||
}
|
||||
|
||||
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
var list = instructions.ToList();
|
||||
|
||||
foreach (CodeInstruction i in instructions)
|
||||
{
|
||||
if (i.OperandIs(AccessTools.Method(typeof(PawnUtility), "IsInvisible")))
|
||||
{
|
||||
|
||||
yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(PawnRenderer_RenderPawnAt_Patch), "ClearCache"));
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue