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 RadiusRings v1.0.1
RadiusRings.dll
Decompiled 13 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; [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("RadiusRings")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.0+5e0b1528c9e446637b0266467670c5b0124135a3")] [assembly: AssemblyProduct("RadiusRings")] [assembly: AssemblyTitle("RadiusRings")] [assembly: AssemblyVersion("1.0.1.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 RadiusRings { [BepInPlugin("EleventhTower.valheim.radiusrings", "Radius Rings", "1.0.1")] public class Plugin : BaseUnityPlugin { private const string Guid = "EleventhTower.valheim.radiusrings"; private const string Version = "1.0.1"; private static readonly Color RingColor = new Color(0.25f, 0.9f, 1f, 0.85f); private static readonly Color HighlightColor = new Color(1f, 0.78f, 0.15f, 0.95f); private const float RingWidth = 0.06f; private const float HighlightWidth = 0.11f; private const float GroundOffset = 0.05f; private const float LabelHeight = 0.55f; private ConfigEntry<KeyboardShortcut> _toggleKey; private ConfigEntry<float> _maxRadius; private ConfigEntry<float> _ringSpacing; private ConfigEntry<int> _segments; private ConfigEntry<float> _updateInterval; private ConfigEntry<int> _highlightEvery; private bool _visible; private GameObject _root; private readonly List<LineRenderer> _rings = new List<LineRenderer>(); private readonly List<TextMesh> _labels = new List<TextMesh>(); private float _nextRefresh; private void Awake() { //IL_0021: 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: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown _toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Toggle Key", new KeyboardShortcut((KeyCode)114, (KeyCode[])(object)new KeyCode[1] { (KeyCode)307 }), "Shows or hides the distance rings around your character."); _maxRadius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Max Radius", 50f, new ConfigDescription("Rings are drawn out to this distance, in metres.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 500f), Array.Empty<object>())); _ringSpacing = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Ring Spacing", 5f, new ConfigDescription("Distance between rings, in metres.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f), Array.Empty<object>())); _segments = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Ring Segments", 64, new ConfigDescription("Points per ring. Higher is smoother but costs more per refresh.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(12, 128), Array.Empty<object>())); _updateInterval = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Update Interval", 0.15f, new ConfigDescription("Seconds between ring refreshes while visible. Lower is smoother but costs more.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.02f, 1f), Array.Empty<object>())); _highlightEvery = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Highlight Every", 2, "Every Nth ring (counting from the innermost) is drawn brighter and thicker, e.g. 2 highlights 10m/20m/30m... when spacing is 5m. 0 disables highlighting."); _maxRadius.SettingChanged += delegate { RebuildIfVisible(); }; _ringSpacing.SettingChanged += delegate { RebuildIfVisible(); }; _segments.SettingChanged += delegate { RebuildIfVisible(); }; _highlightEvery.SettingChanged += delegate { RebuildIfVisible(); }; } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = _toggleKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { _visible = !_visible; if (_visible) { RebuildRings(); } else if ((Object)(object)_root != (Object)null) { _root.SetActive(false); } } if (_visible && !((Object)(object)Player.m_localPlayer == (Object)null)) { if ((Object)(object)_root == (Object)null) { RebuildRings(); } if (!(Time.time < _nextRefresh)) { _nextRefresh = Time.time + _updateInterval.Value; RefreshRings(); } } } private void RebuildIfVisible() { if (_visible) { RebuildRings(); } } private void RebuildRings() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_0129: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_01dc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _rings.Clear(); _labels.Clear(); _root = new GameObject("RadiusRings"); _root.SetActive(true); Material material = new Material(Shader.Find("Sprites/Default")); int value = _segments.Value; float value2 = _ringSpacing.Value; int num = Mathf.Max(1, Mathf.RoundToInt(_maxRadius.Value / value2)); for (int i = 1; i <= num; i++) { bool flag = _highlightEvery.Value > 0 && i % _highlightEvery.Value == 0; GameObject val = new GameObject($"Ring_{i}"); val.transform.SetParent(_root.transform, false); LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.useWorldSpace = true; val2.loop = false; val2.positionCount = value + 1; ((Renderer)val2).material = material; val2.widthMultiplier = (flag ? 0.11f : 0.06f); Color color = (val2.endColor = (val2.startColor = (flag ? HighlightColor : RingColor))); ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; _rings.Add(val2); GameObject val5 = new GameObject($"Label_{i}"); val5.transform.SetParent(_root.transform, false); TextMesh val6 = val5.AddComponent<TextMesh>(); val6.text = $"{(float)i * value2:0}m"; val6.characterSize = 0.15f; val6.fontSize = 48; val6.anchor = (TextAnchor)4; val6.alignment = (TextAlignment)1; val6.color = color; _labels.Add(val6); } RefreshRings(); } private void RefreshRings() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)(object)_root == (Object)null) { return; } Vector3 position = ((Component)localPlayer).transform.position; position.y = 0f; float value = _ringSpacing.Value; int value2 = _segments.Value; Camera main = Camera.main; Vector3 val = Vector3.forward; if ((Object)(object)main != (Object)null) { Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude > 0.0001f) { val = ((Vector3)(ref forward)).normalized; } } Vector3 val3 = default(Vector3); float y = default(float); float y2 = default(float); for (int i = 0; i < _rings.Count; i++) { float num = (float)(i + 1) * value; LineRenderer val2 = _rings[i]; for (int j = 0; j <= value2; j++) { float num2 = (float)j / (float)value2 * MathF.PI * 2f; float num3 = position.x + Mathf.Sin(num2) * num; float num4 = position.z + Mathf.Cos(num2) * num; ((Vector3)(ref val3))..ctor(num3, position.y, num4); if (!ZoneSystem.instance.GetGroundHeight(val3, ref y)) { y = ((Component)localPlayer).transform.position.y; } val3.y = y + 0.05f; val2.SetPosition(j, val3); } TextMesh val4 = _labels[i]; Vector3 val5 = position + val * num; if (!ZoneSystem.instance.GetGroundHeight(val5, ref y2)) { y2 = ((Component)localPlayer).transform.position.y; } val5.y = y2 + 0.55f; ((Component)val4).transform.position = val5; if ((Object)(object)main != (Object)null) { ((Component)val4).transform.forward = ((Component)main).transform.forward; } } } } }