Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BlackMesaCompany v1.0.0
BlackMesaCompany/HalfLifeModels.dll
Decompiled 2 years agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using BlackMesaCompany.Patches; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("HalfLifeModels")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HalfLifeModels")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("26d875ca-3349-442d-9e2c-e67d35d9d7a9")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace BlackMesaCompany { [BepInPlugin("Poseidon.BlackMesaCompany", "Black Mesa Company", "1.0.0.0")] public class Plugin : BaseUnityPlugin { private const string modGUID = "Poseidon.BlackMesaCompany"; private const string modName = "Black Mesa Company"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("Poseidon.BlackMesaCompany"); public static GameObject crowbarModel; public static GameObject gravityGunModel; public static GameObject chargerModel; public static AudioClip deathSound; public static AudioClip chargerSound; public static AudioClip crowbarHitSound; internal static ManualLogSource Log; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod Loaded. Welcome Mr. Freeman"); string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "halflife.bundle"); AssetBundle val = AssetBundle.LoadFromFile(text); crowbarModel = val.LoadAsset<GameObject>("Crowbar.prefab"); gravityGunModel = val.LoadAsset<GameObject>("GravityGun.prefab"); chargerModel = val.LoadAsset<GameObject>("Charger.prefab"); deathSound = val.LoadAsset<AudioClip>("halflifedeath.wav"); chargerSound = val.LoadAsset<AudioClip>("halflifecharger.wav"); crowbarHitSound = val.LoadAsset<AudioClip>("halflifecrowbar.wav"); harmony.PatchAll(typeof(ItemsPatch)); harmony.PatchAll(typeof(DeathPatch)); harmony.PatchAll(typeof(ChargerPatch)); harmony.PatchAll(typeof(CrowbarPatch)); } } } namespace BlackMesaCompany.Patches { [HarmonyPatch(typeof(GrabbableObject), "Start")] internal class ItemsPatch { private static void Postfix(GrabbableObject __instance) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if (__instance is Shovel) { Transform child = ((Component)__instance).transform.GetChild(0); Object.Destroy((Object)(object)((Component)child).gameObject.GetComponent<MeshFilter>()); Object.Destroy((Object)(object)((Component)child).gameObject.GetComponent<MeshRenderer>()); GameObject val = Object.Instantiate<GameObject>(Plugin.crowbarModel, child.position, Quaternion.identity, child); } else if (__instance is PatcherTool) { Transform child2 = ((Component)__instance).transform.GetChild(0); Object.Destroy((Object)(object)((Component)child2).gameObject.GetComponent<MeshFilter>()); Object.Destroy((Object)(object)((Component)child2).gameObject.GetComponent<MeshRenderer>()); for (int i = 0; i < 3; i++) { Transform child3 = child2.GetChild(i); Object.Destroy((Object)(object)((Component)child3).gameObject.GetComponent<MeshFilter>()); Object.Destroy((Object)(object)((Component)child3).gameObject.GetComponent<MeshRenderer>()); } GameObject val2 = Object.Instantiate<GameObject>(Plugin.gravityGunModel, child2.position, Quaternion.identity, child2); val2.transform.localScale = val2.transform.localScale * 18f; } } } [HarmonyPatch(typeof(PlayerControllerB), "SpawnDeadBody")] internal class DeathPatch { private static void Postfix(PlayerControllerB __instance) { HUDManager.Instance.UIAudio.PlayOneShot(Plugin.deathSound); } } [HarmonyPatch(typeof(ItemCharger), "Update")] internal class ChargerPatch { private static bool changesMade; private static void Postfix(ItemCharger __instance) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0091: 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) if (changesMade) { return; } Transform parent = ((Component)__instance).transform.parent.parent; foreach (Transform item in parent) { Transform val = item; if ((Object)(object)((Component)val).gameObject.GetComponent<MeshRenderer>() != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject.GetComponent<MeshRenderer>()); } } GameObject val2 = Object.Instantiate<GameObject>(Plugin.chargerModel, ((Component)__instance).transform.position, Quaternion.identity, ((Component)__instance).transform); __instance.zapAudio.clip = Plugin.chargerSound; changesMade = true; } } [HarmonyPatch(typeof(Shovel), "ItemActivate")] internal class CrowbarPatch { private static bool soundsChanged; private static void Postfix(Shovel __instance) { if (!soundsChanged) { FootstepSurface[] footstepSurfaces = StartOfRound.Instance.footstepSurfaces; foreach (FootstepSurface val in footstepSurfaces) { val.hitSurfaceSFX = Plugin.crowbarHitSound; } soundsChanged = true; } } } }