using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("BeltImmunity")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BeltImmunity")]
[assembly: AssemblyTitle("BeltImmunity")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BeltImmunity
{
[BepInPlugin("com.certifired.BeltImmunity", "BeltImmunity", "1.0.2")]
public class BeltImmunityPlugin : BaseUnityPlugin
{
private const string MyGUID = "com.certifired.BeltImmunity";
private const string PluginName = "BeltImmunity";
private const string VersionString = "1.0.2";
private static readonly Harmony Harmony = new Harmony("com.certifired.BeltImmunity");
public static ManualLogSource Log;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogInfo((object)"BeltImmunity v1.0.2 is loading...");
Harmony.PatchAll(typeof(PlayerFirstPersonControllerPatch));
((BaseUnityPlugin)this).Logger.LogInfo((object)"BeltImmunity v1.0.2 loaded - You are now immune to conveyor belt movement!");
}
}
[HarmonyPatch(typeof(PlayerFirstPersonController))]
public static class PlayerFirstPersonControllerPatch
{
private static FieldInfo ridingBeltField;
[HarmonyPatch("CalculateBeltMovement")]
[HarmonyPrefix]
private static bool SetRidingBeltFalse(PlayerFirstPersonController __instance)
{
if (ridingBeltField == null)
{
ridingBeltField = typeof(PlayerFirstPersonController).GetField("ridingBelt", BindingFlags.Instance | BindingFlags.NonPublic);
}
if (ridingBeltField != null)
{
ridingBeltField.SetValue(__instance, false);
}
return false;
}
}
}