using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
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: AssemblyTitle("DoorSpeedModifier")]
[assembly: AssemblyDescription("https://thunderstore.io/c/valheim/p/blacks7ar/DoorSpeedModifier/")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyProduct("DoorSpeedModifier")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("FD72F97F-FACE-4F90-A8B1-53D5C768F4F6")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 DoorSpeedModifier
{
[BepInPlugin("blacks7ar.DoorSpeedModifier", "DoorSpeedModifier", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(Door), "Interact")]
private class Patches
{
private static void Postfix(Door __instance)
{
if (!((Object)(object)__instance == (Object)null) && __instance.CanInteract() && __instance.m_nview.IsValid() && __instance.m_nview.IsOwner() && !((Object)(object)__instance.m_animator == (Object)null))
{
__instance.m_animator.speed = _speed.Value;
}
}
}
private const string modGUID = "blacks7ar.DoorSpeedModifier";
public const string modName = "DoorSpeedModifier";
public const string modAuthor = "blacks7ar";
public const string modVersion = "1.0.1";
public const string modLink = "https://thunderstore.io/c/valheim/p/blacks7ar/DoorSpeedModifier/";
private static readonly Harmony _harmony = new Harmony("blacks7ar.DoorSpeedModifier");
private static ConfigEntry<float> _speed;
public void Awake()
{
((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
_speed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Speed", 0.5f, "Door open close animation speed.");
((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
((BaseUnityPlugin)this).Config.Save();
Assembly executingAssembly = Assembly.GetExecutingAssembly();
_harmony.PatchAll(executingAssembly);
}
private void OnDestroy()
{
((BaseUnityPlugin)this).Config.Save();
}
}
}