using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("V56 Cruiser item attachment")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("V56 Cruiser item attachment")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1c0258a2-dd58-44a4-8b86-df663fc3713c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("Debil.cruiser.sideattach", "Cruiser Side Attach", "10.0.0")]
public class CruiserSideAttach : BaseUnityPlugin
{
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
new Harmony("Debil.cruiser.sideattach").PatchAll();
}
}
[HarmonyPatch(typeof(GrabbableObject), "GetPhysicsRegionOfDroppedObject")]
internal class CruiserRegionPatch
{
private static bool Prefix(GrabbableObject __instance, PlayerControllerB playerDropping, ref NetworkObject __result, ref Vector3 hitPoint)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)playerDropping == (Object)null)
{
return true;
}
int mask = LayerMask.GetMask(new string[3] { "Default", "Environment", "Vehicle" });
RaycastHit val = default(RaycastHit);
if (!Physics.Raycast(((Component)playerDropping.gameplayCamera).transform.position, ((Component)playerDropping.gameplayCamera).transform.forward, ref val, playerDropping.grabDistance, mask, (QueryTriggerInteraction)1))
{
return true;
}
Transform val2 = ((Component)((RaycastHit)(ref val)).collider).transform;
while ((Object)(object)val2 != (Object)null && !((Object)val2).name.ToLower().Contains("cruiser"))
{
val2 = val2.parent;
}
if ((Object)(object)val2 == (Object)null)
{
return true;
}
PlayerPhysicsRegion componentInChildren = ((Component)val2).GetComponentInChildren<PlayerPhysicsRegion>(true);
if ((Object)(object)componentInChildren == (Object)null || (Object)(object)componentInChildren.parentNetworkObject == (Object)null)
{
return true;
}
float num = 0.03f;
Vector3 val3 = ((RaycastHit)(ref val)).point + ((RaycastHit)(ref val)).normal * num + Vector3.up * __instance.itemProperties.verticalOffset;
hitPoint = componentInChildren.physicsTransform.InverseTransformPoint(val3);
__result = componentInChildren.parentNetworkObject;
return false;
}
}