Decompiled source of Aiyke code mod pack v1.0.0
h3vr_code_mod.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using FistVR; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("Aiyke")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A collection of code mods doing a variety of things for H3VR.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("h3vr_code_mod")] [assembly: AssemblyTitle("BepInEx Plugin Title")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string id = null, string name = null, string version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null) { } } } namespace plugin { [BepInPlugin("Aiyke.code_mod", "code_mod", "1.0.0")] [BepInProcess("h3vr.exe")] public class code_mod : BaseUnityPlugin { private struct em_mod { public Sosig obj; public int id; public bool trigger_hold; public float t_fire; public float t_fire2; public float t_burst; public em_mod(Sosig instance, int index) { obj = null; id = 0; trigger_hold = false; t_fire = 0f; t_fire2 = 0f; t_burst = 0f; obj = instance; id = ((Object)instance).GetInstanceID(); } } public static ConfigEntry<bool> bullet_pen_mod; public static ConfigEntry<float> pl_in_dmg_mult; private static float pl_in_dmg_mult_prev = 0f; private static bool pl_in_dmg_mult_changed = false; public static ConfigEntry<float> pl_out_dmg_mult; public static ConfigEntry<bool> hit_sound; public static ConfigEntry<float> hit_sound_vol; public static ConfigEntry<bool> tracer_spin; public static ConfigEntry<bool> em_aim_mod; public static ConfigEntry<float> em_acc_mult; public static ConfigEntry<bool> em_wpn_mod; public static ConfigEntry<bool> em_wpn_coll_mod; public static ConfigEntry<bool> em_alert_mod; public static ConfigEntry<float> em_move_mod_amt; public static ConfigEntry<float> em_stagger_mod; public static ConfigEntry<float> em_suppress_mod; public static ConfigEntry<bool> red_blood; public static ConfigEntry<bool> obj_sinking; public static ConfigEntry<bool> quickbolt_all; public static ConfigEntry<bool> fix_grip_pos; public static ConfigEntry<bool> reduced_tint; public static ConfigEntry<bool> pistol_slide_tilt; public static ConfigEntry<bool> metric_box_txt; public static ConfigEntry<float> las_vis; public static ConfigEntry<float> expl_mod; public static ConfigEntry<bool> flash_mod; public static ConfigEntry<bool> red_hit_fx; public static ConfigEntry<bool> health_warn; public static ConfigEntry<bool> aim_assist; public static ConfigEntry<float> aim_assist_amt; public static ConfigEntry<bool> short_teleport; public static ConfigEntry<float> short_teleport_amt; public static ConfigEntry<bool> spectator_zoom; public static ConfigEntry<float> spec_zoom_hold_time; public static ConfigEntry<float> spec_zoom_aim_radius; public static ConfigEntry<float> spec_fov_norm; public static ConfigEntry<float> spec_fov_zoomed; private static Collider[] collider_array = (Collider[])(object)new Collider[2048]; private static bool in_radius = false; private static float time_inside_radius = 0f; private static float print_timer = 0f; private static Transform gun_transform; private static List<em_mod> em_states = new List<em_mod>(); private static bool half_frame = false; private static bool log_bullet_events = false; private static int impact_frame = 0; private static byte armor_lv = 0; private static bool flat_bullet = false; private static bool was_this_bullet_able_to_pierce_armor_normally = false; private static float low_health_warning_timer = 0f; private static float health_percent_prev = 0f; private static float half_health_warn_tmr = 0f; private static float quarter_health_warn_tmr = 0f; private static Stopwatch timer { get; } = new Stopwatch(); internal static ManualLogSource Logger { get; private set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Logger.LogMessage((object)"code_mod plugin active."); bullet_pen_mod = ((BaseUnityPlugin)this).Config.Bind<bool>("Bullets and damage", "Modified bullet penetration", true, "Modified bullet penetration system.\n12-gauge slugs kill enemies with level 1 armor in 2 shots."); pl_in_dmg_mult = ((BaseUnityPlugin)this).Config.Bind<float>("Bullets and damage", "Incoming damage multiplier", 0.9f, "Multiplier for damage you take."); pl_out_dmg_mult = ((BaseUnityPlugin)this).Config.Bind<float>("Bullets and damage", "Output damage multiplier", 1f, "Multiplier for damage enemies take."); hit_sound = ((BaseUnityPlugin)this).Config.Bind<bool>("Bullets and damage", "Hit confirm sound", false, "Plays a sound when you hit an enemy over 5 m away."); hit_sound_vol = ((BaseUnityPlugin)this).Config.Bind<float>("Bullets and damage", "Hit sound volume", 0.5f, "Volume of the hit confirm sound"); tracer_spin = ((BaseUnityPlugin)this).Config.Bind<bool>("Bullets and damage", "Tracer spinning", true, "Makes tracers spin in flight."); quickbolt_all = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons other objects", "Quickbolt all", true, "Enables quick bolt operation for all bolt-action guns."); fix_grip_pos = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons other objects", "Fixed grip positions", true, "Fixes the grip positions for some guns, including the Evo3 series and some MP5s."); reduced_tint = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons other objects", "Reduced reflex sight tint", true, "Reduces the excessive tint on reflex sights added with update 118.\nDetach and re-attach to apply the effect."); pistol_slide_tilt = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons other objects", "Pistol slide pull tilt", true, "Tilts pistols upwards when the slide is all the way back."); metric_box_txt = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons other objects", "Metric ammo box text", true, "Makes cartridge boxes show metric units.\nAlso shows kinetic energy (Joules) and armor piercing power as apostrophes (')"); obj_sinking = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons other objects", "Gibs and casings sinking", true, "Makes gibs and empty casings sink into the ground after a while."); las_vis = ((BaseUnityPlugin)this).Config.Bind<float>("Weapons other objects", "Laser visibility", 2f, "Adjusts the visibility of laser beams.\nDoes not work with built-in lasers like on the PMM."); expl_mod = ((BaseUnityPlugin)this).Config.Bind<float>("Explosives", "Explosive damage radius multiplier", 2f, "Adjusts explosive 'splash damage' radius."); flash_mod = ((BaseUnityPlugin)this).Config.Bind<bool>("Explosives", "More blinding flash grenades", true, "Does as stated."); em_aim_mod = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Chest aim", true, "Makes enemies aim for your chest instead of your head.\nThis makes crouching and/or staying behind cover more effective."); em_acc_mult = ((BaseUnityPlugin)this).Config.Bind<float>("Enemies", "Accuracy multiplier", 1f, "Adjusts the spread and recoil of their guns."); em_wpn_mod = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Full auto usage", true, "Makes enemies shoot fully automatic guns in bursts.\nWARNING: this can make combat significantly harder."); em_wpn_coll_mod = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Disable gun collision when held.", true, "Makes their guns no longer act as impenetrable shields."); em_alert_mod = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Better alertness", true, "Makes them realise they're being shot at more consistently.\nWithout it, they sometimes don't hear gunshots right next to them."); em_move_mod_amt = ((BaseUnityPlugin)this).Config.Bind<float>("Enemies", "Movement while engaging multiplier", 1.5f, "Adjusts how much they hold still while engaging.\nHigher = longer."); em_stagger_mod = ((BaseUnityPlugin)this).Config.Bind<float>("Enemies", "Stagger resistance", 1f, "Adjusts how resistant they are to confusion, staggering, or being knocked unconscious.\nHigher = less"); em_suppress_mod = ((BaseUnityPlugin)this).Config.Bind<float>("Enemies", "Suppression resistance", 2f, "Adjusts how resistant they are to suppression.\nHigher = less"); red_blood = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies", "Ketchup", true, "Makes their 'blood' red instead of yellow."); red_hit_fx = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "Red hit flash effect", true, "Changes the hit flash colour from white to red."); health_warn = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "Low wealth warning", true, "Shows subtle periodic flashing if health is below half, and gets more intense the lower it is."); aim_assist = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "Aim assistance*", false, "Experimental aim assistance.\nIt works when you're aiming within 5 degrees of an enemy.\nIt messes up sometimes."); aim_assist_amt = ((BaseUnityPlugin)this).Config.Bind<float>("Player", "Aim assistance amount", 0.5f, "Strength of the aim assistance."); short_teleport = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "Short teleport", true, "Enables short forward and backward teleport using the stick up and down with teleport movement mode.\nUseful for engaging from behind cover."); short_teleport_amt = ((BaseUnityPlugin)this).Config.Bind<float>("Player", "Short teleport amount", 0.2f, "Short teleport distance (metres)"); spectator_zoom = ((BaseUnityPlugin)this).Config.Bind<bool>("Spectator", "Spectator zoom when aiming", false, "Zooms the spectator camera when aiming a loaded gun.\nTry to keep the center of the sights in the middle of your field of vision."); spec_zoom_hold_time = ((BaseUnityPlugin)this).Config.Bind<float>("Spectator", "Aim hold time", 0.3f, "How long aiming has to be held before zooming in.\nThis prevents unwanted zooming out when shooting."); spec_zoom_aim_radius = ((BaseUnityPlugin)this).Config.Bind<float>("Spectator", "Aim radius", 15f, "Size of the 'circle' around the spectator camera's center in which zooming can occur."); spec_fov_zoomed = ((BaseUnityPlugin)this).Config.Bind<float>("Spectator", "Spectator zoomed in FOV", 30f, "Spectator FOV when aiming.\nSmaller = more magnification."); spec_fov_norm = ((BaseUnityPlugin)this).Config.Bind<float>("Spectator", "Spectator normal FOV", 55f, "Normal FOV for the spectator when not aiming."); Harmony.CreateAndPatchAll(typeof(code_mod), (string)null); } private void Update() { Logger = ((BaseUnityPlugin)this).Logger; float deltaTime = Time.deltaTime; if (half_frame) { half_frame = false; } else { half_frame = true; if (Random.value < 0.5f && (Object)(object)collider_array[0] != (Object)null) { for (int i = 0; i < collider_array.Length; i++) { collider_array[i] = null; } } } if (pl_in_dmg_mult_prev != pl_in_dmg_mult.Value) { pl_in_dmg_mult_changed = true; } if (pl_in_dmg_mult.Value < 0.001f) { pl_in_dmg_mult.Value = 0.001f; } pl_in_dmg_mult_prev = pl_in_dmg_mult.Value; if (pl_out_dmg_mult.Value < 0.001f) { pl_out_dmg_mult.Value = 0.001f; } if (em_acc_mult.Value < 0.01f) { em_acc_mult.Value = 0.01f; } if (spectator_zoom.Value) { if (in_radius) { time_inside_radius += deltaTime; } else { time_inside_radius -= deltaTime; } if (time_inside_radius > spec_zoom_hold_time.Value) { GM.Options.ControlOptions.CamFOV = spec_fov_zoomed.Value; } else { GM.Options.ControlOptions.CamFOV = spec_fov_norm.Value; } } if (time_inside_radius > 1f) { time_inside_radius = 1f; } if (time_inside_radius < 0f) { time_inside_radius = 0f; } if (!GM.CurrentPlayerBody.HasAGunInHand() || !spectator_zoom.Value) { time_inside_radius = 0f; GM.Options.ControlOptions.CamFOV = spec_fov_norm.Value; } print_timer += deltaTime; if (print_timer > 1f) { print_timer = 0f; } } private static float fabs(float x) { return Mathf.Abs(x); } [HarmonyPatch(typeof(FVRFireArm), "FVRUpdate")] [HarmonyPostfix] private static void FVRFireArm_FVRUpdate_postfix(FVRFireArm __instance) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!spectator_zoom.Value || !((FVRInteractiveObject)__instance).IsHeld) { return; } gun_transform = __instance.CurrentMuzzle; Transform transform = ((Component)GM.CurrentPlayerBody.FilteredHead).transform; Transform currentMuzzle = __instance.CurrentMuzzle; if (!__instance.IsLoaded()) { in_radius = false; return; } if (Vector3.Angle(transform.forward, currentMuzzle.forward) < spec_zoom_aim_radius.Value) { in_radius = true; } else { in_radius = false; } if (!__instance.IsForegripStabilized() && !__instance.IsShoulderStabilized() && !__instance.IsTwoHandStabilized()) { in_radius = false; } } [HarmonyPatch(typeof(FVRSceneSettings), "UpdateSpectatorCamera")] [HarmonyPostfix] private static void FVRSceneSettings_UpdateSpectatorCamera_postfix(FVRSceneSettings __instance) { if (spectator_zoom.Value && !((Object)(object)__instance.m_specCam == (Object)null)) { __instance.m_specCam.fieldOfView = (__instance.m_specCam.fieldOfView * 19f + GM.Options.ControlOptions.CamFOV * 1f) / 20f; } } [HarmonyPatch(typeof(FVRFireArm), "Fire")] [HarmonyPrefix] private static bool FVRFireArm_Fire_prefix(FVRFireArm __instance, FVRFireArmChamber chamber, Transform muzzle, bool doBuzz, float velMult = 1f, float rangeOverride = -1f) { //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_0348: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: 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_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_068f: Unknown result type (might be due to invalid IL or missing references) //IL_0699: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Unknown result type (might be due to invalid IL or missing references) if (!aim_assist.Value) { return true; } bool flag = false; for (int i = 0; i < GM.CurrentMovementManager.Hands.Length; i++) { if ((Object)(object)((FVRInteractiveObject)__instance).m_hand == (Object)(object)GM.CurrentMovementManager.Hands[i]) { flag = true; break; } } if (!flag) { return true; } bool flag2 = false; if (flag2) { Logger.LogInfo((object)"> BallisticProjectile_Fire_prefix < <"); timer.Start(); } if (doBuzz && (Object)(object)((FVRInteractiveObject)__instance).m_hand != (Object)null) { ((FVRInteractiveObject)__instance).m_hand.Buzz(((FVRInteractiveObject)__instance).m_hand.Buzzer.Buzz_GunShot); if ((Object)(object)((FVRPhysicalObject)__instance).AltGrip != (Object)null && (Object)(object)((FVRInteractiveObject)((FVRPhysicalObject)__instance).AltGrip).m_hand != (Object)null) { ((FVRInteractiveObject)((FVRPhysicalObject)__instance).AltGrip).m_hand.Buzz(((FVRInteractiveObject)__instance).m_hand.Buzzer.Buzz_GunShot); } } if (!((FVRInteractiveObject)__instance).IsHeld && !((FVRPhysicalObject)__instance).IsKinematicLocked && !((FVRPhysicalObject)__instance).IsPivotLocked && (Object)(object)((FVRPhysicalObject)__instance).RootRigidbody != (Object)null) { ((FVRPhysicalObject)__instance).RootRigidbody.AddForceAtPosition(Vector3.Slerp(-muzzle.forward, Random.onUnitSphere, 0.1f) * Random.Range(0.4f, 0.8f), muzzle.position, (ForceMode)2); } GM.CurrentSceneSettings.OnShotFired(__instance); if (__instance.IsSuppressed()) { GM.CurrentPlayerBody.VisibleEvent(0.1f); } else { GM.CurrentPlayerBody.VisibleEvent(2f); } float chamberVelMult = AM.GetChamberVelMult(chamber.RoundType, Vector3.Distance(((Component)chamber).transform.position, muzzle.position)); float num = __instance.GetCombinedFixedDrop(__instance.AccuracyClass) * 0.0166667f; Vector2 val = __instance.GetCombinedFixedDrift(__instance.AccuracyClass) * 0.0166667f; float num2 = 5f; float num3 = num2; SosigLink val2 = null; _ = Vector3.zero; bool flag3 = false; int num4 = Physics.OverlapSphereNonAlloc(((Component)__instance).transform.position, 200f, collider_array, LayerMask.op_Implicit(AM.PLM), (QueryTriggerInteraction)2); if (flag2) { Logger.LogInfo((object)("Physics.OverlapSphereNonAlloc found " + num4 + " collidable entities within 200 m.")); Logger.LogInfo((object)"Now attempting to find closest head to barrel forward vector..."); } if (num4 == 0) { flag3 = false; if (flag2) { Logger.LogError((object)"no enemies found"); } } else { for (int j = 0; j < num4; j++) { if (!((Object)(object)collider_array[j].attachedRigidbody != (Object)null)) { continue; } if (flag2) { Logger.LogInfo((object)("[" + j + "]: " + ((Object)collider_array[j].attachedRigidbody).name)); } SosigLink component = ((Component)collider_array[j].attachedRigidbody).gameObject.GetComponent<SosigLink>(); if ((Object)(object)component != (Object)null && (int)component.BodyPart == 0) { Vector3 val3 = ((Component)component).transform.position - ((Component)__instance).transform.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; num2 = Vector3.Angle(((Component)__instance).transform.forward, normalized); if (num2 < num3) { val2 = component; num3 = num2; } } } if ((Object)(object)val2 != (Object)null) { flag3 = true; if (Vector3.Distance(((Component)val2).gameObject.transform.position, muzzle.position) < 5f) { if (flag2) { Logger.LogError((object)"no enemies found"); } flag3 = false; } } else { if (flag2) { Logger.LogError((object)"no enemies found"); } flag3 = false; } } if (flag2) { Logger.LogInfo((object)"Proceeding to firing code\t-\t-\t-\t-\t-"); } for (int k = 0; k < chamber.GetRound().NumProjectiles; k++) { float num5 = chamber.GetRound().ProjectileSpread + __instance.m_internalMechanicalMOA + __instance.GetCombinedMuzzleDeviceAccuracy(); if (!((Object)(object)chamber.GetRound().BallisticProjectilePrefab != (Object)null)) { continue; } Vector3 val4 = muzzle.forward * 0.005f; GameObject val5 = Object.Instantiate<GameObject>(chamber.GetRound().BallisticProjectilePrefab, muzzle.position - val4, muzzle.rotation); Transform transform = val5.transform; Vector2 val6 = (Random.insideUnitCircle + Random.insideUnitCircle + Random.insideUnitCircle) * (1f / 3f) * num5; Quaternion rotation = muzzle.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; if (flag3) { transform.LookAt(((Component)val2).gameObject.transform.position); Quaternion val7 = Quaternion.Euler(eulerAngles.x, eulerAngles.y, eulerAngles.z); Quaternion rotation2 = ((Component)transform).transform.rotation; float x = ((Quaternion)(ref rotation2)).eulerAngles.x; rotation2 = ((Component)transform).transform.rotation; float y = ((Quaternion)(ref rotation2)).eulerAngles.y; rotation2 = ((Component)transform).transform.rotation; Quaternion val8 = Quaternion.Euler(x, y, ((Quaternion)(ref rotation2)).eulerAngles.z); float num6 = 0.1f; if (num3 > 3f && num3 < 5f) { num6 = 0.1f; } else if (num3 > 2f && num3 < 3f) { num6 = 0.2f; } else if (num3 > 1f && num3 < 2f) { num6 = 0.5f; } else if ((double)num3 < 1.0) { num6 = 0.7f; } num6 *= Mathf.Clamp(Random.Range(aim_assist_amt.Value - 0.1f, aim_assist_amt.Value + 0.1f), 0.1f, 1f); if (flag2) { Logger.LogInfo((object)("aim assist amount = " + (int)(num6 * 100f))); } Quaternion rotation3 = Quaternion.Lerp(val7, val8, num6); val5.transform.rotation = rotation3; rotation2 = val5.transform.rotation; Vector3 eulerAngles2 = ((Quaternion)(ref rotation2)).eulerAngles; rotation2 = muzzle.rotation; float num7 = Vector3.Angle(eulerAngles2, ((Quaternion)(ref rotation2)).eulerAngles); if (flag2) { Logger.LogInfo((object)" > Angles adjusted. <"); } if (num7 > 5f) { if (flag2) { Logger.LogError((object)"This gun just tried to shoot the ground for some reason."); } val5.transform.rotation = rotation; if (flag2) { Logger.LogInfo((object)" > Firing bullet normally instead. <"); } } val5.transform.Rotate(new Vector3(val6.x + val.y + num, val6.y + val.x, 0f)); } else { if (flag2) { Logger.LogInfo((object)" > Firing bullet normally. <"); } val5.transform.Rotate(new Vector3(val6.x + val.y + num, val6.y + val.x, Random.value * 90f)); } BallisticProjectile component2 = val5.GetComponent<BallisticProjectile>(); component2.Fire(component2.MuzzleVelocityBase * chamber.ChamberVelocityMultiplier * velMult * chamberVelMult, val5.transform.forward, __instance, true); if (rangeOverride > 0f) { component2.ForceSetMaxDist(rangeOverride); } } if (flag2) { timer.Stop(); Logger.LogInfo((object)("FVRFireArm_Fire_prefix exec time = " + timer.ElapsedMilliseconds + " ms\n")); timer.Reset(); } return false; } [HarmonyPatch(typeof(BallisticProjectile), "MoveBullet")] [HarmonyPrefix] private static void BallisticProjectile_MoveBullet_prefix_for_dmg(BallisticProjectile __instance) { if (__instance.Source_IFF == GM.CurrentPlayerBody.m_playerIFF && !(__instance.m_distanceTraveled > 0.1f) && __instance.IsMoving() && __instance.m_distanceTraveled <= 0.01f) { if (((Object)__instance).name.StartsWith("32FL")) { __instance.MuzzleVelocityBase = (__instance.MuzzleVelocityBase + 365f) / 2f; __instance.Mass = (__instance.Mass + 0.006f) / 2f; __instance.FrontArea = (__instance.FrontArea + 6.749E-05f) / 2f; } if (((Object)__instance).name.EndsWith("JHP(Clone)") || ((Object)__instance).name.EndsWith("SP(Clone)")) { __instance.AirDragMultiplier *= 1.5f; } __instance.Mass *= pl_out_dmg_mult.Value; } } [HarmonyPatch(typeof(BallisticProjectile), "UpdateBulletPath")] [HarmonyPostfix] private static void BallisticProjectile_UpdateBulletPath_postfix(BallisticProjectile __instance) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown if (!em_alert_mod.Value || !half_frame || __instance.Source_IFF != GM.CurrentPlayerBody.m_playerIFF || !__instance.IsMoving()) { return; } bool flag = false; if (Random.value < 0.5f) { float num = 1f + __instance.Dimensions.x * 10f + __instance.Mass * 100f + ((Vector3)(ref __instance.m_velocity)).magnitude / 300f; int num2 = Physics.OverlapSphereNonAlloc(((Component)__instance).transform.position, num, collider_array, LayerMask.op_Implicit(AM.PLM), (QueryTriggerInteraction)2); for (int i = 0; i < num2; i++) { if ((Object)(object)collider_array[i] != (Object)null && !((Object)(object)collider_array[i].attachedRigidbody == (Object)null) && !(((Object)collider_array[i].attachedRigidbody).name != "Head")) { SosigLink component = ((Component)collider_array[i].attachedRigidbody).gameObject.GetComponent<SosigLink>(); if ((Object)(object)component != (Object)null && component.S.m_hasPriority) { AIEvent val = new AIEvent((((Component)GM.CurrentPlayerBody).transform.position + ((Component)__instance).transform.position) / 2f, (AIEType)3, 1f, 1f); component.S.Priority.ProcessEvent(val); Sosig s = component.S; s.m_aggrolevel += 0.75f; } } } flag = true; } if (Random.value < 0.5f && !flag) { GM.CurrentSceneSettings.OnPerceiveableSound((__instance.Mass * 1000f + 50f) / 2f, (10f + ((Vector3)(ref __instance.m_velocity)).magnitude / 100f) / 3f, ((Component)__instance).transform.position, GM.CurrentPlayerBody.GetPlayerIFF(), GM.CurrentPlayerBody.PlayerEntities[0]); } } [HarmonyPatch(typeof(BallisticProjectile), "MoveBullet")] [HarmonyPrefix] private static bool BallisticProjectile_MoveBullet_prefix(BallisticProjectile __instance, float t) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_177f: Unknown result type (might be due to invalid IL or missing references) //IL_1784: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Invalid comparison between Unknown and I4 //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Invalid comparison between Unknown and I4 //IL_0967: Unknown result type (might be due to invalid IL or missing references) //IL_096d: Unknown result type (might be due to invalid IL or missing references) //IL_0982: Unknown result type (might be due to invalid IL or missing references) //IL_0989: Unknown result type (might be due to invalid IL or missing references) //IL_098e: Unknown result type (might be due to invalid IL or missing references) //IL_09f4: Unknown result type (might be due to invalid IL or missing references) //IL_09f5: Unknown result type (might be due to invalid IL or missing references) //IL_09f8: Unknown result type (might be due to invalid IL or missing references) //IL_09fd: Unknown result type (might be due to invalid IL or missing references) //IL_0a04: Unknown result type (might be due to invalid IL or missing references) //IL_0a0b: Invalid comparison between Unknown and I4 //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Invalid comparison between Unknown and I4 //IL_0a0f: Unknown result type (might be due to invalid IL or missing references) //IL_0a16: Invalid comparison between Unknown and I4 //IL_0901: Unknown result type (might be due to invalid IL or missing references) //IL_0907: Invalid comparison between Unknown and I4 //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Invalid comparison between Unknown and I4 //IL_090b: Unknown result type (might be due to invalid IL or missing references) //IL_0910: Unknown result type (might be due to invalid IL or missing references) //IL_0912: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Invalid comparison between Unknown and I4 //IL_0942: Unknown result type (might be due to invalid IL or missing references) //IL_0917: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_0946: Unknown result type (might be due to invalid IL or missing references) //IL_094e: Unknown result type (might be due to invalid IL or missing references) //IL_0959: Unknown result type (might be due to invalid IL or missing references) //IL_091f: Unknown result type (might be due to invalid IL or missing references) //IL_0924: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0aaa: Unknown result type (might be due to invalid IL or missing references) //IL_0ab1: Invalid comparison between Unknown and I4 //IL_0795: Unknown result type (might be due to invalid IL or missing references) //IL_07a7: Unknown result type (might be due to invalid IL or missing references) //IL_0af5: Unknown result type (might be due to invalid IL or missing references) //IL_0afc: Invalid comparison between Unknown and I4 //IL_0804: Unknown result type (might be due to invalid IL or missing references) //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_0831: Unknown result type (might be due to invalid IL or missing references) //IL_0841: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Expected O, but got Unknown //IL_0ca9: Unknown result type (might be due to invalid IL or missing references) //IL_0cb0: Invalid comparison between Unknown and I4 //IL_0f85: Unknown result type (might be due to invalid IL or missing references) //IL_0f87: Unknown result type (might be due to invalid IL or missing references) //IL_0f89: Unknown result type (might be due to invalid IL or missing references) //IL_0f8e: Unknown result type (might be due to invalid IL or missing references) //IL_1104: Unknown result type (might be due to invalid IL or missing references) //IL_1109: Unknown result type (might be due to invalid IL or missing references) //IL_110b: Unknown result type (might be due to invalid IL or missing references) //IL_1112: Unknown result type (might be due to invalid IL or missing references) //IL_1117: Unknown result type (might be due to invalid IL or missing references) //IL_111c: Unknown result type (might be due to invalid IL or missing references) //IL_1125: Unknown result type (might be due to invalid IL or missing references) //IL_112a: Unknown result type (might be due to invalid IL or missing references) //IL_112c: Unknown result type (might be due to invalid IL or missing references) //IL_1134: Unknown result type (might be due to invalid IL or missing references) //IL_1139: Unknown result type (might be due to invalid IL or missing references) //IL_113e: Unknown result type (might be due to invalid IL or missing references) //IL_1154: Unknown result type (might be due to invalid IL or missing references) //IL_1159: Unknown result type (might be due to invalid IL or missing references) //IL_0fa4: Unknown result type (might be due to invalid IL or missing references) //IL_0faf: Unknown result type (might be due to invalid IL or missing references) //IL_0fb9: Unknown result type (might be due to invalid IL or missing references) //IL_0fbe: Unknown result type (might be due to invalid IL or missing references) //IL_0fc3: Unknown result type (might be due to invalid IL or missing references) //IL_0fc5: Unknown result type (might be due to invalid IL or missing references) //IL_0fcc: Unknown result type (might be due to invalid IL or missing references) //IL_0fd1: Unknown result type (might be due to invalid IL or missing references) //IL_0fd6: Unknown result type (might be due to invalid IL or missing references) //IL_0fdf: Unknown result type (might be due to invalid IL or missing references) //IL_0fe4: Unknown result type (might be due to invalid IL or missing references) //IL_0fe6: Unknown result type (might be due to invalid IL or missing references) //IL_0fee: Unknown result type (might be due to invalid IL or missing references) //IL_0ff3: Unknown result type (might be due to invalid IL or missing references) //IL_0ff8: Unknown result type (might be due to invalid IL or missing references) //IL_100e: Unknown result type (might be due to invalid IL or missing references) //IL_1013: Unknown result type (might be due to invalid IL or missing references) //IL_1015: Unknown result type (might be due to invalid IL or missing references) //IL_1017: Unknown result type (might be due to invalid IL or missing references) //IL_11e6: Unknown result type (might be due to invalid IL or missing references) //IL_1084: Unknown result type (might be due to invalid IL or missing references) //IL_108f: Unknown result type (might be due to invalid IL or missing references) //IL_1099: Unknown result type (might be due to invalid IL or missing references) //IL_109e: Unknown result type (might be due to invalid IL or missing references) //IL_10a3: Unknown result type (might be due to invalid IL or missing references) //IL_10a5: Unknown result type (might be due to invalid IL or missing references) //IL_10a6: Unknown result type (might be due to invalid IL or missing references) //IL_10b2: Unknown result type (might be due to invalid IL or missing references) //IL_10b7: Unknown result type (might be due to invalid IL or missing references) //IL_10b9: Unknown result type (might be due to invalid IL or missing references) //IL_10c1: Unknown result type (might be due to invalid IL or missing references) //IL_1209: Unknown result type (might be due to invalid IL or missing references) //IL_120b: Unknown result type (might be due to invalid IL or missing references) //IL_11fc: Unknown result type (might be due to invalid IL or missing references) //IL_11fe: Unknown result type (might be due to invalid IL or missing references) //IL_1203: Unknown result type (might be due to invalid IL or missing references) //IL_10d2: Unknown result type (might be due to invalid IL or missing references) //IL_10da: Unknown result type (might be due to invalid IL or missing references) //IL_10df: Unknown result type (might be due to invalid IL or missing references) //IL_10e4: Unknown result type (might be due to invalid IL or missing references) //IL_1231: Unknown result type (might be due to invalid IL or missing references) //IL_1236: Unknown result type (might be due to invalid IL or missing references) //IL_118e: Unknown result type (might be due to invalid IL or missing references) //IL_1192: Unknown result type (might be due to invalid IL or missing references) //IL_1197: Unknown result type (might be due to invalid IL or missing references) //IL_10f2: Unknown result type (might be due to invalid IL or missing references) //IL_10f7: Unknown result type (might be due to invalid IL or missing references) //IL_1241: Unknown result type (might be due to invalid IL or missing references) //IL_1248: Invalid comparison between Unknown and I4 //IL_12a8: Unknown result type (might be due to invalid IL or missing references) //IL_12af: Invalid comparison between Unknown and I4 //IL_1291: Unknown result type (might be due to invalid IL or missing references) //IL_12b3: Unknown result type (might be due to invalid IL or missing references) //IL_12ba: Invalid comparison between Unknown and I4 //IL_12e1: Unknown result type (might be due to invalid IL or missing references) //IL_12e8: Expected O, but got Unknown //IL_12eb: Unknown result type (might be due to invalid IL or missing references) //IL_161c: Unknown result type (might be due to invalid IL or missing references) //IL_1621: Unknown result type (might be due to invalid IL or missing references) //IL_1624: Unknown result type (might be due to invalid IL or missing references) //IL_162a: Invalid comparison between Unknown and I4 //IL_1301: Unknown result type (might be due to invalid IL or missing references) //IL_1306: Unknown result type (might be due to invalid IL or missing references) //IL_1308: Unknown result type (might be due to invalid IL or missing references) //IL_131f: Expected I4, but got Unknown //IL_1634: Unknown result type (might be due to invalid IL or missing references) //IL_1639: Unknown result type (might be due to invalid IL or missing references) //IL_162d: Unknown result type (might be due to invalid IL or missing references) //IL_1632: Unknown result type (might be due to invalid IL or missing references) //IL_15fc: Unknown result type (might be due to invalid IL or missing references) //IL_1604: Unknown result type (might be due to invalid IL or missing references) //IL_160f: Unknown result type (might be due to invalid IL or missing references) //IL_15d1: Unknown result type (might be due to invalid IL or missing references) //IL_15e2: Unknown result type (might be due to invalid IL or missing references) //IL_15ed: Unknown result type (might be due to invalid IL or missing references) //IL_13c2: Unknown result type (might be due to invalid IL or missing references) //IL_13c7: Unknown result type (might be due to invalid IL or missing references) //IL_13c9: Unknown result type (might be due to invalid IL or missing references) //IL_13e0: Expected I4, but got Unknown //IL_166b: Unknown result type (might be due to invalid IL or missing references) //IL_1670: Unknown result type (might be due to invalid IL or missing references) //IL_168a: Unknown result type (might be due to invalid IL or missing references) //IL_168f: Unknown result type (might be due to invalid IL or missing references) //IL_1691: Unknown result type (might be due to invalid IL or missing references) //IL_1694: Unknown result type (might be due to invalid IL or missing references) //IL_169c: Unknown result type (might be due to invalid IL or missing references) //IL_16a9: Expected I4, but got Unknown //IL_156a: Unknown result type (might be due to invalid IL or missing references) //IL_156f: Unknown result type (might be due to invalid IL or missing references) //IL_157c: Unknown result type (might be due to invalid IL or missing references) //IL_1581: Unknown result type (might be due to invalid IL or missing references) //IL_1588: Unknown result type (might be due to invalid IL or missing references) //IL_1589: Unknown result type (might be due to invalid IL or missing references) //IL_1747: Unknown result type (might be due to invalid IL or missing references) //IL_1749: Unknown result type (might be due to invalid IL or missing references) //IL_1750: Unknown result type (might be due to invalid IL or missing references) //IL_172c: Unknown result type (might be due to invalid IL or missing references) //IL_172e: Unknown result type (might be due to invalid IL or missing references) //IL_16ca: Unknown result type (might be due to invalid IL or missing references) //IL_16cf: Unknown result type (might be due to invalid IL or missing references) //IL_16d0: Unknown result type (might be due to invalid IL or missing references) //IL_16d5: Unknown result type (might be due to invalid IL or missing references) //IL_16d8: Unknown result type (might be due to invalid IL or missing references) //IL_16e0: Unknown result type (might be due to invalid IL or missing references) //IL_16ed: Expected I4, but got Unknown //IL_16f5: Unknown result type (might be due to invalid IL or missing references) //IL_16fa: Unknown result type (might be due to invalid IL or missing references) //IL_16fb: Unknown result type (might be due to invalid IL or missing references) //IL_1700: Unknown result type (might be due to invalid IL or missing references) //IL_1703: Unknown result type (might be due to invalid IL or missing references) //IL_170b: Unknown result type (might be due to invalid IL or missing references) //IL_1718: Expected I4, but got Unknown if (__instance.Source_IFF != GM.CurrentPlayerBody.m_playerIFF) { return true; } __instance.movesThisFrame++; if (__instance.movesThisFrame > 2) { return false; } if (__instance.m_velocity.y < 0f && __instance.DeletesOnStraightDown) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(__instance.m_velocity.x, 0f, __instance.m_velocity.z); if (((Vector3)(ref val)).magnitude < 0.1f && ((Component)__instance).transform.position.y < GM.CurrentSceneSettings.CatchHeight) { goto IL_1792; } } if (((Component)__instance).transform.position.y >= -350f) { Vector3 val2 = ((Component)__instance).transform.position; if (__instance.m_isInReferenceTransform && (Object)(object)__instance.m_transReference != (Object)null) { val2 = __instance.m_transReference.TransformPoint(__instance.m_localReferencePoint); } __instance.m_isInReferenceTransform = false; __instance.m_transReference = null; Vector3 normalized = ((Vector3)(ref __instance.m_velocity)).normalized; float magnitude = ((Vector3)(ref __instance.m_velocity)).magnitude; float num = magnitude * t * __instance.FlightVelocityMultiplier * __instance.m_debugFlightVelGlobal; if (__instance.needsSecondCast) { num = Mathf.Clamp(num - __instance.distMoved, 0f, num); } __instance.needsSecondCast = false; if (!Physics.Raycast(val2, normalized, ref __instance.m_hit, num, LayerMask.op_Implicit(__instance.LM), (QueryTriggerInteraction)2)) { ((Component)__instance).transform.position = val2 + __instance.m_velocity * t * __instance.FlightVelocityMultiplier * __instance.m_debugFlightVelGlobal; if (!__instance.m_hasPlayedWhoosh && __instance.Source_IFF != GM.CurrentPlayerBody.GetPlayerIFF()) { Vector3 closestValidPoint = __instance.GetClosestValidPoint(val2, ((Component)__instance).transform.position, __instance.m_cachedHead.position); float num2 = Vector3.Distance(closestValidPoint, __instance.m_cachedHead.position); if (num2 < 3f) { float num3 = Mathf.Lerp(1f, 0.2f, Mathf.Clamp(num2 - 1f, 0f, 2f) * 0.5f); Vector3 val3 = __instance.m_cachedHead.position - val2; if (Vector3.Dot(((Vector3)(ref val3)).normalized, normalized) > 0f) { __instance.m_hasPlayedWhoosh = true; SM.PlayBulletImpactHit((BulletImpactSoundType)28, closestValidPoint, num3, 1f); } } } if (!(((Vector3)(ref __instance.m_velocity)).normalized != Vector3.zero)) { } } else { __instance.m_isTumbling = true; if ((Object)(object)__instance.m_lastColliderHit != (Object)null && (Object)(object)((RaycastHit)(ref __instance.m_hit)).collider == (Object)(object)__instance.m_lastColliderHit) { __instance.needsSecondCast = true; __instance.distMoved = ((RaycastHit)(ref __instance.m_hit)).distance; ((Component)__instance).transform.position = ((RaycastHit)(ref __instance.m_hit)).point - ((RaycastHit)(ref __instance.m_hit)).normal * 0.001f; if (log_bullet_events) { Logger.LogDebug((object)"MoveBullet will now call itself."); } __instance.MoveBullet(t); return false; } bool flag = false; if ((Object)(object)((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody != (Object)null) { flag = true; } __instance.m_lastColliderHit = ((RaycastHit)(ref __instance.m_hit)).collider; bool flag2 = false; IFVRDamageable component = ((Component)((Component)((RaycastHit)(ref __instance.m_hit)).collider).transform).gameObject.GetComponent<IFVRDamageable>(); if (component == null && flag) { component = ((Component)((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody).gameObject.GetComponent<IFVRDamageable>(); } if (component != null) { flag2 = true; } if (__instance.DoesIgniteOnHit && Random.Range(0f, 1f) < __instance.IgnitionChance) { FVRIgnitable component2 = ((Component)((Component)((RaycastHit)(ref __instance.m_hit)).collider).transform).gameObject.GetComponent<FVRIgnitable>(); if ((Object)(object)component2 != (Object)null) { FXM.Ignite(component2, 1f); } else if (flag) { component2 = ((Component)((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody).GetComponent<FVRIgnitable>(); if ((Object)(object)component2 != (Object)null) { FXM.Ignite(component2, 1f); } } } if (flag && __instance.DoesVaporizeOnHit && Random.Range(0f, 1f) < __instance.VaporizeChange) { IVaporizable component3 = ((Component)((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody).gameObject.GetComponent<IVaporizable>(); if (component3 != null) { component3.Vaporize(__instance.Source_IFF); } } bool flag3 = false; PMat component4 = ((Component)((Component)((RaycastHit)(ref __instance.m_hit)).collider).transform).gameObject.GetComponent<PMat>(); if ((Object)(object)component4 == (Object)null && flag) { component4 = ((Component)((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody).gameObject.GetComponent<PMat>(); } if ((Object)(object)component4 != (Object)null && (Object)(object)component4.MatDef != (Object)null) { flag3 = true; } Rigidbody val4 = null; bool flag4 = false; if (flag) { val4 = ((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody; flag4 = true; __instance.m_isInReferenceTransform = true; __instance.m_transReference = ((Component)((RaycastHit)(ref __instance.m_hit)).collider.attachedRigidbody).gameObject.transform; } MatDef val5 = (flag3 ? component4.MatDef : PM.DefaultMatDef); if (__instance.GeneratesImpactSound && (int)GM.Options.SimulationOptions.HitSoundMode2 == 1) { float num4 = 0.8f; float num5 = 1f; if ((int)__instance.ImpactFXMagnitude == 4 || (int)__instance.ImpactFXMagnitude == 1) { num5 = 0.4f; num4 = 1.3f; } else if ((int)__instance.ImpactFXMagnitude == 2) { num5 = 0.7f; num4 = 1f; } num5 *= Mathf.InverseLerp(0f, __instance.m_initialMuzzleVelocity, magnitude); SM.PlayBulletImpactHit(val5.BulletImpactSound, ((RaycastHit)(ref __instance.m_hit)).point, 25f, num5, num4); if (hit_sound.Value && (int)val5.BulletImpactSound == 13 && Vector3.Distance(((RaycastHit)(ref __instance.m_hit)).point, GM.CurrentPlayerBody.Head.position) >= 5f) { SM.PlayBulletImpactHit(val5.BulletImpactSound, GM.CurrentPlayerBody.Head.position + GM.CurrentPlayerBody.Head.forward * 1f, 10f, Random.Range(0.4f, 0.7f) * hit_sound_vol.Value, 2f - (__instance.Dimensions.x + __instance.Dimensions.z + __instance.Mass * 5f)); } } if (em_alert_mod.Value) { float num6 = 5f + (__instance.Dimensions.x * 10f + __instance.Mass * 100f); byte b = 0; int num7 = Physics.OverlapSphereNonAlloc(((Component)__instance).transform.position, num6, collider_array, LayerMask.op_Implicit(AM.PLM), (QueryTriggerInteraction)2); for (int i = 0; i < num7; i++) { if (!((Object)(object)collider_array[i] != (Object)null) || (Object)(object)collider_array[i].attachedRigidbody == (Object)null || ((Object)collider_array[i].attachedRigidbody).name != "Head") { continue; } SosigLink component5 = ((Component)collider_array[i].attachedRigidbody).gameObject.GetComponent<SosigLink>(); if ((Object)(object)component5 != (Object)null) { if (log_bullet_events) { Logger.LogInfo((object)("\tentities[" + i + "] dist = " + Vector3.Distance(((Component)__instance).transform.position, ((Component)collider_array[i]).transform.position) + " m,\tenemy = " + ((Object)component5.S).GetInstanceID())); b++; } if (component5.S.m_hasPriority) { _ = (((Component)GM.CurrentPlayerBody).transform.position + ((Component)__instance).transform.position) / 2f; AIEvent val6 = new AIEvent(((Component)collider_array[i]).transform.position, (AIEType)3, 1f, 1f); component5.S.Priority.ProcessEvent(val6); Sosig s = component5.S; s.m_aggrolevel += 0.5f; } } } if (log_bullet_events && b != 0) { ManualLogSource logger = Logger; string[] obj = new string[7] { "Bullet impact OverlapSphere (radius = ", num6.ToString(), " m) at ", Time.frameCount.ToString(), " found ", null, null }; int num8 = b; obj[5] = num8.ToString(); obj[6] = " enemies"; logger.LogInfo((object)string.Concat(obj)); } } if (!flag && __instance.GeneratesImpactDecals && (int)GM.Options.SimulationOptions.HitDecalMode2 == 1) { BulletHoleDecalType val7 = val5.BulletHoleType; if ((int)val7 != 0 && (int)__instance.BulletHoleDecalOverride != 0) { val7 = __instance.BulletHoleDecalOverride; } float num9 = Mathf.Clamp(__instance.Dimensions.x, 0.0001f, 0.02f); if ((int)val7 != 0) { FXM.SpawnBulletDecal(val7, ((RaycastHit)(ref __instance.m_hit)).point, ((RaycastHit)(ref __instance.m_hit)).normal, num9); } } BallisticMatSeries matSeries = PM.GetMatSeries(val5.BallisticType, __instance.ProjType); float ricochetLimit = matSeries.RicochetLimit; float num10 = Vector3.Angle(normalized, -((RaycastHit)(ref __instance.m_hit)).normal); bool flag5 = false; bool flag6 = false; bool flag7 = false; bool flag8 = false; float num11 = 0.5f * __instance.Mass * Mathf.Pow(magnitude, 2f) / __instance.FrontArea * 0.01f / 140f; float num12 = 0.5f * __instance.Mass * Mathf.Pow(magnitude, 2f); float num13 = 0f; Vector3 val8 = normalized; Vector3 velocity = __instance.m_velocity; bool flag9 = false; if (((int)matSeries.MaterialType == 110 || (int)matSeries.MaterialType == 61) && flag4) { flag9 = true; } if (num10 >= ricochetLimit) { flag5 = true; } float num14 = 1f - num10 / 90f; num14 = Mathf.Max(num14, matSeries.MinAngularAbsord); float num15 = Mathf.Lerp(0f, matSeries.Absorption, num14); float num16 = num11 * num14; bool flag10 = false; float num17 = 1f; if (flag9 && bullet_pen_mod.Value) { if (num16 < matSeries.PenThreshold) { if (log_bullet_events) { Logger.LogDebug((object)"> This bullet could not normally penetrate armor.\t<\t<"); } flag10 = true; } if ((int)matSeries.MaterialType == 110) { Logger.LogDebug((object)(((Object)__instance).name + " " + ((Object)__instance).GetInstanceID() + " hit Lv 1 armor")); impact_frame = Time.frameCount; armor_lv = 1; } else if ((int)matSeries.MaterialType == 61) { Logger.LogDebug((object)(((Object)__instance).name + " " + ((Object)__instance).GetInstanceID() + " hit Lv 2 armor")); impact_frame = Time.frameCount; armor_lv = 2; } else { Logger.LogDebug((object)"???"); impact_frame = Time.frameCount - 10; armor_lv = 0; } if (((Object)__instance).name.EndsWith("JHP(Clone)") || ((Object)__instance).name.EndsWith("SP(Clone)")) { if (log_bullet_events) { if (((Object)__instance).name.EndsWith("JHP(Clone)")) { Logger.LogWarning((object)(((Object)__instance).name + " " + ((Object)__instance).GetInstanceID() + " is a hollow-point, penetration reduced.")); } if (((Object)__instance).name.EndsWith("SP(Clone)")) { Logger.LogWarning((object)(((Object)__instance).name + " " + ((Object)__instance).GetInstanceID() + " is a soft-point, which is not only toxic and harmful to the environment because it's exposed lead, but it's banned under the Hague conventions.\nAlso, penetration reduced.")); } } if (flag10) { num17 = 0.5f; flat_bullet = true; } } else { flat_bullet = false; if (flag10) { if (armor_lv == 1) { num17 = 0.06f; was_this_bullet_able_to_pierce_armor_normally = false; } else if (armor_lv == 2) { num17 = 0.05f; was_this_bullet_able_to_pierce_armor_normally = false; } } } } else { was_this_bullet_able_to_pierce_armor_normally = true; } if (!bullet_pen_mod.Value || !flag10) { num17 = 1f; was_this_bullet_able_to_pierce_armor_normally = true; } Logger.LogDebug((object)("was_this_bullet_able_to_pierce_armor_normally = " + was_this_bullet_able_to_pierce_armor_normally)); if (log_bullet_events && ((int)matSeries.MaterialType == 50 || flag9)) { Logger.LogDebug((object)("matSeries.MinAngularAbsord = " + matSeries.MinAngularAbsord + ", Absorption = " + matSeries.Absorption + ", Roughness = " + matSeries.Roughness)); Logger.LogDebug((object)("impact_aspect = " + num14 + " (after limiting),\n\tabsorption = " + num15 + ",\n\tpressure2 = " + num11 + " * " + num14 + " = " + num16)); Logger.LogDebug((object)("penmod = " + num17)); } float num19; float num20; if (num16 > matSeries.PenThreshold * num17 && !__instance.IsDisabledOnFirstImpact) { flag6 = true; float num18 = Mathf.Clamp(matSeries.PenThreshold * num17 / num16 + num15, 0f, 1f); num13 = num18 * num12; num19 = num12 - num13; num20 = num18 * num11; if (flag9 && log_bullet_events) { Logger.LogWarning((object)"> bullet penetrated armor <"); Logger.LogDebug((object)("impact_force_num8 = " + num13 + ", \n\tpiercing_amount = " + num18 + ", \n\tKE after penetration = " + num19 + ", \n\tpiercing damage = " + num20 + " <")); } } else if (num13 > matSeries.ShatterThreshold || __instance.IsDisabledOnFirstImpact) { flag7 = true; num13 = num12; num19 = 0f; num20 = num11; if (flag9 && log_bullet_events) { Logger.LogDebug((object)"bullet shattered?"); } } else { num13 = num12 * num14; num19 = num12 - num13; num20 = num11 * num14; flag5 = true; float num21 = Mathf.Clamp(num13 / num12 + num15, 0f, 1f); num13 = num21 * num12; num19 = num12 - num13; num20 = num11 * num21; if (flag9 && log_bullet_events) { Logger.LogDebug((object)("bullet failed to pierce armor?\n\tKE after impact = " + num19 + "\n\tpiercing_damage_num14 = " + num11 + " * " + num21 + " = " + num19)); } } if (__instance.m_usesSubmunitions) { flag7 = true; flag8 = true; } Vector3 val9 = val8; Vector3 onUnitSphere = Random.onUnitSphere; Vector3 val10; if (flag5 && !flag7) { val10 = ((RaycastHit)(ref __instance.m_hit)).point + ((RaycastHit)(ref __instance.m_hit)).normal * 0.001f; val8 = Vector3.Lerp(Vector3.Reflect(normalized, ((RaycastHit)(ref __instance.m_hit)).normal), onUnitSphere, matSeries.Roughness); val8 = Vector3.Lerp(Vector3.ProjectOnPlane(val8, ((RaycastHit)(ref __instance.m_hit)).normal), val8, Mathf.Clamp(num14 * num14, 0.1f, 1f)); val9 = val8; if (flag9 && log_bullet_events) { Logger.LogDebug((object)("bullet bounced off " + ((object)Unsafe.As<MatBallisticType, MatBallisticType>(ref matSeries.MaterialType)/*cast due to .constrained prefix*/).ToString())); } } else if (flag6 && !flag7) { if (matSeries.StopsOnPen) { num13 = num12; num19 = 0f; num20 = num11; flag8 = true; } val10 = ((RaycastHit)(ref __instance.m_hit)).point - ((RaycastHit)(ref __instance.m_hit)).normal * 0.001f; val8 = Vector3.Lerp(normalized, onUnitSphere, matSeries.Roughness * num14); if (Vector3.Angle(val8, ((RaycastHit)(ref __instance.m_hit)).normal) < 90f) { val8 = Vector3.Reflect(val8, ((RaycastHit)(ref __instance.m_hit)).normal); } if (matSeries.DownGradesOnPen) { __instance.ProjType = matSeries.DownGradesTo; } } else { val10 = ((RaycastHit)(ref __instance.m_hit)).point; val9 = Vector3.Lerp(Vector3.Reflect(normalized, ((RaycastHit)(ref __instance.m_hit)).normal), onUnitSphere, matSeries.Roughness); val9 = Vector3.Lerp(Vector3.ProjectOnPlane(val8, ((RaycastHit)(ref __instance.m_hit)).normal), val8, Mathf.Clamp(num14 * num14, 0.1f, 1f)); } float num22 = 0f; if (!flag8 && !flag7 && num19 > 0f) { num22 = Mathf.Sqrt(2f * num19) / Mathf.Sqrt(__instance.Mass); velocity = val8 * num22; if (flag9 && log_bullet_events) { Logger.LogDebug((object)("V was " + ((Vector3)(ref velocity)).magnitude + ", is now " + ((Vector3)(ref val8)).magnitude * num22)); } } ((Component)__instance).transform.position = val10; if (__instance.m_isInReferenceTransform) { __instance.m_localReferencePoint = __instance.m_transReference.InverseTransformPoint(val10); } __instance.m_velocity = velocity; if (flag8 || flag7 || num22 <= 0f || num19 <= 0f) { __instance.m_isMoving = false; __instance.m_velocity = Vector3.zero; if ((flag9 || (int)matSeries.MaterialType == 51) && log_bullet_events) { Logger.LogDebug((object)("bullet stopped in " + ((object)Unsafe.As<MatBallisticType, MatBallisticType>(ref matSeries.MaterialType)/*cast due to .constrained prefix*/).ToString())); } if ((Object)(object)__instance.Trail != (Object)null) { __instance.Trail.AddPosition(((Component)__instance).transform.position); } } float num23 = num13; float num24 = 0f; if ((int)matSeries.MaterialType == 51 || (int)matSeries.MaterialType == 50) { num24 = Mathf.Clamp(num19, 0f, matSeries.PenThreshold * 2f * num14); } if (flag2) { Damage val11 = new Damage(); val11.Class = (DamageClass)1; val11.Dam_TotalKinetic = num13; if (flag6) { BallisticProjectileType projType = __instance.ProjType; switch ((int)projType) { case 0: val11.Dam_Piercing = num20 * 0.3f; val11.Dam_Blunt = num13 * 0.7f; break; case 1: val11.Dam_Piercing = num20 * 0.5f; val11.Dam_Blunt = num13 * 0.5f; break; case 2: val11.Dam_Piercing = num20 * 0.7f; val11.Dam_Blunt = num13 * 0.3f; break; case 3: val11.Dam_Piercing = num20 * 0.9f; val11.Dam_Blunt = num13 * 0.1f; break; } val11.Dam_Piercing += num24 * 1f; } else if (flag7) { BallisticProjectileType projType = __instance.ProjType; switch ((int)projType) { case 0: val11.Dam_Piercing = num20 * 0.1f; val11.Dam_Blunt = num13 * 0.9f; break; case 1: val11.Dam_Piercing = num20 * 0.3f; val11.Dam_Blunt = num13 * 0.7f; break; case 2: val11.Dam_Piercing = num20 * 0.4f; val11.Dam_Blunt = num13 * 0.6f; break; case 3: val11.Dam_Piercing = num20 * 0.5f; val11.Dam_Blunt = num13 * 0.5f; break; } } else if (flag5) { val11.Dam_Blunt = num13; } if (__instance.DoesIgniteOnHit) { val11.Dam_Thermal = 50f; } if (__instance.Source_IFF == GM.CurrentPlayerBody.GetPlayerIFF() && (GM.CurrentPlayerBody.isDamPowerUp || GM.CurrentPlayerBody.IsDamPowerDown)) { float damageMult = GM.CurrentPlayerBody.GetDamageMult(); val11.Dam_Piercing *= damageMult; val11.Dam_Blunt *= damageMult; val11.Dam_Cutting *= damageMult; val11.Dam_TotalKinetic *= damageMult; val11.Dam_Blinding *= damageMult; val11.Dam_Chilling *= damageMult; val11.Dam_EMP *= damageMult; val11.Dam_Stunning *= damageMult; val11.Dam_Thermal *= damageMult; val11.Dam_TotalEnergetic *= damageMult; } val11.point = ((RaycastHit)(ref __instance.m_hit)).point; val11.hitNormal = ((RaycastHit)(ref __instance.m_hit)).normal; val11.strikeDir = normalized; val11.damageSize = __instance.Dimensions.x; val11.Source_IFF = __instance.Source_IFF; num23 = val11.Dam_Blunt; component.Damage(val11); } if (flag4) { if (bullet_pen_mod.Value) { val4.AddForceAtPosition(normalized * Mathf.Sqrt(num23 * (num12 / 50f)), ((RaycastHit)(ref __instance.m_hit)).point, (ForceMode)0); } else { val4.AddForceAtPosition(normalized * Mathf.Sqrt(num23), ((RaycastHit)(ref __instance.m_hit)).point, (ForceMode)0); } } BallisticImpactEffectType val12 = val5.ImpactEffectType; if ((int)__instance.ImpactEffectTypeOverride != -1) { val12 = __instance.ImpactEffectTypeOverride; } Color val13 = Color.white; bool flag11 = false; if (GM.Options.SimulationOptions.TracerColorOverride > 0 && __instance.m_hasTracer) { flag11 = true; val13 = __instance.TracerRenderer.sharedMaterial.GetColor("_Color"); } if (flag7 || flag5) { if (magnitude > 100f) { FXM.SpawnImpactEffect(((RaycastHit)(ref __instance.m_hit)).point, val9, (int)val12, __instance.ImpactFXMagnitude, false, flag11, val13, __instance.OverrideImpactMat); } } else if (flag6 && magnitude > 100f) { if (flag8 || num22 == 0f) { FXM.SpawnImpactEffect(((RaycastHit)(ref __instance.m_hit)).point, -normalized, (int)val12, __instance.ImpactFXMagnitude, false, flag11, val13, __instance.OverrideImpactMat); } else { FXM.SpawnImpactEffect(((RaycastHit)(ref __instance.m_hit)).point, -normalized, (int)val12, __instance.ImpactFXMagnitude, true, flag11, val13, __instance.OverrideImpactMat); } } if (__instance.GeneratesSuppressionEvent) { __instance.GeneratesSuppressionEvent = false; GM.CurrentSceneSettings.OnSuppressingEvent(val10, normalized, __instance.Source_IFF, __instance.SuppressionIntensity, __instance.SuppressionRange); } __instance.FireSubmunitions(val9, normalized, ((RaycastHit)(ref __instance.m_hit)).point, ((Vector3)(ref __instance.m_velocity)).magnitude); __instance.m_stallFrames = Random.Range(0, 3); } __instance.m_distanceTraveled += Vector3.Distance(((Component)__instance).transform.position, val2); return false; } goto IL_1792; IL_1792: __instance.m_isMoving = false; return false; } [HarmonyPatch(typeof(SosigLink), "Damage")] [HarmonyPrefix] private static bool SosigLink_Damage_prefix(SosigLink __instance, Damage d) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_0734: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Expected O, but got Unknown //IL_0adf: Unknown result type (might be due to invalid IL or missing references) //IL_0ae5: Unknown result type (might be due to invalid IL or missing references) bool flag = false; bool flag2 = false; if ((int)d.Class == 1 && d.Source_IFF == GM.CurrentPlayerBody.m_playerIFF) { flag = true; if (log_bullet_events) { Logger.LogDebug((object)("Time.frameCount - impact_frame = " + (Time.frameCount - impact_frame))); ManualLogSource logger = Logger; int num = armor_lv; logger.LogDebug((object)("armor_lv = " + num)); } if (Time.frameCount - impact_frame < 5 && armor_lv != 0 && bullet_pen_mod.Value) { if (was_this_bullet_able_to_pierce_armor_normally) { if (log_bullet_events) { Logger.LogWarning((object)"was_this_bullet_able_to_pierce_armor_normally == true; skipping damage edits."); } } else { flag2 = true; if (log_bullet_events) { Logger.LogWarning((object)"Damage override = true\t<\t<"); Logger.LogDebug((object)("Time.frameCount - impact_frame = " + (Time.frameCount - impact_frame))); Logger.LogDebug((object)("was_this_bullet_able_to_pierce_armor_normally = " + was_this_bullet_able_to_pierce_armor_normally)); } if (armor_lv == 1) { if (log_bullet_events) { Logger.LogDebug((object)"Attempting to edit damage params (lv1)..."); } if (d.Dam_Blunt > 500f) { d.Dam_Blunt = (d.Dam_Blunt + 500f) / 2f; } if (d.Dam_Blunt > 600f) { d.Dam_Blunt = 600f; } if (flat_bullet) { if (d.Dam_Blunt > 200f) { d.Dam_Blunt = (d.Dam_Blunt + 200f) / 2f; } if (d.Dam_Blunt > 300f) { d.Dam_Blunt = 300f; } } d.Dam_Piercing = (d.Dam_Piercing + d.Dam_Blunt / 10f) / 2f; } if (armor_lv == 2) { if (log_bullet_events) { Logger.LogDebug((object)"Attempting to edit damage params (lv2)..."); } if (d.Dam_Blunt > 200f) { d.Dam_Blunt = (d.Dam_Blunt + 200f + 200f) / 3f; } d.Dam_Piercing = (d.Dam_Piercing + d.Dam_Blunt / 100f) / 2f; if (d.Dam_Blunt > 200f) { d.Dam_Blunt = 200f; } if (flat_bullet) { if (d.Dam_Blunt > 50f) { d.Dam_Blunt = (d.Dam_Blunt + 50f + 50f) / 3f; } if (d.Dam_Blunt > 50f) { d.Dam_Blunt = 50f; } } } } } float num2 = Vector3.Angle(d.strikeDir, -d.hitNormal); float num3 = Mathf.Clamp((1f - num2 / 90f) * 1.5f, 0.4f, 1.5f); if (flag && bullet_pen_mod.Value) { num3 *= pl_out_dmg_mult.Value; if (num3 > 1.5f) { num3 = 1.5f; } if (num3 < 0.3f) { num3 = 0.3f; } } d.Dam_Blunt *= num3; d.Dam_Cutting *= num3; d.Dam_Piercing *= num3; d.Dam_TotalKinetic *= num3; if (__instance.S.IsFrozen) { d.Dam_Blunt *= 3f; d.Dam_Cutting *= 0.2f; d.Dam_Piercing *= 0.02f; } if ((Object)(object)__instance.S != (Object)null) { if (flag && em_alert_mod.Value) { AIEvent val = new AIEvent(GM.CurrentPlayerBody.PlayerEntities[0], (AIEType)3, 10f, 0.1f); __instance.S.Priority.ProcessEvent(val); Sosig s = __instance.S; s.m_aggrolevel += 1f; } if (__instance.S.IsInvuln) { return true; } float num4 = 1f; if (__instance.S.IsDamResist || __instance.S.IsDamMult) { num4 = __instance.S.BuffIntensity_DamResistHarm; } if (__instance.S.IsFragile) { num4 *= 100f; } d.Dam_Blunt *= num4; d.Dam_Cutting *= num4; d.Dam_Piercing *= num4; d.Dam_TotalKinetic *= num4; d.Dam_Thermal *= num4; d.Dam_Chilling *= num4; d.Dam_EMP *= num4; d.Dam_Blunt *= __instance.S.DamMult_Projectile; d.Dam_Cutting *= __instance.S.DamMult_Projectile; d.Dam_Piercing *= __instance.S.DamMult_Projectile; d.Dam_TotalKinetic *= __instance.S.DamMult_Projectile; } d.Dam_Thermal *= __instance.S.DamMult_Thermal; d.Dam_Chilling *= __instance.S.DamMult_Chilling; d.Dam_EMP *= __instance.S.DamMult_EMP; __instance.S.ProcessDamage(d, __instance); bool flag3 = false; if (__instance.m_integrity > 0f) { if (flag && log_bullet_events) { Logger.LogWarning((object)"> BULLET DAMAGED ENEMY <\t<\t<\t<"); Logger.LogDebug((object)("damage_override = " + flag2)); Logger.LogDebug((object)("impact_angle = " + num2 + ",\t impact_aspect = " + num3)); Logger.LogDebug((object)("(sosiglink damage) damage params:\n\tblunt: " + d.Dam_Blunt + "\n\tpiercing: " + d.Dam_Piercing + "\n\tkinetic: " + d.Dam_TotalKinetic + "\n\tDamMult: " + __instance.DamMult)); float num5 = d.Dam_Blunt * 0.032f; num5 += Mathf.Clamp((d.Dam_Piercing - 500f) * 0.008f, 0f, 100f); num5 += Mathf.Clamp((d.Dam_Cutting - 500f) * 0.008f, 0f, 100f); num5 += Mathf.Clamp(d.Dam_Thermal * 0.01f, 0f, 100f); num5 = Mathf.Clamp(num5 * __instance.DamMult, 0f, 100f); Logger.LogDebug((object)("integrity damage " + num5)); } flag3 = __instance.DamageIntegrity(d); } if (d.Dam_TotalKinetic > 80f) { __instance.S.RequestHitDecal(d.point, d.hitNormal, d.damageSize * 2f, __instance); } if (__instance.S.Mustard > 0f && !flag3) { float num6 = (d.Dam_Piercing + d.Dam_Cutting + d.Dam_TotalKinetic / 4f - 50f) * 0.05f; float damMult = __instance.DamMult; num6 = Mathf.Clamp(num6 * damMult, 0f, 100f); __instance.S.SetLastIFFDamageSource(d.Source_IFF); if (flag) { if (!flag2) { if (log_bullet_events) { num6 *= pl_out_dmg_mult.Value; if (num6 > 100f) { num6 = 100f; } Logger.LogDebug((object)("bleeding amount = (" + d.Dam_Piercing + " + " + d.Dam_Cutting + " + " + d.Dam_TotalKinetic / 4f + " - 50f) * 0.05f = " + num6)); } } else if (bullet_pen_mod.Value) { if (armor_lv == 1) { num6 = (d.Dam_Piercing + d.Dam_Cutting + d.Dam_TotalKinetic / 5f - 50f) * 0.05f; damMult = __instance.DamMult; num6 = Mathf.Clamp(num6 * damMult, 0f, 100f); if (num6 < 5f) { num6 = (num6 + num6 + 5f) / 3f; } num6 *= pl_out_dmg_mult.Value; if (num6 > 100f) { num6 = 100f; } if (log_bullet_events) { Logger.LogDebug((object)("bleeding amount = (" + d.Dam_Piercing + " + " + d.Dam_Cutting + " + " + d.Dam_TotalKinetic / 5f + " - 50f) * 0.05f (+ dmg mult / 2) = " + num6 + " (lv1)")); } } if (armor_lv == 2) { num6 = (d.Dam_Piercing + d.Dam_Cutting + d.Dam_TotalKinetic / 8f - 50f) * 0.05f; damMult = __instance.DamMult; num6 = Mathf.Clamp(num6 * damMult, 0f, 100f); if (num6 < 2f) { num6 = (num6 + 2f + 2f) / 3f; } num6 *= pl_out_dmg_mult.Value; if (num6 > 100f) { num6 = 100f; } if (log_bullet_events) { Logger.LogDebug((object)("bleeding amount = (" + d.Dam_Piercing + " + " + d.Dam_Cutting + " + " + d.Dam_TotalKinetic / 8f + " - 50f) * 0.05f (+ dmg mult / 2) = " + num6 + " (lv2)")); } } } if (log_bullet_events) { if (num6 < 1f) { Logger.LogError((object)"> Impact is too weak to cause bleeding. <"); } else { Logger.LogDebug((object)("bleeding amount = " + num6)); } } } __instance.S.AccurueBleedingHit(__instance, d.point, d.strikeDir, num6); } return false; } return true; } [HarmonyPatch(typeof(Sosig), "Configure")] [HarmonyPostfix] private static void Sosig_Configure_prefix(Sosig __instance) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (red_blood.Value) { Color val = default(Color); ((Color)(ref val))..ctor(0.7f, 0f, 0f, 1f); ((Renderer)__instance.DamageFX_SmallMustardBurst.GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", val); ((Renderer)__instance.DamageFX_LargeMustardBurst.GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", val); ((Renderer)__instance.DamageFX_MustardSpoutSmall.GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", val); ((Renderer)__instance.DamageFX_MustardSpoutLarge.GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", val); ((Renderer)__instance.DamageFX_Explosion.GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", val); } } [HarmonyPatch(typeof(SosigWeapon), "TryToFireGun", new Type[] { typeof(Vector3), typeof(bool), typeof(bool), typeof(bool), typeof(float), typeof(bool) })] [HarmonyPrefix] private static bool SosigWeapon_TryToFireGun_prefix1(SosigWeapon __instance, Vector3 targetPos, bool isPanicFiring, bool targetPointIdentified, bool isClutching, float recoilMult, bool isHipfiring) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_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_00af: 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) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) if (!em_wpn_mod.Value) { return true; } __instance.ForcedRefireMin = 0f; if ((int)__instance.UsageState != 0) { return false; } if (__instance.m_refireTick > 0f) { if (__instance.isFullAuto) { __instance.m_refireTick -= Time.deltaTime * 1.1f; return false; } __instance.m_refireTick -= Time.deltaTime; return false; } if (!targetPointIdentified && !isPanicFiring) { return false; } Vector3 val = targetPos - __instance.Muzzle.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude > __instance.RangeMinMax.y && !isPanicFiring) { return false; } float num = __instance.GetCurrentAngularLimit(magnitude); if (isHipfiring) { num *= 4f; } float num2 = Vector3.Angle(Vector3.ProjectOnPlane(val, Vector3.up), Vector3.ProjectOnPlane(__instance.Muzzle.forward, Vector3.up)); float num3 = Vector3.Angle(Vector3.ProjectOnPlane(val, ((Component)__instance).transform.right), Vector3.ProjectOnPlane(__instance.Muzzle.forward, ((Component)__instance).transform.right)); float num4 = 0.5f; if (__instance.UsesBurstLimit && __instance.m_shotsLeftTilBurstLimit < 2) { num4 = 5f; } if (magnitude < 4f) { num4 = 5f; } if (magnitude < 2f) { num4 = 10f; } if (magnitude < 1f) { num4 = num; } bool flag = false; if (__instance.isFullAuto) { if (isClutching && (__instance.timeSinceFired < 0.01f || isPanicFiring)) { flag = true; } } else if (isClutching && (__instance.timeSinceFired < 0.1f || isPanicFiring)) { flag = true; } if ((num2 > num || num3 > Mathf.Min(num, num4)) && !isPanicFiring && !flag) { return false; } if (!isPanicFiring && !flag && !__instance.GetFireClear(__instance.Muzzle.position, __instance.Muzzle.forward, __instance.RangeMinMax.y, magnitude)) { return false; } __instance.FireGun(recoilMult); return false; } [HarmonyPatch(typeof(SosigWeapon), "UpdateRecoil")] [HarmonyPostfix] private static void SosigWeapon_UpdateRecoil_postfix(SosigWeapon __instance) { //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) if (!em_wpn_mod.Value) { return; } bool flag = false; bool flag2 = false; float num = 1f * ((em_acc_mult.Value + 2f) / 3f); if ((Object)(object)__instance.RecoilP != (Object)null) { if (__instance.m_recoilX > 0f) { __instance.m_recoilX = Mathf.MoveTowards(__instance.m_recoilX, 0f, Time.deltaTime * __instance.RecoilP.RecoilPerShot.y * 4f * __instance.RecoilP.RecoilRecoveryMults.x * num); flag = true; } if (fabs(__instance.m_recoilY) > 0f) { __instance.m_recoilY = Mathf.MoveTowards(__instance.m_recoilY, 0f, Time.deltaTime * __instance.RecoilP.RecoilPerShot.y * 3f * 0.5f * __instance.RecoilP.RecoilRecoveryMults.y * num); flag = true; } if (__instance.m_recoilLinear > 0f) { __instance.m_recoilLinear = Mathf.MoveTowards(__instance.m_recoilLinear, 0f, Time.deltaTime * __instance.RecoilP.RecoilPerShot.w * 1f * __instance.RecoilP.RecoilRecoveryMults.z * num); flag2 = true; } } if (flag2) { __instance.RecoilHolder.localPosition = new Vector3(0f, 0f, __instance.m_recoilLinear); } if (flag) { if (__instance.isFullAuto) { __instance.RecoilHolder.localEulerAngles = new Vector3(__instance.m_recoilX / (2f * em_acc_mult.Value), __instance.m_recoilY / (1.5f * em_acc_mult.Value), 0f); } else { __instance.RecoilHolder.localEulerAngles = new Vector3(__instance.m_recoilX / em_acc_mult.Value, __instance.m_recoilY / em_acc_mult.Value, 0f); } } } [HarmonyPatch(typeof(SosigWeapon), "Recoil")] [HarmonyPrefix] private static bool SosigWeapon_Recoil_prefix(SosigWeapon __instance, float recoilMult) { //IL_012a: 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_0175: Unknown result type (might be due to invalid IL or missing references) if (!em_wpn_mod.Value) { return true; } if ((Object)(object)__instance.RecoilP != (Object)null) { __instance.m_recoilX += __instance.RecoilP.RecoilPerShot.x * recoilMult; __instance.m_recoilY += Random.Range(__instance.RecoilP.RecoilPerShot.x * 0.5f, (0f - __instance.RecoilP.RecoilPerShot.x) * 0.5f) * recoilMult; __instance.m_recoilLinear += __instance.RecoilP.RecoilPerShot.z; __instance.m_recoilX = Mathf.Clamp(__instance.m_recoilX, 0f, __instance.RecoilP.RecoilPerShot.y); __instance.m_recoilY = Mathf.Clamp(__instance.m_recoilY, 0f, __instance.RecoilP.RecoilPerShot.y * 0.5f); __instance.m_recoilLinear = Mathf.Clamp(__instance.m_recoilLinear, 0f, __instance.RecoilP.RecoilPerShot.w); } __instance.RecoilHolder.localPosition = new Vector3(0f, 0f, __instance.m_recoilLinear); if (__instance.isFullAuto) { __instance.RecoilHolder.localEulerAngles = new Vector3(__instance.m_recoilX / (2f * em_acc_mult.Value), __instance.m_recoilY / (1.5f * em_acc_mult.Value), 0f); return false; } __instance.RecoilHolder.localEulerAngles = new Vector3(__instance.m_recoilX, __instance.m_recoilY, 0f); return false; } [HarmonyPatch(typeof(SosigWeapon), "FireGun")] [HarmonyPrefix] private static bool SosigWeapon_FireGun_prefix(SosigWeapon __instance, float recoilMult) { //IL_0031: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_05f2: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) if (!em_wpn_mod.Value) { return true; } float num = (em_acc_mult.Value + 1f) / 2f; if (__instance.m_shotsLeft <= 0) { return false; } if ((int)__instance.MechaState != 0) { return false; } if (__instance.IsHeldByBot) { __instance.SosigHoldingThis.GetEntity().ProcessLoudness(__instance.ShotLoudness); } if ((Object)(object)__instance.Muzzle == (Object)null) { return false; } __instance.timeSinceFired = 0f; if (__instance.UsesSustainedSound) { if (__instance.m_sustainEnergy <= 0f) { SM.PlayCoreSound((FVRPooledAudioType)10, __instance.AudEvent_SustainedEmit, ((Component)__instance).transform.position); } if (!__instance.AudSource_SustainedLoop.isPlaying) { __instance.AudSource_SustainedLoop.Play(); } __instance.m_sustainEnergy = __instance.SustainEnergyPerShot; } for (int i = 0; i < __instance.ProjectilesPerShot; i++) { Vector3 val = __instance.Muzzle.position; if (__instance.HasMuzzleOffsetSet) { Vector3 val2 = __instance.MuzzleOffsetSets[__instance.m_muzzleOffsetIndex]; val += ((Component)__instance).transform.right * val2.x + ((Component)__instance).transform.up * val2.y + ((Component)__instance).transform.forward * val2.z; __instance.m_muzzleOffsetIndex++; if (__instance.m_muzzleOffsetIndex >= __instance.MuzzleOffsetSets.Count) { __instance.m_muzzleOffsetIndex = 0; } } GameObject val3 = Object.Instantiate<GameObject>(__instance.Projectile, val, __instance.Muzzle.rotation); float num2 = __instance.ProjectileSpread; if (num2 < 0.25f) { num2 = (__instance.ProjectileSpread + 0.25f) / 2f; } num2 /= num; float num3 = 1f; if (__instance.isFullAuto) { num3 = 3f / num * (__instance.m_recoilLinear / Mathf.Clamp(__instance.RecoilP.RecoilPerShot.w, Mathf.Epsilon, 10f)); num3 = Mathf.Clamp(num3, 0.8f, 3f); } else { num3 = 1f / num * (__instance.m_recoilLinear / Mathf.Clamp(__instance.RecoilP.RecoilPerShot.w, Mathf.Epsilon, 10f)); num3 = Mathf.Clamp(num3, 1f, 2f); } if (num2 < 0.5f) { num2 = (num2 + 0.5f) / 2f; } else if (num2 > 1.5f) { num2 = (num2 + num2 + 1.5f) / 3f; } if (!__instance.IsHeldByBot) { num2 /= 2f; } val3.transform.Rotate(new Vector3(Random.Range((0f - num2) * num3, num2 * num3), Random.Range((0f - num2) * num3, num2 * num3), 0f)); BallisticProjectile component = val3.GetComponent<BallisticProjectile>(); component.FlightVelocityMultiplier *= __instance.FlightVelocityMultiplier; float num4 = component.MuzzleVelocityBase; if (__instance.IsHeldByBot && __instance.SosigHoldingThis.isDamPowerUp) { num4 *= __instance.SosigHoldingThis.BuffIntensity_DamPowerUpDown; } __instance.m_projRealSpeed = component.MuzzleVelocityBase * component.FlightVelocityMultiplier; if (__instance.IsHeldByBot) { component.SetSource_IFF(__instance.SosigHoldingThis.GetIFF()); } else if (((FVRInteractiveObject)__instance.O).IsHeld) { component.SetSource_IFF(GM.CurrentPlayerBody.GetPlayerIFF()); } component.Fire(num4, val3.transform.forward, (FVRFireArm)null, true); GM.CurrentSceneSettings.OnSosiggunFired(__instance); } __instance.Recoil(recoilMult); if ((Object)(object)__instance.GunShotProfile != (Object)null) { float soundTravelDistanceMultByEnvironment = SM.GetSoundTravelDistanceMultByEnvironment(__instance.PlayShotEvent(__instance.Muzzle.position)); if (__instance.IsHeldByBot) { GM.CurrentSceneSettings.OnPerceiveableSound(__instance.ShotLoudness, __instance.ShotLoudness * soundTravelDistanceMultByEnvironment, ((Component)__instance).transform.position, __instance.SosigHoldingThis.GetIFF(), __instance.SosigHoldingThis.E); } else if (((FVRInteractiveObject)__instance.O).IsHeld) { GM.CurrentSceneSettings.OnPerceiveableSound(__instance.ShotLoudness, __instance.ShotLoudness * soundTravelDistanceMultByEnvironment, ((Component)__instance).transform.position, GM.CurrentPlayerBody.GetPlayerIFF(), GM.CurrentPlayerBody.PlayerEntities[0]); } } if (__instance.UsesMuzzleFire && (!__instance.UsesMuzzleFireOnlyClose || Vector3.Distance(((Component)__instance).transform.position, GM.CurrentPlayerBody.Head.position) < 25f)) { for (int j = 0; j < __instance.PSystemsMuzzle.Length; j++) { __instance.PSystemsMuzzle[j].Emit(__instance.MuzzlePAmount); } } if (__instance.DoesFlashOnFire) { if (__instance.IsHeldByBot) { __instance.SosigHoldingThis.VisibleEvent(2f); } else if (((FVRInteractiveObject)__instance.O).IsHeld) { GM.CurrentPlayerBody.VisibleEvent(2f); } FXM.InitiateMuzzleFlash(__instance.Muzzle.position, __instance.Muzzle.forward, 0.65f, __instance.FlashOnFireColor, 1f); } else if (__instance.IsHeldByBot) { __instance.SosigHoldingThis.VisibleEvent(0.1f); } else if (((FVRInteractiveObject)__instance.O).IsHeld) { GM.CurrentPlayerBody.VisibleEvent(0.1f); } if (__instance.IsHeldByBot) { if (!__instance.SosigHoldingThis.IsInfiniteAmmo) { if (__instance.SosigHoldingThis.IsAmmoDrain) { __instance.m_shotsLeft = 0; } else { __instance.m_shotsLeft--; } } } else if (!GM.CurrentPlayerBody.IsInfiniteAmmo) { if (GM.CurrentPlayerBody.IsAmmoDrain) { __instance.m_shotsLeft = 0; } else { __instance.m_shotsLeft--; } } __instance.GenerateOrEnableCrankIfNeeded(); __instance.m_shotsSoFarThisCycle++; if (__instance.m_shotsSoFarThisCycle >= __instance.ShotsPerCycle) { if (__instance.DelayAfterFiring > 0f) { __instance.MechaState = (SosigWeaponMechaState)1; __instance.m_cycleDelay = __instance.DelayAfterFiring; } else { __instance.MechaState = (SosigWeaponMechaState)2; } __instance.m_cycleLerp = 0f; __instance.m_shotsSoFarThisCycle = 0; } if (__instance.UsesB