Decompiled source of SuperCold v1.0.1

Mods/SuperCold.dll

Decompiled 17 hours ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using HarmonyLib;
using MelonLoader;
using SuperCold;
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("SuperCold")]
[assembly: AssemblyDescription("Mod for converting the color scheme to blue.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SuperCold")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9ef8ae47-aad0-407c-bf23-54231d27aee8")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: MelonInfo(typeof(MainClass), "SuperCold", "1.0.1", "Gasterbuzzer", "https://github.com/Gasterbuzzer/SuperCold/releases/")]
[assembly: MelonGame("SUPERHOT_Team", "SUPERHOT")]
[assembly: MelonAuthorColor(255, 255, 0, 255)]
[assembly: MelonPriority(99)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.1.0")]
namespace SuperCold;

public class MainClass : MelonMod
{
	private static Material greyWall;

	private static Material purpleGun;

	private static Material blueEnemy;

	private static readonly int EmissionColor = Shader.PropertyToID("_EmissionColor");

	private static readonly int Metallic = Shader.PropertyToID("_Metallic");

	private static readonly int SpecColor = Shader.PropertyToID("_SpecColor");

	private static readonly int Glossiness = Shader.PropertyToID("_Glossiness");

	public override void OnLateInitializeMelon()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Expected O, but got Unknown
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Expected O, but got Unknown
		//IL_009e: 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_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: 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_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		greyWall = new Material(Shader.Find("Standard"));
		greyWall.color = new Color(0.176f, 0.188f, 0.212f, 1f);
		purpleGun = new Material(Shader.Find("Standard"));
		purpleGun.color = new Color(0.82f, 0.118f, 0.761f, 1f);
		blueEnemy = new Material(Shader.Find("Standard"));
		blueEnemy.color = new Color(0.1f, 0.1f, 1f, 1f);
		blueEnemy.EnableKeyword("_EMISSION");
		blueEnemy.SetColor(EmissionColor, new Color(0.3f, 0.3f, 0.6f, 1f));
		blueEnemy.SetFloat(Glossiness, 0.7f);
		blueEnemy.SetColor(SpecColor, new Color(0.5f, 0.5f, 0.5f, 1f));
		blueEnemy.SetFloat(Metallic, 0.5f);
		Color val = default(Color);
		((Color)(ref val))..ctor(0.26f, 0.19f, 0.16f, 0f);
		blueEnemy.SetColor(EmissionColor, blueEnemy.GetColor(EmissionColor) + val * 0.3f);
	}

	public override void OnSceneWasInitialized(int buildIndex, string sceneName)
	{
		ProcessObjectsWithName("pb", greyWall);
		ProcessObjectsWithName("prefab", greyWall);
		ProcessObjectsWithName("model", greyWall);
		ProcessObjectsWithName("Glock", purpleGun);
		ProcessObjectsWithName("glock", purpleGun);
		SetSpawnerColorBlue();
		SetBloodBlue();
		SetTrailBlue();
		SetEndTowerBlue();
		MelonCoroutines.Start(ChangeSpawnerLights());
	}

	private static void ProcessObjectsWithName(string namePart, Material assignedMaterial)
	{
		GameObject[] array = Object.FindObjectsOfType<GameObject>();
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			if (((Object)val).name.Contains(namePart))
			{
				MeshRenderer component = val.GetComponent<MeshRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					((Renderer)component).material = assignedMaterial;
				}
			}
		}
	}

	private static void SetSpawnerColorBlue()
	{
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			if (((Object)val).name.Contains("FrontSpotZcieniem") || ((Object)val).name.Contains("PointLightBezcieniowy") || ((Object)val).name.Contains("Point light na przeciwnika"))
			{
				Light component = val.GetComponent<Light>();
				if ((Object)(object)component != (Object)null)
				{
					val.GetComponent<Light>().color = Color.blue;
				}
				else
				{
					MelonLogger.Warning("Could not find light component in enemy spawner.");
				}
			}
		}
	}

	private static void SetBloodBlue()
	{
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			if (((Object)val).name.Contains("Particles - geometry") || ((Object)val).name.Contains("Particles - enemyballs"))
			{
				ParticleSystem component = val.GetComponent<ParticleSystem>();
				ParticleSystemRenderer component2 = val.GetComponent<ParticleSystemRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					MainModule main = component.main;
					((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(Color.blue);
					((Renderer)component2).material = blueEnemy;
				}
				else
				{
					MelonLogger.Warning("Could not find particle system component in enemy blood particle.");
				}
			}
		}
	}

	private static void SetTrailBlue()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			if (((Object)val).name.Contains("Trail(Clone)"))
			{
				MeshRenderer component = val.GetComponent<MeshRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					((Renderer)component).material.color = Color.blue;
				}
				else
				{
					MelonLogger.Warning("WARNING: Could not find mesh renderer in bullet trail.");
				}
			}
		}
	}

	private static void SetEndTowerBlue()
	{
		GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			if (((Object)val).name.Contains("piramida-krysztalowa-02"))
			{
				MeshRenderer component = val.GetComponent<MeshRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					((Renderer)component).material = blueEnemy;
				}
				else
				{
					MelonLogger.Warning("WARNING: Could not find mesh renderer in bullet trail.");
				}
			}
		}
	}

	private static IEnumerator ChangeSpawnerLights()
	{
		GameObject frontSpotZcieniem = null;
		while ((Object)(object)frontSpotZcieniem == (Object)null)
		{
			yield return null;
			frontSpotZcieniem = GameObject.Find("FrontSpotZcieniem");
		}
		SetSpawnerColorBlue();
	}
}
[HarmonyPatch(typeof(MaterialDefinition), "InitDictionaries")]
public static class PatchMaterialSet
{
	private static readonly FieldInfo Mat = typeof(MaterialDefinition).GetField("Material", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly int EmissionColor = Shader.PropertyToID("_EmissionColor");

	private static readonly int Glossiness = Shader.PropertyToID("_Glossiness");

	private static readonly int SpecColor = Shader.PropertyToID("_SpecColor");

	private static readonly int Metallic = Shader.PropertyToID("_Metallic");

	private static void Postfix(MaterialDefinition __instance)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		Material val = (Material)Mat.GetValue(__instance);
		if (((Object)val).name == "MAIN RedCrystalNuEnemyMaterial")
		{
			Material val2 = new Material(Shader.Find("Standard"));
			val2.shaderKeywords = val.shaderKeywords;
			val2.globalIlluminationFlags = val.globalIlluminationFlags;
			val2.color = new Color(0.1f, 0.1f, 1f, 1f);
			val2.EnableKeyword("_EMISSION");
			val2.SetColor(EmissionColor, new Color(0.3f, 0.3f, 0.6f, 1f));
			val2.SetFloat(Glossiness, 0.7f);
			val2.SetColor(SpecColor, new Color(0.5f, 0.5f, 0.5f, 1f));
			val2.SetFloat(Metallic, 0.5f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.26f, 0.19f, 0.16f, 0f);
			val2.SetColor(EmissionColor, val2.GetColor(EmissionColor) + val3 * 0.3f);
			Mat.SetValue(__instance, val2);
		}
	}
}
[HarmonyPatch(typeof(StaticParticles), "Awake")]
public static class PatchEnemySpawnEffectDefault
{
	private static void Postfix(StaticParticles __instance)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		GameObject gameObject = ((Component)__instance).gameObject;
		((Component)gameObject.transform.Find("FrontSpotZcieniem")).GetComponent<Light>().color = Color.blue;
		((Component)gameObject.transform.Find("PointLightBezcieniowy")).GetComponent<Light>().color = Color.blue;
	}
}
[HarmonyPatch(typeof(TextManager), "DisplaySingleWord", new Type[] { typeof(OverlayWord) })]
public static class PatchSuperhotTitle
{
	private static void Prefix(ref OverlayWord word)
	{
		if (word != null && word.txt.ToLower() == "hot")
		{
			word.txt = "COLD";
		}
	}
}
[HarmonyPatch(typeof(SHGUI), "SetPixelFront", new Type[]
{
	typeof(char),
	typeof(int),
	typeof(int),
	typeof(char)
})]
public static class PatchCursorBlue
{
	private static void Prefix(ref char col)
	{
		if (col == 'r')
		{
			col = 'b';
		}
	}
}
[HarmonyPatch(typeof(SHGUI), "SetPixelBack", new Type[]
{
	typeof(char),
	typeof(int),
	typeof(int),
	typeof(char)
})]
public static class PatchSelectGUIBlue
{
	private static void Prefix(ref char col)
	{
		if (col == 'r')
		{
			col = 'b';
		}
	}
}
[HarmonyPatch(typeof(SHGUI), "SetColorFront", new Type[]
{
	typeof(char),
	typeof(int),
	typeof(int)
})]
public static class PatchCursorBlue2
{
	private static void Prefix(ref char c)
	{
		if (c == 'r')
		{
			c = 'b';
		}
	}
}