using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; 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 CG; using CG.Client.Player.Interactions; using CG.Client.Ship.Views; using CG.Game; using CG.Space; using Gameplay.Ship; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using VoidManager; using VoidManager.CustomGUI; using VoidManager.MPModChecks; using VoidManager.Utilities; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("EngineTrimColor")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2+95ba690d053704f55c037869e72de39c511aa9de")] [assembly: AssemblyProduct("EngineTrimColor")] [assembly: AssemblyTitle("Makes the engine trim colors customizable")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.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 EngineTrimColor { internal class Configs { private static readonly FieldInfo diodeSetting = AccessTools.Field(typeof(Diode), "setting"); private static readonly FieldInfo settingNeutralColor = AccessTools.Field(typeof(DiodeSetting), "neutralColor"); internal static Color DefaultColor = new Color(0f, 4f, 10f, 1f); internal static Color CurrentColor; internal static ConfigEntry TrimColorR; internal static ConfigEntry TrimColorG; internal static ConfigEntry TrimColorB; internal static void UpdateColorConfig() { TrimColorR.Value = CurrentColor.r; TrimColorG.Value = CurrentColor.g; TrimColorB.Value = CurrentColor.b; try { AbstractInteractable[] componentsInChildren = ((AbstractCloneStarObject)((AbstractCloneStarObject)ClientGame.Current.PlayerShip).GameObject.GetComponentInChildren()).GameObject.GetComponentsInChildren(); List list = new List(); AbstractInteractable[] array = componentsInChildren; foreach (AbstractInteractable val in array) { list.AddRange(((Component)val).gameObject.GetComponentsInChildren()); } IEnumerable enumerable = ((IEnumerable)list).Select((Func)((Diode d) => (DiodeSetting)diodeSetting.GetValue(d))).Distinct(); CollectionExtensions.Do(enumerable, (Action)delegate(DiodeSetting setting) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) settingNeutralColor.SetValue(setting, CurrentColor); }); CollectionExtensions.Do((IEnumerable)list, (Action)delegate(Diode d) { d.SetPoweredColorNegative(); d.SetPoweredColorNeutral(); }); } catch (NullReferenceException) { } catch (Exception ex2) { Debug.LogError((object)("Caught exception while updating engine trim colors\n" + ex2)); } } internal static void Load(BepinPlugin plugin) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) TrimColorR = ((BaseUnityPlugin)plugin).Config.Bind("TrimColor", "TrimColorR", DefaultColor.r, (ConfigDescription)null); TrimColorG = ((BaseUnityPlugin)plugin).Config.Bind("TrimColor", "TrimColorG", DefaultColor.g, (ConfigDescription)null); TrimColorB = ((BaseUnityPlugin)plugin).Config.Bind("TrimColor", "TrimColorB", DefaultColor.b, (ConfigDescription)null); CurrentColor = new Color(TrimColorR.Value, TrimColorG.Value, TrimColorB.Value, 1f); } } internal class GUI : ModSettingsMenu { public override string Name() { return "Engine Trim Color"; } public override void Draw() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (GUITools.DrawColorPicker(new Rect(8f, 58f, 480f, 160f), "Engine Trim Color", ref Configs.CurrentColor, Configs.DefaultColor, false, 0f, 20f)) { Configs.UpdateColorConfig(); } } } public class MyPluginInfo { public const string PLUGIN_GUID = "18107.EngineTrimColor"; public const string PLUGIN_NAME = "EngineTrimColor"; public const string USERS_PLUGIN_NAME = "Engine Trim Color"; public const string PLUGIN_VERSION = "1.0.2"; public const string PLUGIN_DESCRIPTION = "Makes the engine trim colors customizable"; public const string PLUGIN_ORIGINAL_AUTHOR = "18107"; public const string PLUGIN_AUTHORS = "18107"; public const string PLUGIN_THUNDERSTORE_ID = "NihilityShift/EngineTrimColor"; } [HarmonyPatch(typeof(PlayerControlledShip), "Awake")] internal class PlayerControlledShipPatch { private static void Postfix() { Configs.UpdateColorConfig(); } } [BepInPlugin("18107.EngineTrimColor", "Engine Trim Color", "1.0.2")] [BepInProcess("Void Crew.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BepinPlugin : BaseUnityPlugin { internal static ManualLogSource Log; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "18107.EngineTrimColor"); Configs.Load(this); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin 18107.EngineTrimColor is loaded!"); } } public class VoidManagerPlugin : VoidPlugin { public override MultiplayerType MPType => (MultiplayerType)8; public override string Author => "18107"; public override string Description => "Makes the engine trim colors customizable"; public override string ThunderstoreID => "NihilityShift/EngineTrimColor"; } }