first commit

This commit is contained in:
2025-07-06 00:23:46 +02:00
commit 38f50c8819
1788 changed files with 112878 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using HarmonyLib;
using NitroxClient.GameLogic;
using NitroxClient.MonoBehaviours;
using NitroxModel.Helper;
namespace NitroxPatcher.Patches.Dynamic;
public sealed partial class Player_TriggerInfectionRevealAsync_Patch : NitroxPatch, IDynamicPatch
{
private static readonly MethodInfo TARGET_METHOD = AccessTools.EnumeratorMoveNext(Reflect.Method((Player t) => t.TriggerInfectionRevealAsync()));
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
/*
From:
if (!this.infectionRevealed){
float num = this.armsController.StartHolsterTime(12f);
To:
if (!this.infectionRevealed){
SendInfectAnimationStartPacket();
float num = this.armsController.StartHolsterTime(12f);
*/
return new CodeMatcher(instructions).MatchStartForward(
new CodeMatch(OpCodes.Ldloc_1),
new CodeMatch(OpCodes.Ldfld),
new CodeMatch(OpCodes.Ldc_R4),
new CodeMatch(OpCodes.Callvirt, Reflect.Method((ArmsController arms) => arms.StartHolsterTime(default)))
)
.Insert(
new CodeInstruction(OpCodes.Call, Reflect.Method(() => SendInfectAnimationStartPacket()))
)
.InstructionEnumeration();
}
private static void SendInfectAnimationStartPacket()
{
Log.Debug("Infection animation started");
Resolve<LocalPlayer>().AnimationChange(AnimChangeType.INFECTION_REVEAL, AnimChangeState.ON);
}
}