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 SteadySail v1.0.0
Cjayride.SteadySail.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyCompany("Cjayride.SteadySail")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Cjayride.SteadySail")] [assembly: AssemblyTitle("Cjayride.SteadySail")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 Cjayride.SteadySail { [BepInPlugin("cjayride.SteadySail", "Steady Sail", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "cjayride.SteadySail"; public const string PluginName = "Steady Sail"; public const string PluginVersion = "1.0.0"; public static ConfigEntry<float> SettleSeconds; public static ConfigEntry<float> MaxUpSpeed; private void Awake() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) SettleSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Settle seconds", 0.4f, "After the sail reaches its new height, keep damping the roll for this many seconds."); MaxUpSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Max upward speed", 1.5f, "Upward speed cap, in meters per second, while the sail is moving. Stops the mast shove from launching the hull."); new Harmony("cjayride.SteadySail").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Sail changes no longer roll or launch the boat."); } internal static void Steady(Ship ship) { if (!((Object)(object)ship == (Object)null) && ship.m_hasSail && !((Object)(object)ship.m_body == (Object)null)) { SailSettle sailSettle = ((Component)ship).GetComponent<SailSettle>(); if ((Object)(object)sailSettle == (Object)null) { sailSettle = ((Component)ship).gameObject.AddComponent<SailSettle>(); } sailSettle.Apply(ship); } } } [DefaultExecutionOrder(10000)] internal sealed class SailSettle : MonoBehaviour { private float _until; public void Apply(Ship ship) { //IL_0043: 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_004a: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0059: 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_005b: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) if (!ship.m_sailWasInPosition) { _until = Time.time + Mathf.Max(0f, Plugin.SettleSeconds.Value); } if (!(Time.time > _until)) { Rigidbody body = ship.m_body; Vector3 up = ((Component)ship).transform.up; Vector3 angularVelocity = body.angularVelocity; Vector3 val = Vector3.Project(angularVelocity, up); body.angularVelocity = val + (angularVelocity - val) * 0.1f; Vector3 linearVelocity = body.linearVelocity; float num = Vector3.Dot(linearVelocity, Vector3.up); float value = Plugin.MaxUpSpeed.Value; if (num > value) { body.linearVelocity = linearVelocity - Vector3.up * (num - value); } } } } [HarmonyPatch(typeof(Ship), "CustomFixedUpdate")] internal static class AfterShipPhysics { private static void Postfix(Ship __instance) { Plugin.Steady(__instance); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }