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 LethalStage v1.0.1
LethalStage.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("LethalStage")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f45ca0261dcd7ed6ffc0929b2c882a4aa4f6eb2d")] [assembly: AssemblyProduct("LethalStage")] [assembly: AssemblyTitle("LethalStage")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.yuzukiko.LethalStage", "LethalStage", "1.0.0")] public class Main : BaseUnityPlugin { private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalStage Mod Loaded!"); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loading scene " + ((Scene)(ref scene)).name + ".")); if (((Scene)(ref scene)).name == "CompanyBuilding") { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Scene " + ((Scene)(ref scene)).name + " loaded. Injecting stage...")); SceneManager.SetActiveScene(scene); InjectObject(); } } private void InjectObject() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown //IL_01ac: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032d: 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_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("stage"); val.transform.position = new Vector3(-10f, 0f, 62f); val.transform.rotation = Quaternion.Euler(0f, 270f, 0f); GameObject val2 = GameObject.Find("Environment/Map/CompanyPlanet"); if ((Object)(object)val2 != (Object)null) { val.transform.SetParent(val2.transform, true); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Parent object 'Environment/Map/CompanyPlanet' not found. Stage will remain unparented."); } GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj).name = "stage_cube"; obj.transform.localPosition = new Vector3(0f, -2f, 0f); obj.transform.localScale = new Vector3(25f, 2f, 15f); obj.layer = LayerMask.NameToLayer("Room"); obj.tag = "Concrete"; obj.transform.SetParent(val.transform, false); Material val3 = FindMaterial("BlackRubber"); Renderer component = obj.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null && (Object)(object)val3 != (Object)null) { component.material = val3; } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find BlackRubber material or renderer."); } GameObject val4 = new GameObject("lights"); val4.transform.SetParent(val.transform, false); GameObject val5 = GameObject.Find("LEDHangingLight (4)"); if ((Object)(object)val5 != (Object)null) { GameObject obj2 = Object.Instantiate<GameObject>(val5); ((Object)obj2).name = "stage_light_left"; obj2.transform.SetParent(val4.transform, false); obj2.transform.localPosition = new Vector3(-15f, 10f, 6f); obj2.transform.LookAt(val.transform); Transform transform = obj2.transform; transform.rotation *= Quaternion.Euler(0f, 180f, 0f); GameObject obj3 = Object.Instantiate<GameObject>(val5); ((Object)obj3).name = "stage_light_right"; obj3.transform.SetParent(val4.transform, false); obj3.transform.localPosition = new Vector3(15f, 10f, 4f); obj3.transform.LookAt(val.transform); Transform transform2 = obj3.transform; transform2.rotation *= Quaternion.Euler(0f, 180f, 0f); GameObject obj4 = Object.Instantiate<GameObject>(val5); ((Object)obj4).name = "stage_light_top"; obj4.transform.SetParent(val4.transform, false); obj4.transform.localPosition = new Vector3(-1f, 15f, 0f); obj4.transform.rotation = Quaternion.Euler(270f, 90f, 0f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Lights created and positioned on the stage."); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Original LEDHangingLight (4) not found."); } GameObject val6 = new GameObject("stage_trigger"); val6.transform.SetParent(val.transform, false); val6.transform.localPosition = new Vector3(0f, 0f, 0f); val6.transform.localScale = new Vector3(25f, 2f, 15f); ((Collider)val6.AddComponent<BoxCollider>()).isTrigger = true; ((Renderer)val6.AddComponent<MeshRenderer>()).enabled = false; val6.AddComponent<StageCubeInteraction>().lightsParent = val4; } private Material FindMaterial(string materialName) { return ((IEnumerable<Material>)Resources.FindObjectsOfTypeAll<Material>()).FirstOrDefault((Func<Material, bool>)((Material m) => ((Object)m).name == materialName)); } } public class StageCubeInteraction : MonoBehaviour { public GameObject lightsParent; private bool isStrobing; private bool isPlayerInside; private Coroutine strobingCoroutine; private InputAction toggleStrobeAction; private int currentColorIndex; private List<Color> lightColors; private InputAction toggleLightColorAction; private bool isLightColorLooping; private Coroutine lightColorChangeLoopCoroutine; private InputAction toggleLightColorActionLoop; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00ee: Unknown result type (might be due to invalid IL or missing references) toggleStrobeAction = new InputAction((string)null, (InputActionType)0, "<Keyboard>/o", (string)null, (string)null, (string)null); toggleStrobeAction.performed += delegate { OnToggleStrobe(); }; toggleStrobeAction.Enable(); toggleLightColorAction = new InputAction((string)null, (InputActionType)0, "<Keyboard>/p", (string)null, (string)null, (string)null); toggleLightColorAction.performed += delegate { OnLightColorChange(); }; toggleLightColorAction.Enable(); toggleLightColorActionLoop = new InputAction((string)null, (InputActionType)0, "<Keyboard>/leftBracket", (string)null, (string)null, (string)null); toggleLightColorActionLoop.performed += delegate { OnToggleLightColorChangeLoop(); }; toggleLightColorActionLoop.Enable(); lightColors = new List<Color> { Color.red, Color.green, Color.blue, Color.yellow, Color.cyan, Color.magenta, Color.white }; } private void OnDestroy() { toggleStrobeAction.Disable(); toggleStrobeAction.performed -= delegate { OnToggleStrobe(); }; toggleLightColorAction.Disable(); toggleLightColorAction.performed -= delegate { OnLightColorChange(); }; toggleLightColorActionLoop.Disable(); toggleLightColorActionLoop.performed -= delegate { OnToggleLightColorChangeLoop(); }; } private void OnTriggerEnter(Collider other) { if (((Component)other).CompareTag("Player")) { Debug.Log((object)"[StageCubeInteraction] Player entered stage_trigger."); isPlayerInside = true; } } private void OnTriggerExit(Collider other) { if (((Component)other).CompareTag("Player")) { Debug.Log((object)"[StageCubeInteraction] Player exited stage_trigger."); isPlayerInside = false; } } private void OnToggleStrobe() { if (isPlayerInside) { if (isStrobing) { StopStrobing(); } else { StartStrobing(); } } } private void StartStrobing() { Debug.Log((object)"[StageCubeInteraction] Starting stroboscope effect."); isStrobing = true; strobingCoroutine = ((MonoBehaviour)this).StartCoroutine(StroboscopeEffect()); } private void StopStrobing() { Debug.Log((object)"[StageCubeInteraction] Stopping stroboscope effect."); isStrobing = false; if (strobingCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(strobingCoroutine); } Light[] componentsInChildren = lightsParent.GetComponentsInChildren<Light>(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Behaviour)componentsInChildren[i]).enabled = true; } } private IEnumerator StroboscopeEffect() { Light[] lights = lightsParent.GetComponentsInChildren<Light>(); if (lights.Length == 0) { isStrobing = false; yield break; } while (isStrobing) { Light[] array = lights; foreach (Light obj in array) { ((Behaviour)obj).enabled = !((Behaviour)obj).enabled; } yield return (object)new WaitForSeconds(0.1f); } } private void OnLightColorChange() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (isPlayerInside) { Light[] componentsInChildren = lightsParent.GetComponentsInChildren<Light>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].color = lightColors[currentColorIndex]; } currentColorIndex++; if (currentColorIndex >= lightColors.Count) { currentColorIndex = 0; } } } private void OnToggleLightColorChangeLoop() { if (isPlayerInside) { if (isLightColorLooping) { StopLightColorChangeLoop(); } else { StartLightColorChangeLoop(); } } } private void StartLightColorChangeLoop() { isLightColorLooping = true; lightColorChangeLoopCoroutine = ((MonoBehaviour)this).StartCoroutine(OnLightColorChangeLoop()); } private void StopLightColorChangeLoop() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) isLightColorLooping = false; if (lightColorChangeLoopCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(lightColorChangeLoopCoroutine); } Light[] componentsInChildren = lightsParent.GetComponentsInChildren<Light>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].color = Color.white; } } private IEnumerator OnLightColorChangeLoop() { Light[] lights = lightsParent.GetComponentsInChildren<Light>(); while (isLightColorLooping) { Light[] array = lights; for (int i = 0; i < array.Length; i++) { array[i].color = lightColors[currentColorIndex]; } currentColorIndex++; if (currentColorIndex >= lightColors.Count) { currentColorIndex = 0; } yield return (object)new WaitForSeconds(0.1f); } } }