using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Agents;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using Player;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("NoInterruptions")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+git5346556-dirty-master.534655604aba92ef19e630daff318e2a61da7668")]
[assembly: AssemblyProduct("NoInterruptions")]
[assembly: AssemblyTitle("NoInterruptions")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace NoInterruptions
{
[HarmonyPatch]
internal static class InteractionPatch
{
private static Interact_Timed? _cachedPack;
private static Interact_Timed? _cachedInteract;
private static RaycastHit _rayHitInfo;
[HarmonyPatch(typeof(Interact_Timed), "CheckSoundPlayer")]
[HarmonyWrapSafe]
[HarmonyPrefix]
private static bool Post_CheckSoundPlayer(Interact_Timed __instance)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
if (__instance.m_sound == null && (Object)(object)((Component)__instance).transform == (Object)null)
{
__instance.m_sound = new CellSoundPlayer(((Component)PlayerManager.GetLocalPlayerAgent()).transform.position);
return false;
}
return true;
}
[HarmonyPatch(typeof(PlayerInteraction), "FixedUpdate")]
[HarmonyPrefix]
private static void Pre_FixedUpdate(PlayerInteraction __instance)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Invalid comparison between Unknown and I4
if ((Object)(object)_cachedPack == (Object)null)
{
ItemEquippable wieldedItem = ((PlayerAgent)__instance.m_owner).Inventory.WieldedItem;
if (wieldedItem != null && (int)wieldedItem.AmmoType == 3)
{
_cachedPack = (Interact_Timed?)(object)((Il2CppObjectBase)((PlayerAgent)__instance.m_owner).Inventory.WieldedItem).TryCast<ResourcePackFirstPerson>().m_interactApplyResource;
}
}
if ((Object)(object)_cachedPack != (Object)null && _cachedPack.TimerIsActive)
{
_cachedInteract = null;
PlayerInteraction.CameraRayInteractionEnabled = false;
PlayerInteraction.SphereCheckInteractionEnabled = false;
PlayerInteraction.LadderInteractionEnabled = false;
return;
}
IInteractable bestSelectedInteract = __instance.m_bestSelectedInteract;
_cachedInteract = ((bestSelectedInteract != null) ? ((Il2CppObjectBase)bestSelectedInteract).TryCast<Interact_Timed>() : null);
if ((Object)(object)_cachedInteract != (Object)null)
{
ItemEquippable wieldedItem2 = ((PlayerAgent)__instance.m_owner).Inventory.WieldedItem;
if (wieldedItem2 != null && wieldedItem2.AllowPlayerInteraction && InteractIsActive(__instance))
{
PlayerInteraction.CameraRayInteractionEnabled = false;
PlayerInteraction.SphereCheckInteractionEnabled = false;
PlayerInteraction.LadderInteractionEnabled = false;
return;
}
}
_cachedInteract = null;
PlayerInteraction.CameraRayInteractionEnabled = true;
PlayerInteraction.SphereCheckInteractionEnabled = true;
PlayerInteraction.LadderInteractionEnabled = true;
}
[HarmonyPatch(typeof(PlayerInteraction), "FixedUpdate")]
[HarmonyPostfix]
private static void Post_FixedUpdate(PlayerInteraction __instance)
{
__instance.m_bestInteractInCurrentSearch = (Interact_Base)(object)_cachedInteract;
}
private static bool InteractIsActive(PlayerInteraction __instance)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_cachedInteract == (Object)null || !_cachedInteract.TimerIsActive)
{
return false;
}
if (!((Interact_Base)_cachedInteract).IsActive || !((Interact_Base)_cachedInteract).PlayerCanInteract((PlayerAgent)(object)__instance.m_owner))
{
return false;
}
Vector3 camPos = __instance.m_owner.CamPos;
float num = __instance.m_searchRadius + Mathf.Min(Mathf.Abs(((Agent)__instance.m_owner).TargetLookDir.y), 0.5f);
float num2 = num * num;
bool flag = false;
foreach (Collider componentsInChild in ((Component)_cachedInteract).gameObject.GetComponentsInChildren<Collider>())
{
if (Vector3.SqrMagnitude(((Component)componentsInChild).transform.position - camPos) <= num2)
{
flag = true;
break;
}
}
Vector3 position = ((Component)_cachedInteract).transform.position;
Vector3 val = position - camPos;
if (val.y < 2f)
{
val.y = 0f;
}
if (((Vector3)(ref val)).sqrMagnitude <= __instance.m_proximityRadius * __instance.m_proximityRadius)
{
__instance.AddToProximity((Interact_Base)(object)_cachedInteract);
}
else
{
__instance.RemoveFromProximity((Interact_Base)(object)_cachedInteract);
}
if (!flag)
{
return false;
}
FPSCamera fPSCamera = ((PlayerAgent)__instance.m_owner).FPSCamera;
if ((Object)(object)fPSCamera.CameraRayObject == (Object)(object)((Component)_cachedInteract).gameObject)
{
return true;
}
if (Physics.Raycast(fPSCamera.m_camRay, ref _rayHitInfo, num, LayerManager.MASK_PLAYER_INTERACT_SPHERE) && (Object)(object)((Component)((RaycastHit)(ref _rayHitInfo)).collider).gameObject == (Object)(object)((Component)_cachedInteract).gameObject)
{
return true;
}
if (((Interact_Base)_cachedInteract).OnlyActiveWhenLookingStraightAt)
{
return false;
}
Vector3 val2 = ((CameraController)fPSCamera).m_camera.WorldToScreenPoint(position);
if (val2.z <= 0f || !GuiManager.IsOnScreen(val2))
{
return false;
}
if (((Interact_Base)_cachedInteract).RequireCollisionCheck && Physics.Raycast(camPos, ((Vector3)(ref val)).normalized, ref _rayHitInfo, ((Vector3)(ref val)).magnitude, LayerManager.MASK_PLAYER_INTERACT_SPHERE))
{
return (Object)(object)((Component)((RaycastHit)(ref _rayHitInfo)).collider).gameObject == (Object)(object)((Component)_cachedInteract).gameObject;
}
return true;
}
}
[HarmonyPatch(typeof(LG_ComputerTerminal))]
internal static class TerminalPatch
{
[CompilerGenerated]
private sealed class <DelayedFixState>d__1 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public LG_ComputerTerminal terminal;
private float <endTime>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayedFixState>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Invalid comparison between Unknown and I4
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Invalid comparison between Unknown and I4
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<endTime>5__2 = Clock.Time + 0.5f;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
goto IL_0077;
case 2:
<>1__state = -1;
goto IL_0077;
case 3:
{
<>1__state = -1;
break;
}
IL_0077:
if (Clock.Time < <endTime>5__2)
{
if ((int)terminal.CurrentStateName != 2)
{
return false;
}
<>2__current = null;
<>1__state = 2;
return true;
}
break;
}
if ((int)terminal.CurrentStateName == 2)
{
AttemptFixState(terminal);
<>2__current = null;
<>1__state = 3;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[HarmonyPatch("SyncChangeState")]
[HarmonyPostfix]
private static void Postfix_EnterInteracting(LG_ComputerTerminal __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
if ((int)__instance.CurrentStateName == 2)
{
CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DelayedFixState(__instance)), (Action)null);
}
}
[IteratorStateMachine(typeof(<DelayedFixState>d__1))]
private static IEnumerator DelayedFixState(LG_ComputerTerminal terminal)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayedFixState>d__1(0)
{
terminal = terminal
};
}
private static void AttemptFixState(LG_ComputerTerminal terminal)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Invalid comparison between Unknown and I4
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
PlayerAgent val = (((Object)(object)terminal.m_localInteractionSource != (Object)null) ? terminal.m_localInteractionSource : terminal.m_syncedInteractionSource);
if ((Object)(object)val == (Object)null)
{
terminal.ChangeState((TERM_State)1);
}
else
{
if ((int)val.Locomotion.m_currentStateEnum == 9)
{
return;
}
if (!((Agent)val).IsLocallyOwned)
{
Vector3 val2 = ((Component)val).transform.position - val.Sync.m_locomotionData.Pos;
if (!(((Vector3)(ref val2)).sqrMagnitude > 0.0001f))
{
return;
}
}
terminal.ChangeState((TERM_State)1);
}
}
}
[BepInPlugin("NoInterruptions", "NoInterruptions", "0.1.4")]
public class Plugin : BasePlugin
{
internal static ManualLogSource L;
public override void Load()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
L = ((BasePlugin)this).Log;
new Harmony("gargle").PatchAll();
Debug.Log(Object.op_Implicit("NoInterruptions - zombie hand sticking out of a dead game's grave"));
}
}
[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
[CompilerGenerated]
internal static class VersionInfo
{
public const string RootNamespace = "NoInterruptions";
public const string Version = "1.0.0";
public const string VersionPrerelease = null;
public const string VersionMetadata = "git5346556-dirty-master";
public const string SemVer = "1.0.0+git5346556-dirty-master";
public const string GitRevShort = "5346556-dirty";
public const string GitRevLong = "534655604aba92ef19e630daff318e2a61da7668-dirty";
public const string GitBranch = "master";
public const string GitTag = null;
public const bool GitIsDirty = true;
}
}