using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using MelonLoader;
using ReloadGuns;
using SLZ.Interaction;
using SLZ.Props.Weapons;
using UnhollowerBaseLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::ReloadGuns.ReloadGuns), "Test Mod", "1.0.0", "callmequit", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("MyMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MyMod")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d3cf064d-ad75-4bae-89d1-48440d35ebcd")]
[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")]
namespace ReloadGuns;
public class ReloadGuns : MelonMod
{
private GameObject lHand;
private GameObject rHand;
private InventorySlot leftInventorySlot;
private InventorySlot rightInventorySlot;
private string leftShoulderSlot = "slot_target 05";
private string rightShoulderSlot = "slot_target 06";
private string leftHipSlot = "slot_target 01";
private string rightHipSlot = "slot_target 08";
private string backSlot = "slot_target 07";
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
GameObject[] array = Il2CppArrayBase<GameObject>.op_Implicit(Object.FindObjectsOfType<GameObject>());
MelonLogger.Msg("Starting search for player hands...");
GameObject[] array2 = array;
foreach (GameObject val in array2)
{
if (((Object)val).name == "Hand (left)" && val.layer == LayerMask.NameToLayer("Player"))
{
lHand = val;
leftInventorySlot = lHand.GetComponent<InventorySlot>();
MelonLogger.Msg("Defined Left Hand.");
}
if (((Object)val).name == "Hand (right)" && val.layer == LayerMask.NameToLayer("Player"))
{
rHand = val;
rightInventorySlot = rHand.GetComponent<InventorySlot>();
MelonLogger.Msg("Defined Right Hand.");
}
}
}
public override void OnUpdate()
{
Cursor.visible = true;
if (!Input.GetKeyDown((KeyCode)103))
{
return;
}
try
{
if ((Object)(object)leftInventorySlot.itemGameObject != (Object)null && (Object)(object)leftInventorySlot.itemGameObject.GetComponent<Gun>() != (Object)null)
{
Gun component = leftInventorySlot.itemGameObject.GetComponent<Gun>();
component.InstantLoad();
component.CompleteSlidePull();
component.CompleteSlideReturn();
component.CompleteSlidePull();
component.CompleteSlideReturn();
}
if ((Object)(object)rightInventorySlot.itemGameObject != (Object)null && (Object)(object)rightInventorySlot.itemGameObject.GetComponent<Gun>() != (Object)null)
{
Gun component2 = rightInventorySlot.itemGameObject.GetComponent<Gun>();
component2.InstantLoad();
component2.CompleteSlidePull();
component2.CompleteSlideReturn();
component2.CompleteSlidePull();
component2.CompleteSlideReturn();
}
}
catch
{
MelonLogger.Msg("Could not reload gun.");
}
}
}