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 RepoTerrainScanner v3.0.3
RepoTerrainScanner.dll
Decompiled 2 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RepoTerrainScanner")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RepoTerrainScanner")] [assembly: AssemblyTitle("RepoTerrainScanner")] [assembly: AssemblyVersion("1.0.0.0")] [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 RepoTerrainScanner { public static class EntityAnalyzer { public static Color Analyze(Collider hit, out Transform logicalTarget) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) logicalTarget = (((Object)(object)hit.attachedRigidbody != (Object)null) ? ((Component)hit.attachedRigidbody).transform : ((Component)hit).transform); EnemyHealth componentInParent = ((Component)hit).GetComponentInParent<EnemyHealth>(); if ((Object)(object)componentInParent != (Object)null) { logicalTarget = ((Component)componentInParent).transform; return Color.red; } PlayerController componentInParent2 = ((Component)hit).GetComponentInParent<PlayerController>(); if ((Object)(object)componentInParent2 != (Object)null) { logicalTarget = ((Component)componentInParent2).transform; return Color.green; } Component[] componentsInParent = ((Component)hit).GetComponentsInParent<Component>(false); foreach (Component val in componentsInParent) { if ((Object)(object)val == (Object)null) { continue; } string name = ((object)val).GetType().Name; switch (name) { case "NetworkPlayer": case "PlayerAvatar": case "PlayerHealth": logicalTarget = val.transform; return Color.green; default: if (!name.EndsWith("Enemy")) { continue; } break; case "EnemyAI": case "EnemyRigidbody": break; } logicalTarget = val.transform; return Color.red; } ValuableObject componentInParent3 = ((Component)hit).GetComponentInParent<ValuableObject>(); if ((Object)(object)componentInParent3 != (Object)null) { logicalTarget = ((Component)componentInParent3).transform; return Color.yellow; } ValuableDiscoverCustom componentInParent4 = ((Component)hit).GetComponentInParent<ValuableDiscoverCustom>(); if ((Object)(object)componentInParent4 != (Object)null) { logicalTarget = ((Component)componentInParent4).transform; return Color.yellow; } PhysGrabObject componentInParent5 = ((Component)hit).GetComponentInParent<PhysGrabObject>(); if ((Object)(object)componentInParent5 != (Object)null) { logicalTarget = ((Component)componentInParent5).transform; string name2 = ((Object)((Component)hit).gameObject).name.ToLower(); string name3 = ((Object)((Component)componentInParent5).gameObject).name.ToLower(); string name4 = (((Object)(object)((Component)componentInParent5).transform.parent != (Object)null) ? ((Object)((Component)componentInParent5).transform.parent).name.ToLower() : ""); if (ContainsBadWord(name2) || ContainsBadWord(name3) || ContainsBadWord(name4)) { return Color.clear; } return Color.yellow; } return Color.clear; } private static bool ContainsBadWord(string name) { if (!name.Contains("door") && !name.Contains("cabinet") && !name.Contains("drawer") && !name.Contains("hinge") && !name.Contains("locker")) { return name.Contains("closet"); } return true; } } public class RepoConfig { public ConfigEntry<Key> ActiveKey; public ConfigEntry<Color> ScanColorHead; public ConfigEntry<Color> ScanColor; public ConfigEntry<float> ScanLineWidth; public ConfigEntry<float> ScanLineInterval; public ConfigEntry<float> HeadScanLineWidth; public ConfigEntry<float> ScanRange; public ConfigEntry<float> ScanMaxDistance; public ConfigEntry<float> ScanDuration; public RepoConfig(ConfigFile cfg) { //IL_0043: 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) ActiveKey = cfg.Bind<Key>("General", "ActiveKey", (Key)17, "Tecla para activar"); ScanColorHead = cfg.Bind<Color>("Style", "ScanColorHead", new Color(1f, 0.83f, 0.41f, 1f), (ConfigDescription)null); ScanColor = cfg.Bind<Color>("Style", "ScanColor", new Color(0.38f, 0.73f, 0.87f, 1f), (ConfigDescription)null); ScanLineWidth = cfg.Bind<float>("Style", "ScanLineWidth", 1f, (ConfigDescription)null); ScanLineInterval = cfg.Bind<float>("Style", "ScanLineInterval", 1f, (ConfigDescription)null); HeadScanLineWidth = cfg.Bind<float>("Style", "HeadScanLineWidth", 1f, (ConfigDescription)null); ScanRange = cfg.Bind<float>("Style", "ScanRange", 5f, (ConfigDescription)null); ScanMaxDistance = cfg.Bind<float>("Style", "ScanMaxDistance", 30f, (ConfigDescription)null); ScanDuration = cfg.Bind<float>("Style", "ScanDuration", 5f, (ConfigDescription)null); } } public struct ScanSettingsData { public Color ScanColorHead; public Color ScanColor; public float ScanLineWidth; public float ScanLineInterval; public float HeadScanLineWidth; public float ScanRange; public float ScanMaxDistance; public float ScanDuration; public static ScanSettingsData FromLocalConfig() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) RepoConfig configInstance = RepoScannerPlugin.ConfigInstance; return new ScanSettingsData { ScanColorHead = configInstance.ScanColorHead.Value, ScanColor = configInstance.ScanColor.Value, ScanLineWidth = configInstance.ScanLineWidth.Value, ScanLineInterval = configInstance.ScanLineInterval.Value, HeadScanLineWidth = configInstance.HeadScanLineWidth.Value, ScanRange = configInstance.ScanRange.Value, ScanMaxDistance = configInstance.ScanMaxDistance.Value, ScanDuration = configInstance.ScanDuration.Value }; } } [BepInPlugin("com.mod.repoterrainscanner", "Repo Terrain Scanner", "3.0.3")] public class RepoScannerPlugin : BaseUnityPlugin { internal static ManualLogSource ModLogger; public static RepoScannerPlugin Instance { get; private set; } public static RepoConfig ConfigInstance { get; private set; } public Material ScanMat { get; private set; } private void Awake() { Instance = this; ModLogger = ((BaseUnityPlugin)this).Logger; ModLogger.LogInfo((object)"=== [RepoTerrainScanner] Iniciando (Sistema Modular v3.0.0) ==="); ConfigInstance = new RepoConfig(((BaseUnityPlugin)this).Config); LoadBundle(); SceneManager.sceneLoaded += delegate { EnsureCameraHook(); }; } private void LoadBundle() { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "scanwave.bundle"); if (!File.Exists(text)) { ModLogger.LogError((object)("[RepoTerrainScanner] No se encontro scanwave.bundle en: " + text)); return; } AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val != (Object)null && val.LoadAllAssets<Material>().Length != 0) { ScanMat = val.LoadAllAssets<Material>()[0]; } } private void Update() { EnsureCameraHook(); } public void EnsureCameraHook() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown if (!((Object)(object)ScanMat == (Object)null)) { Camera val = Camera.main ?? Object.FindObjectOfType<Camera>(); if (!((Object)(object)val == (Object)null) && (Object)(object)((Component)val).gameObject.GetComponent<ScanController>() == (Object)null) { Material scanMaterial = new Material(ScanMat); (((Component)val).gameObject.GetComponent<ScanPostProcess>() ?? ((Component)val).gameObject.AddComponent<ScanPostProcess>()).scanMaterial = scanMaterial; ((Component)val).gameObject.AddComponent<ScanController>().scanMaterial = scanMaterial; } } } } public class ActiveWave { public Material Mat; public Coroutine Routine; } public class ScanController : MonoBehaviour, IOnEventCallback { private struct ScanTarget { public PhysGrabObject physGrab; public float distance; public Color color; public Vector3 position; } public const byte SCAN_EVENT_CODE = 173; public Material scanMaterial; private ScanPostProcess _postProcess; private bool _wasKeyPressed; private static Harmony _harmony; private Dictionary<int, ActiveWave> _activeWaves = new Dictionary<int, ActiveWave>(); private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown if (_harmony == null) { _harmony = new Harmony("com.repotterrainscanner.hotfix"); _harmony.PatchAll(typeof(ScanControllerPatches)); } } private void OnEnable() { PhotonNetwork.AddCallbackTarget((object)this); } private void OnDisable() { PhotonNetwork.RemoveCallbackTarget((object)this); } private void Start() { _postProcess = ((Component)this).GetComponent<ScanPostProcess>(); } private void Update() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; if (current == null) { return; } Key val = (Key)((RepoScannerPlugin.ConfigInstance == null) ? 17 : ((int)RepoScannerPlugin.ConfigInstance.ActiveKey.Value)); KeyControl val2 = current[val]; if (val2 != null) { bool isPressed = ((ButtonControl)val2).isPressed; if (isPressed && !_wasKeyPressed) { ((BaseUnityPlugin)RepoScannerPlugin.Instance).Config.Reload(); Vector3 position = ((Component)this).transform.position; ScanSettingsData settings = ScanSettingsData.FromLocalConfig(); int playerId = (PhotonNetwork.InRoom ? PhotonNetwork.LocalPlayer.ActorNumber : 0); TriggerScan(playerId, position, settings); BroadcastScan(position, settings); } _wasKeyPressed = isPressed; } } private void BroadcastScan(Vector3 origin, ScanSettingsData settings) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00c3: 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_0133: 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_013b: Expected O, but got Unknown //IL_013d: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.InRoom) { object[] array = new object[17] { origin.x, origin.y, origin.z, settings.ScanColorHead.r, settings.ScanColorHead.g, settings.ScanColorHead.b, settings.ScanColorHead.a, settings.ScanColor.r, settings.ScanColor.g, settings.ScanColor.b, settings.ScanColor.a, settings.ScanLineWidth, settings.ScanLineInterval, settings.HeadScanLineWidth, settings.ScanRange, settings.ScanMaxDistance, settings.ScanDuration }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; SendOptions val2 = default(SendOptions); ((SendOptions)(ref val2)).Reliability = true; SendOptions val3 = val2; PhotonNetwork.RaiseEvent((byte)173, (object)array, val, val3); } } public void OnEvent(EventData photonEvent) { //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) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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) if (photonEvent.Code == 173) { try { int sender = photonEvent.Sender; object[] array = (object[])photonEvent.CustomData; Vector3 origin = default(Vector3); ((Vector3)(ref origin))..ctor((float)array[0], (float)array[1], (float)array[2]); ScanSettingsData settings = new ScanSettingsData { ScanColorHead = new Color((float)array[3], (float)array[4], (float)array[5], (float)array[6]), ScanColor = new Color((float)array[7], (float)array[8], (float)array[9], (float)array[10]), ScanLineWidth = (float)array[11], ScanLineInterval = (float)array[12], HeadScanLineWidth = (float)array[13], ScanRange = (float)array[14], ScanMaxDistance = (float)array[15], ScanDuration = (float)array[16] }; TriggerScan(sender, origin, settings); } catch (Exception) { } } } public void TriggerScan(int playerId, Vector3 origin, ScanSettingsData settings) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)scanMaterial == (Object)null) { return; } if ((Object)(object)_postProcess == (Object)null) { _postProcess = ((Component)this).GetComponent<ScanPostProcess>(); } if (_activeWaves.TryGetValue(playerId, out var value)) { if (value.Routine != null) { ((MonoBehaviour)this).StopCoroutine(value.Routine); } } else { value = new ActiveWave(); value.Mat = new Material(scanMaterial); _activeWaves[playerId] = value; if ((Object)(object)_postProcess != (Object)null && !_postProcess.activeMaterials.Contains(value.Mat)) { _postProcess.activeMaterials.Add(value.Mat); } } value.Routine = ((MonoBehaviour)this).StartCoroutine(AnimateWaveAndDiscover(playerId, value, origin, settings)); } private static bool ContainsBadWord(string name) { if (string.IsNullOrEmpty(name)) { return false; } if (!name.Contains("door") && !name.Contains("cabinet") && !name.Contains("drawer") && !name.Contains("hinge") && !name.Contains("locker") && !name.Contains("closet") && !name.Contains("toilet") && !name.Contains("lid") && !name.Contains("vent") && !name.Contains("rack") && !name.Contains("chair") && !name.Contains("table") && !name.Contains("desk") && !name.Contains("trash") && !name.Contains("bin") && !name.Contains("shelf") && !name.Contains("glass") && !name.Contains("window") && !name.Contains("lamp") && !name.Contains("light") && !name.Contains("cart") && !name.Contains("vehicle") && !name.Contains("barrel")) { return name.Contains("box"); } return true; } private IEnumerator AnimateWaveAndDiscover(int playerId, ActiveWave wave, Vector3 origin, ScanSettingsData cfg) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Material mat = wave.Mat; float maxDistance = cfg.ScanMaxDistance; List<ScanTarget> pendingTargets = new List<ScanTarget>(); HashSet<int> processedPGOs = new HashSet<int>(); Collider[] colliders = Physics.OverlapSphere(origin, maxDistance); int processCount = 0; foreach (Collider val in colliders) { if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy) { continue; } PhysGrabObject componentInParent = ((Component)val).GetComponentInParent<PhysGrabObject>(); if ((Object)(object)componentInParent == (Object)null || !processedPGOs.Add(((Object)((Component)componentInParent).gameObject).GetInstanceID())) { continue; } float distance = Vector3.Distance(origin, ((Component)componentInParent).transform.position); Color val2 = Color.clear; if ((Object)(object)((Component)componentInParent).GetComponentInParent<EnemyRigidbody>() != (Object)null) { val2 = Color.red; } else if ((Object)(object)((Component)componentInParent).GetComponentInParent<PlayerAvatar>() != (Object)null || (Object)(object)((Component)componentInParent).GetComponentInParent<PlayerController>() != (Object)null) { if ((Object)(object)((Component)componentInParent).transform.root != (Object)(object)((Component)this).transform.root) { val2 = Color.green; } } else if ((Object)(object)((Component)componentInParent).GetComponentInParent<ValuableObject>() != (Object)null) { val2 = Color.yellow; } else if ((Object)(object)((Component)componentInParent).GetComponentInParent<ValuableDiscoverCustom>() != (Object)null) { val2 = Color.blue; } else if ((Object)(object)((Component)componentInParent).GetComponentInParent<ItemAttributes>() != (Object)null) { ((Color)(ref val2))..ctor(0.7f, 0.2f, 1f); } if (val2 != Color.clear) { pendingTargets.Add(new ScanTarget { physGrab = componentInParent, distance = distance, color = val2, position = ((Component)componentInParent).transform.position }); } processCount++; if (processCount > 40) { processCount = 0; yield return null; } } PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val3 in array) { if (!((Object)(object)val3 == (Object)null) && ((Component)val3).gameObject.activeInHierarchy && !((Object)(object)((Component)val3).transform.root == (Object)(object)((Component)this).transform.root)) { float num = Vector3.Distance(origin, ((Component)val3).transform.position); if (num <= maxDistance) { pendingTargets.Add(new ScanTarget { physGrab = null, distance = num, color = Color.green, position = ((Component)val3).transform.position }); } } } mat.SetVector("scanCenterWS", Vector4.op_Implicit(origin)); mat.SetColor("scanColorHead", cfg.ScanColorHead); mat.SetColor("scanColor", cfg.ScanColor); mat.SetFloat("scanLineWidth", cfg.ScanLineWidth); mat.SetFloat("scanLineInterval", cfg.ScanLineInterval); mat.SetFloat("headScanLineWidth", cfg.HeadScanLineWidth); mat.SetFloat("scanLineBrightness", 0f); mat.SetFloat("outlineWidth", 0f); mat.SetFloat("outlineBrightness", 0f); mat.SetFloat("outlineStarDistance", 0f); float duration = Mathf.Max(0.1f, cfg.ScanDuration); float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float num2 = Mathf.Clamp01(elapsed / duration); float num3 = Mathf.Lerp(0f, maxDistance, num2); for (int num4 = pendingTargets.Count - 1; num4 >= 0; num4--) { if (num3 >= pendingTargets[num4].distance) { if ((Object)(object)pendingTargets[num4].physGrab != (Object)null) { TriggerNativeUIBox(pendingTargets[num4].color, pendingTargets[num4].physGrab, cfg.ScanDuration); } else { SpawnMarker(pendingTargets[num4].position, pendingTargets[num4].color); } pendingTargets.RemoveAt(num4); } } mat.SetFloat("headScanLineDistance", num3); float num5 = ((num2 < 0.8f) ? Mathf.Clamp01(elapsed / 0.3f) : Mathf.Clamp01((1f - num2) / 0.2f)); mat.SetFloat("headScanLineBrightness", num5); mat.SetFloat("scanRange", Mathf.Lerp(1f, cfg.ScanRange, Mathf.SmoothStep(0f, 1f, num2))); yield return null; } if ((Object)(object)_postProcess != (Object)null) { _postProcess.activeMaterials.Remove(mat); } _activeWaves.Remove(playerId); Object.Destroy((Object)(object)mat); } private void TriggerNativeUIBox(Color markerColor, PhysGrabObject physGrab, float waveDuration) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)physGrab != (Object)null) || !((Object)(object)ValuableDiscover.instance != (Object)null)) { return; } try { ValuableDiscoverCustom val = ((Component)physGrab).GetComponent<ValuableDiscoverCustom>(); if ((Object)(object)val == (Object)null) { val = ((Component)physGrab).GetComponentInChildren<ValuableDiscoverCustom>(); } if ((Object)(object)val == (Object)null) { GameObject val2 = new GameObject("ScannerCustomDiscover"); val2.transform.SetParent(((Component)physGrab).transform); val2.transform.localPosition = Vector3.zero; try { ScanControllerPatches.shouldSuppressValuableDiscoverCustomAwake = true; val = val2.AddComponent<ValuableDiscoverCustom>(); } finally { ScanControllerPatches.shouldSuppressValuableDiscoverCustomAwake = false; } } if ((Object)(object)val != (Object)null) { val.colorCorner = markerColor; val.colorMiddle = new Color(markerColor.r * 0.4f, markerColor.g * 0.4f, markerColor.b * 0.4f, 0.3f); val.waitTime = Mathf.Max(3f, waveDuration); ValuableDiscover.instance.New(physGrab, (State)3, val); } } catch { } } private void SpawnMarker(Vector3 position, Color markerColor) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0); obj.transform.position = position; Object.Destroy((Object)(object)obj.GetComponent<Collider>()); Renderer component = obj.GetComponent<Renderer>(); Material val = new Material(Shader.Find("GUI/Text Shader")); val.color = markerColor; component.material = val; obj.AddComponent<ScanMarker>(); } } [HarmonyPatch(typeof(ValuableDiscoverCustom), "Awake")] public static class ScanControllerPatches { public static bool shouldSuppressValuableDiscoverCustomAwake; [HarmonyPrefix] public static bool Prefix() { return !shouldSuppressValuableDiscoverCustomAwake; } } public class ScanMarker : MonoBehaviour { private float lifetime = 4f; private float timer; private Material mat; private Color startColor; private void Start() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) mat = ((Component)this).GetComponent<Renderer>().material; startColor = mat.color; ((Component)this).transform.localScale = Vector3.one * 0.45f; } private void Update() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0064: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) timer += Time.deltaTime; float num = timer / lifetime; if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Color color = startColor; color.a = Mathf.Lerp(1f, 0f, num); mat.color = color; ((Component)this).transform.localScale = Vector3.Lerp(Vector3.one * 0.45f, Vector3.zero, num); } } [RequireComponent(typeof(Camera))] public class ScanPostProcess : MonoBehaviour { public Material scanMaterial; public List<Material> activeMaterials = new List<Material>(); private Camera _cam; private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) _cam = ((Component)this).GetComponent<Camera>(); if ((Object)(object)_cam != (Object)null) { Camera cam = _cam; cam.depthTextureMode = (DepthTextureMode)(cam.depthTextureMode | 1); } } private void OnRenderImage(RenderTexture src, RenderTexture dest) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_00ae: Unknown result type (might be due to invalid IL or missing references) if (activeMaterials.Count == 0 || (Object)(object)_cam == (Object)null) { Graphics.Blit((Texture)(object)src, dest); return; } Matrix4x4 val = GL.GetGPUProjectionMatrix(_cam.projectionMatrix, false) * _cam.worldToCameraMatrix; Matrix4x4 inverse = ((Matrix4x4)(ref val)).inverse; RenderTexture temporary = RenderTexture.GetTemporary(((Texture)src).width, ((Texture)src).height, 0, src.format); RenderTexture temporary2 = RenderTexture.GetTemporary(((Texture)src).width, ((Texture)src).height, 0, src.format); Graphics.Blit((Texture)(object)src, temporary); bool flag = true; for (int i = 0; i < activeMaterials.Count; i++) { Material val2 = activeMaterials[i]; if (!((Object)(object)val2 == (Object)null)) { val2.SetMatrix("_InverseViewProj", inverse); if (flag) { Graphics.Blit((Texture)(object)temporary, temporary2, val2); } else { Graphics.Blit((Texture)(object)temporary2, temporary, val2); } flag = !flag; } } Graphics.Blit((Texture)(object)(flag ? temporary : temporary2), dest); RenderTexture.ReleaseTemporary(temporary); RenderTexture.ReleaseTemporary(temporary2); } } }