Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of WorseShotgun v0.3.3
HexiBetterShotgun.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Collections; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("HexiBetterShotgun")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Makes the shotgun fire pellets that individually deal damage")] [assembly: AssemblyFileVersion("0.2.2.0")] [assembly: AssemblyInformationalVersion("0.2.2")] [assembly: AssemblyProduct("HexiBetterShotgun")] [assembly: AssemblyTitle("HexiBetterShotgun")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.2.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class ShotgunConfig { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } private static int numTightPelletsLocal = 3; private static float tightPelletAngleLocal = 1.5f; private static int numLoosePelletsLocal = 7; private static float loosePelletAngleLocal = 2.5f; public static int numTightPellets = 3; public static float tightPelletAngle = 1.5f; public static int numLoosePellets = 7; public static float loosePelletAngle = 2.5f; private static void SetValues(int tightCount, float tightSpread, int looseCount, float looseSpread) { numTightPellets = tightCount; tightPelletAngle = tightSpread; numLoosePellets = looseCount; loosePelletAngle = looseSpread; } private static void SetToLocalValues() { SetValues(numTightPelletsLocal, tightPelletAngleLocal, numLoosePelletsLocal, loosePelletAngleLocal); } public static void LoadConfig(ConfigFile config) { Debug.Log((object)config); numTightPelletsLocal = Math.Clamp(config.Bind<int>("Pellets", "tightPelletCount", 3, "Number of pellets for tight grouping").Value, 0, 100); tightPelletAngleLocal = Mathf.Clamp(config.Bind<float>("Pellets", "tightPelletAngle", 1.5f, "Pellet spread for tight grouping (degrees)").Value, 0f, 90f); numLoosePelletsLocal = Math.Clamp(config.Bind<int>("Pellets", "loosePelletCount", 7, "Number of pellets for loose grouping").Value, 0, 100); loosePelletAngleLocal = Mathf.Clamp(config.Bind<float>("Pellets", "loosePelletAngle", 2.5f, "Pellet spread for loose grouping (degrees)").Value, 0f, 90f); SetToLocalValues(); } public static byte[] GetSettings() { byte[] array = new byte[17] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Array.Copy(BitConverter.GetBytes(numTightPelletsLocal), 0, array, 1, 4); Array.Copy(BitConverter.GetBytes(tightPelletAngleLocal), 0, array, 5, 4); Array.Copy(BitConverter.GetBytes(numLoosePelletsLocal), 0, array, 9, 4); Array.Copy(BitConverter.GetBytes(loosePelletAngleLocal), 0, array, 13, 4); return array; } public static void SetSettings(byte[] data) { byte b = data[0]; byte b2 = b; if (b2 == 1) { numTightPellets = BitConverter.ToInt32(data, 1); tightPelletAngle = BitConverter.ToSingle(data, 5); numLoosePellets = BitConverter.ToInt32(data, 9); loosePelletAngle = BitConverter.ToSingle(data, 13); return; } throw new Exception("Invalid version byte"); } private static bool IsHost() { return NetworkManager.Singleton.IsHost; } public static void OnRequestSync(ulong clientID, FastBufferReader reader) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!IsHost()) { return; } Debug.Log((object)("SHOTGUN: Sending config to client " + clientID)); byte[] settings = GetSettings(); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(settings.Length, (Allocator)2, settings.Length); try { ((FastBufferWriter)(ref val)).WriteBytes(settings, -1, 0); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("HexiShotgun_OnReceiveConfigSync", clientID, val, (NetworkDelivery)2); } catch (Exception ex) { Debug.LogError((object)("SHOTGUN: Failed to send config: " + ex)); } finally { ((FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong clientID, FastBufferReader reader) { Debug.Log((object)"SHOTGUN: Received config from host"); byte[] settings = new byte[16]; try { ((FastBufferReader)(ref reader)).ReadBytes(ref settings, 16, 0); SetSettings(settings); } catch (Exception ex) { Debug.LogError((object)("SHOTGUN: Failed to receive config: " + ex)); SetToLocalValues(); } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] private static void ServerConnect() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown if (IsHost()) { Debug.Log((object)"SHOTGUN: Started hosting, using local settings"); SetToLocalValues(); CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("HexiShotgun_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); } else { Debug.Log((object)"SHOTGUN: Connected to server, requesting settings"); CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler("HexiShotgun_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("HexiShotgun_OnRequestConfigSync", 0uL, default(FastBufferWriter), (NetworkDelivery)2); } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] private static void ServerDisconnect() { Debug.Log((object)"SHOTGUN: Server disconnect"); SetToLocalValues(); } } namespace BetterShotgun { [BepInPlugin("HexiBetterShotgun", "HexiBetterShotgun", "0.2.2")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { private Harmony h; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HexiBetterShotgun is loaded!"); h = Harmony.CreateAndPatchAll(typeof(ShotgunPatch), (string)null); } private void OnDestroy() { h.UnpatchSelf(); } } internal class FadeOutLine : MonoBehaviour { private const float lifetime = 0.4f; private const float width = 0.02f; private static readonly Color col = new Color(1f, 0f, 0f); private float alive = 0f; private LineRenderer line; public Vector3 start; public Vector3 end; private static readonly Material mat = new Material(Shader.Find("Legacy Shaders/Particles/Alpha Blended Premultiply")); public void Prep() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(start, end); float num2 = (9999f - num) / 9999f; line = ((Component)this).gameObject.AddComponent<LineRenderer>(); line.startColor = col; line.endColor = col * num2 + Color.black * (1f - num2); line.startWidth = 0.02f; line.endWidth = num2 * 0.02f; line.SetPositions((Vector3[])(object)new Vector3[2] { start, end }); ((Renderer)line).material = mat; } private void Update() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) alive += Time.deltaTime; if (alive >= 0.4f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } line.startColor = new Color(col.r, col.g, col.b, (0.4f - alive) / 0.4f); line.endColor = new Color(line.endColor.r, line.endColor.g, line.endColor.b, (0.4f - alive) / 0.4f); } } public class Counter<T> { public T item; public int count; } public class CountHandler { public List<Counter<PlayerControllerB>> player = new List<Counter<PlayerControllerB>>(); public List<Counter<EnemyAI>> enemy = new List<Counter<EnemyAI>>(); public List<Counter<IHittable>> other = new List<Counter<IHittable>>(); public void AddPlayerToCount(PlayerControllerB p) { if (player.Any((Counter<PlayerControllerB> i) => (Object)(object)i.item == (Object)(object)p)) { player.First((Counter<PlayerControllerB> i) => (Object)(object)i.item == (Object)(object)p).count++; } else { player.Add(new Counter<PlayerControllerB> { item = p, count = 1 }); } } public void AddEnemyToCount(EnemyAI ai) { if (enemy.Any((Counter<EnemyAI> i) => (Object)(object)i.item == (Object)(object)ai)) { enemy.First((Counter<EnemyAI> i) => (Object)(object)i.item == (Object)(object)ai).count++; } else { enemy.Add(new Counter<EnemyAI> { item = ai, count = 1 }); } } public void AddOtherToCount(IHittable hit) { if (other.Any((Counter<IHittable> i) => i.item == hit)) { other.First((Counter<IHittable> i) => i.item == hit).count++; } else { other.Add(new Counter<IHittable> { item = hit, count = 1 }); } } } internal class NewShotgunHandler { public const float range = 9999f; private const int numTightPellets = 3; private const float tightPelletAngle = 1.5f; private const int numLoosePellets = 5; private const float loosePelletAngle = 2.5f; public static Random ShotgunRandom = new Random(0); private static IEnumerator DelayedEarsRinging(float effectSeverity) { yield return (object)new WaitForSeconds(0.6f); SoundManager.Instance.earsRingingTimer = effectSeverity; } private static void VisualiseShot(Vector3 start, Vector3 end) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Trail Visual"); FadeOutLine fadeOutLine = val.AddComponent<FadeOutLine>(); fadeOutLine.start = start; fadeOutLine.end = end; fadeOutLine.Prep(); } public static void ShootGun(ShotgunItem gun, Vector3 shotgunPosition, Vector3 shotgunForward) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_06f6: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_073f: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_0687: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB playerHeldBy = ((GrabbableObject)gun).playerHeldBy; bool flag = ((GrabbableObject)gun).isHeld && (Object)(object)((GrabbableObject)gun).playerHeldBy != (Object)null; if (flag) { shotgunPosition += ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.up * 0.25f; } bool flag2 = flag && (Object)(object)((GrabbableObject)gun).playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController; if (flag2) { ((GrabbableObject)gun).playerHeldBy.playerBodyAnimator.SetTrigger("ShootShotgun"); } RoundManager.PlayRandomClip(gun.gunShootAudio, gun.gunShootSFX, true, 1f, 1840); WalkieTalkie.TransmitOneShotAudio(gun.gunShootAudio, gun.gunShootSFX[0], 1f); gun.gunShootParticle.Play(true); gun.isReloading = false; gun.shellsLoaded = Mathf.Clamp(gun.shellsLoaded - 1, 0, 2); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return; } Vector3[] array = (Vector3[])(object)new Vector3[8]; State state = Random.state; Random.InitState(ShotgunRandom.Next()); for (int i = 0; i < 8; i++) { float num = ((i < 3) ? 1.5f : 2.5f); Vector3 onUnitSphere = Random.onUnitSphere; float num2 = num * Mathf.Sqrt(Random.value); Vector3 val = Vector3.RotateTowards(shotgunForward, onUnitSphere, num2 * MathF.PI / 180f, 0f); array[i] = val; } Random.state = state; float num3 = Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)gun.shotgunRayPoint).transform.position); float num4 = 0f; if (num3 < 5f) { num4 = 0.8f; HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num3 < 15f) { num4 = 0.5f; HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num3 < 23f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } if (num4 > 0f && SoundManager.Instance.timeSinceEarsStartedRinging > 16f && !flag) { ((MonoBehaviour)gun).StartCoroutine(DelayedEarsRinging(num4)); } CountHandler countHandler = new CountHandler(); Ray val3 = default(Ray); IHittable val5 = default(IHittable); EnemyAI val8 = default(EnemyAI); foreach (Vector3 val2 in array) { ((Ray)(ref val3))..ctor(shotgunPosition, val2); RaycastHit[] array2 = Physics.RaycastAll(val3, 9999f, StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers | 0x80000, (QueryTriggerInteraction)2); Array.Sort(array2, (RaycastHit x, RaycastHit y) => ((RaycastHit)(ref x)).distance.CompareTo(((RaycastHit)(ref y)).distance)); Vector3 val4 = shotgunPosition + val2 * 9999f; Debug.Log((object)("SHOTGUN: RaycastAll hit " + array2.Length + " things (" + flag + "," + flag2 + ")")); for (int k = 0; k < array2.Length; k++) { GameObject gameObject = ((Component)((RaycastHit)(ref array2[k])).transform).gameObject; if (gameObject.TryGetComponent<IHittable>(ref val5)) { if (val5 == ((GrabbableObject)gun).playerHeldBy) { continue; } EnemyAI val6 = null; EnemyAICollisionDetect val7 = (EnemyAICollisionDetect)(object)((val5 is EnemyAICollisionDetect) ? val5 : null); if (val7 != null) { val6 = val7.mainScript; } if ((Object)(object)val6 != (Object)null && (!flag || val6.isEnemyDead || val6.enemyHP <= 0 || !val6.enemyType.canDie)) { continue; } if (val5 is PlayerControllerB) { countHandler.AddPlayerToCount((PlayerControllerB)(object)((val5 is PlayerControllerB) ? val5 : null)); } else if ((Object)(object)val6 != (Object)null) { countHandler.AddEnemyToCount(val6); } else { if (!flag) { continue; } countHandler.AddOtherToCount(val5); } val4 = ((RaycastHit)(ref array2[k])).point; Debug.Log((object)("SHOTGUN: Hit [" + ((object)val5)?.ToString() + "] (" + (k + 1) + "@" + Vector3.Distance(shotgunPosition, val4) + ")")); break; } if (((Component)((RaycastHit)(ref array2[k])).collider).TryGetComponent<EnemyAI>(ref val8)) { if (!flag || val8.isEnemyDead || val8.enemyHP <= 0 || !val8.enemyType.canDie) { continue; } countHandler.AddEnemyToCount(val8); val4 = ((RaycastHit)(ref array2[k])).point; Debug.Log((object)("SHOTGUN: Backup hit [" + ((object)val8)?.ToString() + "] (" + (k + 1) + "@" + Vector3.Distance(shotgunPosition, val4) + ")")); break; } val4 = ((RaycastHit)(ref array2[k])).point; Debug.Log((object)("SHOTGUN: Wall [" + ((object)gameObject)?.ToString() + "] (" + (k + 1) + "@" + Vector3.Distance(shotgunPosition, val4) + ")")); break; } VisualiseShot(shotgunPosition, val4); } countHandler.player.ForEach(delegate(Counter<PlayerControllerB> p) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) int num7 = p.count * 13; Debug.Log((object)("SHOTGUN: Hit " + ((object)p.item)?.ToString() + " with " + p.count + " pellets for " + num7 + " damage")); p.item.DamagePlayer(num7, true, true, (CauseOfDeath)7, 0, false, shotgunForward); }); countHandler.enemy.ForEach(delegate(Counter<EnemyAI> e) { int num6 = e.count / 4 + 1; Debug.Log((object)("SHOTGUN: Hit " + ((object)e.item)?.ToString() + " with " + e.count + " pellets for " + num6 + " damage")); e.item.HitEnemy(num6, ((GrabbableObject)gun).playerHeldBy, true); }); countHandler.other.ForEach(delegate(Counter<IHittable> o) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) int num5 = o.count / 4 + 1; Debug.Log((object)("SHOTGUN: Hit " + ((object)o.item)?.ToString() + " with " + o.count + " pellets for " + num5 + " damage")); o.item.Hit(num5, shotgunForward, ((GrabbableObject)gun).playerHeldBy, true); }); ((Ray)(ref val3))..ctor(shotgunPosition, shotgunForward); RaycastHit val9 = default(RaycastHit); if (Physics.Raycast(val3, ref val9, 9999f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { ((Component)gun.gunBulletsRicochetAudio).transform.position = ((Ray)(ref val3)).GetPoint(((RaycastHit)(ref val9)).distance - 0.5f); gun.gunBulletsRicochetAudio.Play(); } } } internal class ShotgunPatch { [HarmonyPatch(typeof(ShotgunItem), "ShootGun")] [HarmonyPrefix] private static bool ReplaceShotgunCode(ShotgunItem __instance, Vector3 shotgunPosition, Vector3 shotgunForward) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) NewShotgunHandler.ShootGun(__instance, shotgunPosition, shotgunForward); return false; } [HarmonyPatch(typeof(StartOfRound), "ChooseNewRandomMapSeed")] [HarmonyPostfix] private static void UpdateShotgunSeed(StartOfRound __instance) { NewShotgunHandler.ShotgunRandom = new Random(__instance.randomMapSeed); Debug.Log((object)("Shotgun seed: " + __instance.randomMapSeed)); } [HarmonyPatch(typeof(SandSpiderAI), "HitEnemy")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SpiderDamageFix(IEnumerable<CodeInstruction> original) { int c = -1; FieldInfo fieldInfo = typeof(SandSpiderAI).GetField("health", BindingFlags.Instance | BindingFlags.NonPublic); foreach (CodeInstruction inst in original) { if (c == -1 && CodeInstructionExtensions.LoadsField(inst, fieldInfo, false)) { c = 0; yield return inst; } else if (c == 0) { c = 1; yield return new CodeInstruction(OpCodes.Ldarg_1, (object)null); } else { yield return inst; } } } } public static class PluginInfo { public const string PLUGIN_GUID = "HexiBetterShotgun"; public const string PLUGIN_NAME = "HexiBetterShotgun"; public const string PLUGIN_VERSION = "0.2.2"; } }