public static bool RevolvingShotgun_LoadCylinder(RevolvingShotgun __instance, Speedloader s, ref int ___m_curChamber, ref bool __result)
        {
            if (__instance.CylinderLoaded)
            {
                return(false);
            }

            __instance.CylinderLoaded = true;
            __instance.ProxyCylinder.gameObject.SetActive(__instance.CylinderLoaded);
            __instance.PlayAudioEvent(FirearmAudioEventType.MagazineIn, 1f);
            ___m_curChamber = 0;
            __instance.ProxyCylinder.localRotation = __instance.GetLocalRotationFromCylinder(___m_curChamber);
            for (int i = 0; i < __instance.Chambers.Length; i++)
            {
                if (s.Chambers[i].IsLoaded)
                {
                    __instance.Chambers[i].RoundType = s.Chambers[i].Type;
                    __instance.Chambers[i].Autochamber(s.Chambers[i].LoadedClass);
                    __instance.Chambers[i].IsSpent = s.Chambers[i].IsSpent;
                }
                else
                {
                    __instance.Chambers[i].Unload();
                }

                __instance.Chambers[i].UpdateProxyDisplay();
            }

            __result = true;
            return(false);
        }
        public static bool RevolvingShotgun_EjectCylinder(RevolvingShotgun __instance, ref Speedloader __result)
        {
            GameObject  gameObject = UnityEngine.Object.Instantiate <GameObject>(__instance.CylinderPrefab, __instance.CyclinderMountPoint.position, __instance.CyclinderMountPoint.rotation);
            Speedloader component  = gameObject.GetComponent <Speedloader>();

            __instance.PlayAudioEvent(FirearmAudioEventType.MagazineOut, 1f);
            for (int i = 0; i < component.Chambers.Count; i++)
            {
                if (!__instance.Chambers[i].IsFull)
                {
                    component.Chambers[i].Unload();
                }
                else if (__instance.Chambers[i].IsSpent)
                {
                    component.Chambers[i].Type = __instance.Chambers[i].GetRound().RoundType;
                    component.Chambers[i].LoadEmpty(__instance.Chambers[i].GetRound().RoundClass, false);
                }
                else
                {
                    component.Chambers[i].Type = __instance.Chambers[i].GetRound().RoundType;
                    component.Chambers[i].Load(__instance.Chambers[i].GetRound().RoundClass, false);
                }
                __instance.Chambers[i].UpdateProxyDisplay();
            }
            __instance.EjectDelay     = 0.4f;
            __instance.CylinderLoaded = false;
            __instance.ProxyCylinder.gameObject.SetActive(__instance.CylinderLoaded);

            __result = component;
            return(false);
        }
Exemple #3
0
 static bool RevolvingShotgunPatch_LightPrimerStrike(RevolvingShotgun __instance)
 {
     if (CalcLightPrimerStrikeFail(__instance))
     {
         return(true);
     }
     return(false);
 }