Decompiled source of RotateSpacePropsAroundShip v1.0.1

EdwinTeam.RotateSpacePropsAroundShip.dll

Decompiled an hour ago
using 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 BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("EdwinTeam")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Allows you to rotate the space props (e.g. the planets, the sun) around the ship.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("Rotate Space Props Around Ship")]
[assembly: AssemblyTitle("EdwinTeam.RotateSpacePropsAroundShip")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 EdwinTeam.RotateSpacePropsAroundShip
{
	[BepInPlugin("EdwinTeam.RotateSpacePropsAroundShip", "Rotate Space Props Around Ship", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigEntry<float> configSpacePropsRotation;

		public static ConfigEntry<float> configSunRotation;

		internal static ManualLogSource Logger;

		private readonly Harmony harmony = new Harmony("EdwinTeam.RotateSpacePropsAroundShip");

		private void Awake()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			configSpacePropsRotation = ((BaseUnityPlugin)this).Config.Bind<float>("General", "SpacePropsRotation", 0f, new ConfigDescription("The amount the props in space (e.g. the planets) should be rotated around the ship.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 360f), Array.Empty<object>()));
			configSunRotation = ((BaseUnityPlugin)this).Config.Bind<float>("General", "SunRotation", 0f, new ConfigDescription("The amount the sun (in space, not when landed) should be rotated around the ship.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 360f), Array.Empty<object>()));
			Logger.LogInfo((object)"Plugin EdwinTeam.RotateSpacePropsAroundShip is loaded!");
			harmony.PatchAll(typeof(RotateSpacePropsAroundShip));
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "Awake")]
	internal class RotateSpacePropsAroundShip
	{
		private const string SpacePropsPath = "Environment/SpaceProps";

		private const string SunPath = "Environment/Lighting/Sun";

		[HarmonyPostfix]
		private static void Postfix(StartOfRound __instance)
		{
			//IL_0056: 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_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)
			GameObject val = GameObject.Find("Environment/SpaceProps");
			if ((Object)(object)val == (Object)null)
			{
				Plugin.Logger.LogError((object)"Couldn't find SpaceProps at `Environment/SpaceProps`");
				return;
			}
			GameObject val2 = GameObject.Find("Environment/Lighting/Sun");
			if ((Object)(object)val2 == (Object)null)
			{
				Plugin.Logger.LogError((object)"Couldn't find Sun at `Environment/Lighting/Sun`");
				return;
			}
			Transform elevatorTransform = __instance.elevatorTransform;
			val.transform.RotateAround(elevatorTransform.position, Vector3.up, Plugin.configSpacePropsRotation.Value);
			val2.transform.RotateAround(elevatorTransform.position, Vector3.up, Plugin.configSunRotation.Value);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "EdwinTeam.RotateSpacePropsAroundShip";

		public const string PLUGIN_NAME = "Rotate Space Props Around Ship";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}