using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEngine;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
public class FerroStockPreattach : MonoBehaviour
{
public FVRFireArmAttachmentMount Mount;
public string StockID = "ARCRaidersStock";
public float TimeoutSeconds = 15f;
private IEnumerator Start()
{
float elapsed = 0f;
FVRObject stock = null;
for (; elapsed < TimeoutSeconds; elapsed += 0.5f)
{
if (IM.OD != null && IM.OD.TryGetValue(StockID, out stock) && (Object)(object)stock != (Object)null)
{
break;
}
stock = null;
yield return (object)new WaitForSeconds(0.5f);
}
if (!((Object)(object)stock == (Object)null) && !((Object)(object)Mount == (Object)null) && Mount.AttachmentsList.Count <= 0)
{
GameObject go = Object.Instantiate<GameObject>(((AnvilAsset)stock).GetGameObject(), ((Component)Mount).transform.position, ((Component)Mount).transform.rotation);
FVRFireArmAttachment attachment = go.GetComponent<FVRFireArmAttachment>();
if ((Object)(object)attachment == (Object)null)
{
Object.Destroy((Object)(object)go);
}
else
{
attachment.AttachToMount(Mount, false);
}
}
}
}
namespace printerjoe.Ferro;
[BepInPlugin("printerjoe.Ferro", "Ferro", "1.0.4")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class FerroPlugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
internal static ManualLogSource Logger;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
LoadAssets();
}
private void LoadAssets()
{
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "printerjoe.Ferro");
OtherLoader.RegisterDirectLoad(BasePath, "printerjoe.Ferro", "", "", "ferro", "");
}
}