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 AegirsWrath v0.0.9
AegirsWrath.dll
Decompiled 4 days agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("RepairKey")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("EZB")] [assembly: AssemblyProduct("RepairKey")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] namespace AegirsWrath; [BepInPlugin("EZB.AegirsWrath", "Ægir's Wrath", "0.0.9")] public sealed class AegirsWrathPlugin : BaseUnityPlugin { public const string PluginGuid = "EZB.AegirsWrath"; public const string PluginName = "Ægir's Wrath"; public const string PluginVersion = "0.0.9"; private const float VanillaSeaLevel = 30f; private ConfigEntry<bool> _enabled; private ConfigEntry<int> _startDay; private ConfigEntry<float> _risePerDay; private ConfigEntry<float> _maxSeaLevel; private ConfigEntry<float> _testSeaLevel; private ConfigEntry<float> _updateInterval; private ConfigEntry<bool> _verboseLogging; private float _elapsed; private float _lastReportedLevel = float.NaN; private void Awake() { _enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable rising sea levels."); _startDay = ((BaseUnityPlugin)this).Config.Bind<int>("Flood", "StartDay", 100, "In-game day on which flooding begins (day 1 is the first day). Default is 100 days."); _risePerDay = ((BaseUnityPlugin)this).Config.Bind<float>("Flood", "MetersPerDay", 0.05f, "Sea-level increase in meters per in-game day."); _maxSeaLevel = ((BaseUnityPlugin)this).Config.Bind<float>("Flood", "MaxSeaLevel", 200f, "Maximum absolute sea level in meters. Default is 200m; cannot be set below the vanilla 30m baseline."); _testSeaLevel = ((BaseUnityPlugin)this).Config.Bind<float>("Testing", "OverrideSeaLevel", -1f, "If >= 0, use this absolute sea level instead of day-based progression. -1 disables the override. Have tested this to 100m. Use carefully!"); _updateInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Performance", "UpdateIntervalSeconds", 2f, "How frequently to correct active water zones, in real seconds. Default = 2s. Increase if you notice performance issues."); _verboseLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Diagnostics", "VerboseLogging", false, "Log the target level and number of changed water transforms."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Ægir's Wrath 0.0.9 loaded."); } private void Update() { //IL_00b2: 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_00b9: 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) if (!_enabled.Value || (Object)(object)EnvMan.instance == (Object)null || (Object)(object)ZoneSystem.instance == (Object)null) { return; } _elapsed += Time.unscaledDeltaTime; float num = Mathf.Max(0.02f, _updateInterval.Value); if (_elapsed < num) { return; } _elapsed = 0f; float num2 = CalculateSeaLevel(); int num3 = 0; foreach (WaterVolume instance in WaterVolume.Instances) { if (!((Object)(object)instance == (Object)null) && !((Object)(object)((Component)instance).transform.parent == (Object)null)) { Transform parent = ((Component)instance).transform.parent; Vector3 position = parent.position; if (!(Mathf.Abs(position.y - num2) < 0.0001f)) { position.y = num2; parent.position = position; num3++; } } } if (_verboseLogging.Value && (num3 > 0 || float.IsNaN(_lastReportedLevel) || Mathf.Abs(num2 - _lastReportedLevel) >= 1f)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Sea level {num2:F3} m; corrected {num3} active water roots."); _lastReportedLevel = num2; } } private float CalculateSeaLevel() { float num = Mathf.Max(30f, _maxSeaLevel.Value); if (_testSeaLevel.Value >= 0f) { return Mathf.Min(_testSeaLevel.Value, num); } float num2 = (float)EnvMan.instance.GetDay() + EnvMan.instance.GetDayFraction(); float num3 = Mathf.Max(0f, num2 - (float)Mathf.Max(1, _startDay.Value)); return Mathf.Min(30f + num3 * Mathf.Max(0f, _risePerDay.Value), num); } }