using System;
using System.Collections.Generic;
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]
namespace ShermanJumbo.SG8_Punisher
{
[BepInPlugin("ShermanJumbo.SG8_Punisher", "SG8_Punisher", "1.0.3")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class SG8_PunisherPlugin : 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(), "ShermanJumbo.SG8_Punisher");
OtherLoader.RegisterDirectLoad(BasePath, "ShermanJumbo.SG8_Punisher", "ShermanJumbo-Helldivers_2_Ammo_and_Optics-1.0.0", "", "", "shermanjumbo_sg-8punisher");
}
}
}
namespace ShermanJumbo
{
public class TubeFedShotgunFakeAutoMagSwitcher : MonoBehaviour
{
public enum MagState
{
LeftMag,
RightMag
}
[Serializable]
public class FauxMag
{
public Transform LowerPathForward;
public Transform LowerPathRearward;
public Transform TrigPoint;
}
public FVRFireArmMagazine Magazine;
public TubeFedShotgun Shotgun;
public FVRFireArmMagazineReloadTrigger Trig;
public Transform Switch;
public List<FauxMag> FauxMags;
public MagState CurState;
private void Update()
{
if ((float)Magazine.m_numRounds < 8f)
{
CurState = MagState.RightMag;
}
else
{
CurState = MagState.LeftMag;
}
UpdateState();
}
private void UpdateState()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
if (CurState == MagState.LeftMag)
{
Shotgun.RoundPos_LowerPath_Forward.position = FauxMags[0].LowerPathForward.position;
Shotgun.RoundPos_LowerPath_Rearward.position = FauxMags[0].LowerPathRearward.position;
((Component)Trig).transform.position = FauxMags[0].TrigPoint.position;
((Component)Switch).transform.localEulerAngles = new Vector3(0f, 0f, 16f);
}
else if (CurState == MagState.RightMag)
{
Shotgun.RoundPos_LowerPath_Forward.position = FauxMags[1].LowerPathForward.position;
Shotgun.RoundPos_LowerPath_Rearward.position = FauxMags[1].LowerPathRearward.position;
((Component)Trig).transform.position = FauxMags[1].TrigPoint.position;
((Component)Switch).transform.localEulerAngles = new Vector3(0f, 0f, -16f);
}
}
}
}