Decompiled source of DefaultLaserState v1.0.1

plugins/DefaultLaserState/DefaultLaserState.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.NET.Common;
using BepInExResoniteShim;
using FrooxEngine;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
[assembly: AssemblyCompany("LeCloutPanda")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+cba9a50583f9763baea8ed1b9e02884ce3f464d7")]
[assembly: AssemblyProduct("Default Laser State")]
[assembly: AssemblyTitle("DefaultLaserState")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/LeCloutPanda/DefaultLaserState")]
[assembly: AssemblyVersion("1.0.1.0")]
[module: RefSafetyRules(11)]
namespace DefaultLaserState;

[ResonitePlugin("dev.lecloutpanda.defaultlaserstate", "Default Laser State", "1.0.1", "LeCloutPanda", "https://github.com/LeCloutPanda/DefaultLaserState")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Patch : BasePlugin
{
	[HarmonyPatch(typeof(InteractionHandler), "OnAwake")]
	private class CommonToolPatch
	{
		[HarmonyPostfix]
		private static void Postfix(InteractionHandler __instance, Sync<bool> ____laserEnabled)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			InteractionHandler __instance2 = __instance;
			Sync<bool> ____laserEnabled2 = ____laserEnabled;
			((ComponentBase<Component>)(object)__instance2).RunInUpdates(3, (Action)delegate
			{
				if (((Component)__instance2).Slot.ActiveUser == ((Worker)__instance2).LocalUser)
				{
					((SyncField<bool>)(object)____laserEnabled2).Value = LASERSTATE.Value;
				}
			});
		}
	}

	private static ConfigEntry<bool> LASERSTATE;

	public override void Load()
	{
		LASERSTATE = ((BasePlugin)this).Config.Bind<bool>("General", "Default Laser State", true, "Enable/disable the laser on spawn");
		((BasePlugin)this).HarmonyInstance.PatchAll();
	}
}
public static class PluginMetadata
{
	public const string GUID = "dev.lecloutpanda.defaultlaserstate";

	public const string NAME = "Default Laser State";

	public const string VERSION = "1.0.1";

	public const string AUTHORS = "LeCloutPanda";

	public const string REPOSITORY_URL = "https://github.com/LeCloutPanda/DefaultLaserState";
}