diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..bddcb96 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +[*.cs] + +# CS1591: Missing XML comment for publicly visible type or member +dotnet_diagnostic.CS1591.severity = silent diff --git a/PulsarModLoader.sln b/PulsarModLoader.sln index 84de717..97da9ea 100644 --- a/PulsarModLoader.sln +++ b/PulsarModLoader.sln @@ -12,6 +12,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PulsarInjector", "PulsarInj EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6FA95747-6271-4991-96D0-73EDCA21D402}" ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig .github\workflows\build.yml = .github\workflows\build.yml LICENSE = LICENSE README.md = README.md diff --git a/PulsarModLoader/Chat/Commands/CommandRouter/ChatCommand.cs b/PulsarModLoader/Chat/Commands/CommandRouter/ChatCommand.cs index 73105ad..bd2ebab 100644 --- a/PulsarModLoader/Chat/Commands/CommandRouter/ChatCommand.cs +++ b/PulsarModLoader/Chat/Commands/CommandRouter/ChatCommand.cs @@ -1,8 +1,10 @@ - -using System.Text; +using System.Text; namespace PulsarModLoader.Chat.Commands.CommandRouter { + /// + /// Handles a command instance for use via in-game chat. + /// public abstract class ChatCommand { /// diff --git a/PulsarModLoader/Chat/Commands/CommandRouter/ChatCommandRouter.cs b/PulsarModLoader/Chat/Commands/CommandRouter/ChatCommandRouter.cs index 5277ae7..c882028 100644 --- a/PulsarModLoader/Chat/Commands/CommandRouter/ChatCommandRouter.cs +++ b/PulsarModLoader/Chat/Commands/CommandRouter/ChatCommandRouter.cs @@ -8,10 +8,16 @@ namespace PulsarModLoader.Chat.Commands { + /// + /// Loads and handles chat commands + /// public class ChatCommandRouter { private static ChatCommandRouter _instance = null; + /// + /// Static Instance of the command router + /// public static ChatCommandRouter Instance { get diff --git a/PulsarModLoader/Chat/Commands/CommandRouter/PublicCommand.cs b/PulsarModLoader/Chat/Commands/CommandRouter/PublicCommand.cs index 54a74a5..49f3dc0 100644 --- a/PulsarModLoader/Chat/Commands/CommandRouter/PublicCommand.cs +++ b/PulsarModLoader/Chat/Commands/CommandRouter/PublicCommand.cs @@ -3,6 +3,9 @@ namespace PulsarModLoader.Chat.Commands.CommandRouter { + /// + /// Handles a public command instance for in-game chat + /// public abstract class PublicCommand { /// diff --git a/PulsarModLoader/Chat/Commands/EchoCommand.cs b/PulsarModLoader/Chat/Commands/EchoCommand.cs index 1fe1dc6..b7f78ae 100644 --- a/PulsarModLoader/Chat/Commands/EchoCommand.cs +++ b/PulsarModLoader/Chat/Commands/EchoCommand.cs @@ -1,6 +1,8 @@ using PulsarModLoader.Chat.Commands.CommandRouter; using PulsarModLoader.Utilities; + +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace PulsarModLoader.Chat.Commands { public class EchoCommand : ChatCommand @@ -25,4 +27,5 @@ public override void Execute(string arguments) Messaging.Echo(PLNetworkManager.Instance.LocalPlayer.GetPhotonPlayer(), $"Echo: {arguments}"); } } +#pragma warning restore CS1591 } diff --git a/PulsarModLoader/Chat/Extensions/ChatHelper.cs b/PulsarModLoader/Chat/Extensions/ChatHelper.cs index 7019af4..9c0dabd 100644 --- a/PulsarModLoader/Chat/Extensions/ChatHelper.cs +++ b/PulsarModLoader/Chat/Extensions/ChatHelper.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Text; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace PulsarModLoader.Chat.Extensions { public class ChatHelper @@ -354,3 +355,4 @@ public static void SetChat(PLNetworkManager instance) } } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member \ No newline at end of file diff --git a/PulsarModLoader/Chat/Extensions/HarmonyColoredMessage.cs b/PulsarModLoader/Chat/Extensions/HarmonyColoredMessage.cs index cf6e0ad..6919196 100644 --- a/PulsarModLoader/Chat/Extensions/HarmonyColoredMessage.cs +++ b/PulsarModLoader/Chat/Extensions/HarmonyColoredMessage.cs @@ -1,5 +1,6 @@ using HarmonyLib; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace PulsarModLoader.Chat.Extensions { [HarmonyPatch(typeof(PLInGameUI), "ColoredMsg")] @@ -43,3 +44,4 @@ static void Prefix(ref string inMsg, bool isShadow) } } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/PulsarModLoader/Content/Components/AutoTurret/AutoTurretMod.cs b/PulsarModLoader/Content/Components/AutoTurret/AutoTurretMod.cs index cf2b3e1..95f48b3 100644 --- a/PulsarModLoader/Content/Components/AutoTurret/AutoTurretMod.cs +++ b/PulsarModLoader/Content/Components/AutoTurret/AutoTurretMod.cs @@ -1,5 +1,8 @@ namespace PulsarModLoader.Content.Components.AutoTurret { + /// + /// Implements an AutoTurret to be loaded. + /// public abstract class AutoTurretMod { public AutoTurretMod() diff --git a/PulsarModLoader/Content/Components/AutoTurret/AutoTurretModManager.cs b/PulsarModLoader/Content/Components/AutoTurret/AutoTurretModManager.cs index 0088124..31e8ece 100644 --- a/PulsarModLoader/Content/Components/AutoTurret/AutoTurretModManager.cs +++ b/PulsarModLoader/Content/Components/AutoTurret/AutoTurretModManager.cs @@ -6,11 +6,18 @@ namespace PulsarModLoader.Content.Components.AutoTurret { + /// + /// Manages Modded AutoTurrets + /// public class AutoTurretModManager { - public readonly int VanillaAutoTurretMaxType = 0; + readonly int VanillaAutoTurretMaxType = 0; private static AutoTurretModManager m_instance = null; - public readonly List AutoTurretTypes = new List(); + readonly List AutoTurretTypes = new List(); + + /// + /// Static Manager Instance + /// public static AutoTurretModManager Instance { get @@ -66,23 +73,24 @@ public int GetAutoTurretIDFromName(string AutoTurretName) } return -1; } - } - //Converts hashes to AutoTurrets. - [HarmonyPatch(typeof(PLAutoTurret), "CreateAutoTurretFromHash")] - class AutoTurretHashFix - { - static bool Prefix(int inSubType, int inLevel, ref PLShipComponent __result) + + //Converts hashes to AutoTurrets. + [HarmonyPatch(typeof(PLAutoTurret), "CreateAutoTurretFromHash")] + class AutoTurretHashFix { - int subtypeformodded = inSubType - AutoTurretModManager.Instance.VanillaAutoTurretMaxType; - if (subtypeformodded <= AutoTurretModManager.Instance.AutoTurretTypes.Count && subtypeformodded > -1) + static bool Prefix(int inSubType, int inLevel, ref PLShipComponent __result) { - Logger.Info("Creating AutoTurret from list info"); - __result = AutoTurretModManager.Instance.AutoTurretTypes[subtypeformodded].PLAutoTurret; - __result.SubType = inSubType; - __result.Level = inLevel; - return false; + int subtypeformodded = inSubType - AutoTurretModManager.Instance.VanillaAutoTurretMaxType; + if (subtypeformodded <= AutoTurretModManager.Instance.AutoTurretTypes.Count && subtypeformodded > -1) + { + Logger.Info("Creating AutoTurret from list info"); + __result = AutoTurretModManager.Instance.AutoTurretTypes[subtypeformodded].PLAutoTurret; + __result.SubType = inSubType; + __result.Level = inLevel; + return false; + } + return true; } - return true; } } } diff --git a/PulsarModLoader/Content/Components/CPU/CPUMod.cs b/PulsarModLoader/Content/Components/CPU/CPUMod.cs index 382cb97..d2652ed 100644 --- a/PulsarModLoader/Content/Components/CPU/CPUMod.cs +++ b/PulsarModLoader/Content/Components/CPU/CPUMod.cs @@ -2,6 +2,9 @@ namespace PulsarModLoader.Content.Components.CPU { + /// + /// Implements a CPU to be loaded. + /// public abstract class CPUMod : ComponentModBase { public CPUMod() diff --git a/PulsarModLoader/Content/Components/CPU/CPUModManager.cs b/PulsarModLoader/Content/Components/CPU/CPUModManager.cs index dc49158..3b04c84 100644 --- a/PulsarModLoader/Content/Components/CPU/CPUModManager.cs +++ b/PulsarModLoader/Content/Components/CPU/CPUModManager.cs @@ -7,11 +7,18 @@ namespace PulsarModLoader.Content.Components.CPU { + /// + /// Manages Modded CPUs + /// public class CPUModManager { - public readonly int VanillaCPUMaxType = 0; + readonly int VanillaCPUMaxType = 0; private static CPUModManager m_instance = null; - public readonly List CPUTypes = new List(); + readonly List CPUTypes = new List(); + + /// + /// Static Manager Instance + /// public static CPUModManager Instance { get @@ -67,6 +74,13 @@ public int GetCPUIDFromName(string CPUName) } return -1; } + + /// + /// Creates a CPU based on input parameters. + /// + /// + /// + /// public static PLCPU CreateCPU(int Subtype, int level) { PLCPU InCPU; @@ -101,86 +115,87 @@ public static PLCPU CreateCPU(int Subtype, int level) } return InCPU; } - } - //Converts hashes to CPUs. - [HarmonyPatch(typeof(PLCPU), "CreateCPUFromHash")] - class CPUHashFix - { - static bool Prefix(int inSubType, int inLevel, ref PLShipComponent __result) + + //Converts hashes to CPUs. + [HarmonyPatch(typeof(PLCPU), "CreateCPUFromHash")] + class CPUHashFix { - __result = CPUModManager.CreateCPU(inSubType, inLevel); - return false; + static bool Prefix(int inSubType, int inLevel, ref PLShipComponent __result) + { + __result = CPUModManager.CreateCPU(inSubType, inLevel); + return false; + } } - } - [HarmonyPatch(typeof(PLCPU), "FinalLateAddStats")] - class CPUFinalLateAddStatsPatch - { - static void Postfix(PLCPU __instance) + [HarmonyPatch(typeof(PLCPU), "FinalLateAddStats")] + class CPUFinalLateAddStatsPatch { - int subtypeformodded = __instance.SubType - CPUModManager.Instance.VanillaCPUMaxType; - if (subtypeformodded > -1 && subtypeformodded < CPUModManager.Instance.CPUTypes.Count) + static void Postfix(PLCPU __instance) { - CPUModManager.Instance.CPUTypes[subtypeformodded].FinalLateAddStats(__instance); + int subtypeformodded = __instance.SubType - CPUModManager.Instance.VanillaCPUMaxType; + if (subtypeformodded > -1 && subtypeformodded < CPUModManager.Instance.CPUTypes.Count) + { + CPUModManager.Instance.CPUTypes[subtypeformodded].FinalLateAddStats(__instance); + } } } - } - [HarmonyPatch(typeof(PLCPU), "WhenProgramIsRun")] - class CPWhenProgramIsRunPatch - { - static void Postfix(PLWarpDriveProgram inProgram, PLCPU __instance) + [HarmonyPatch(typeof(PLCPU), "WhenProgramIsRun")] + class CPWhenProgramIsRunPatch { - int subtypeformodded = __instance.SubType - CPUModManager.Instance.VanillaCPUMaxType; - if (subtypeformodded > -1 && subtypeformodded < CPUModManager.Instance.CPUTypes.Count && inProgram != null) + static void Postfix(PLWarpDriveProgram inProgram, PLCPU __instance) { - CPUModManager.Instance.CPUTypes[subtypeformodded].WhenProgramIsRun(inProgram); + int subtypeformodded = __instance.SubType - CPUModManager.Instance.VanillaCPUMaxType; + if (subtypeformodded > -1 && subtypeformodded < CPUModManager.Instance.CPUTypes.Count && inProgram != null) + { + CPUModManager.Instance.CPUTypes[subtypeformodded].WhenProgramIsRun(inProgram); + } } } - } - [HarmonyPatch(typeof(PLCPU), "AddStats")] - class CPUAddStatsPatch - { - static void Postfix(PLCPU __instance) + [HarmonyPatch(typeof(PLCPU), "AddStats")] + class CPUAddStatsPatch { - int subtypeformodded = __instance.SubType - CPUModManager.Instance.VanillaCPUMaxType; - if (subtypeformodded > -1 && subtypeformodded < CPUModManager.Instance.CPUTypes.Count) + static void Postfix(PLCPU __instance) { - CPUModManager.Instance.CPUTypes[subtypeformodded].AddStats(__instance); + int subtypeformodded = __instance.SubType - CPUModManager.Instance.VanillaCPUMaxType; + if (subtypeformodded > -1 && subtypeformodded < CPUModManager.Instance.CPUTypes.Count) + { + CPUModManager.Instance.CPUTypes[subtypeformodded].AddStats(__instance); + } } } - } - [HarmonyPatch(typeof(PLCPU), "Tick")] - class CPUTickPatch - { - static void Postfix(PLCPU __instance) + [HarmonyPatch(typeof(PLCPU), "Tick")] + class CPUTickPatch { - int subtypeformodded = __instance.SubType - CPUModManager.Instance.VanillaCPUMaxType; - if (subtypeformodded > -1 && subtypeformodded < CPUModManager.Instance.CPUTypes.Count) + static void Postfix(PLCPU __instance) { - CPUModManager.Instance.CPUTypes[subtypeformodded].Tick(__instance); + int subtypeformodded = __instance.SubType - CPUModManager.Instance.VanillaCPUMaxType; + if (subtypeformodded > -1 && subtypeformodded < CPUModManager.Instance.CPUTypes.Count) + { + CPUModManager.Instance.CPUTypes[subtypeformodded].Tick(__instance); + } } } - } - [HarmonyPatch(typeof(PLCPU), "GetStatLineRight")] - class CPUGetStatLineRightPatch - { - static void Postfix(PLCPU __instance, ref string __result) + [HarmonyPatch(typeof(PLCPU), "GetStatLineRight")] + class CPUGetStatLineRightPatch { - int subtypeformodded = __instance.SubType - CPUModManager.Instance.VanillaCPUMaxType; - if (subtypeformodded > -1 && subtypeformodded < CPUModManager.Instance.CPUTypes.Count) + static void Postfix(PLCPU __instance, ref string __result) { - __result = CPUModManager.Instance.CPUTypes[subtypeformodded].GetStatLineRight(__instance); + int subtypeformodded = __instance.SubType - CPUModManager.Instance.VanillaCPUMaxType; + if (subtypeformodded > -1 && subtypeformodded < CPUModManager.Instance.CPUTypes.Count) + { + __result = CPUModManager.Instance.CPUTypes[subtypeformodded].GetStatLineRight(__instance); + } } } - } - [HarmonyPatch(typeof(PLCPU), "GetStatLineLeft")] - class CPUGetStatLineLeftPatch - { - static void Postfix(PLCPU __instance, ref string __result) + [HarmonyPatch(typeof(PLCPU), "GetStatLineLeft")] + class CPUGetStatLineLeftPatch { - int subtypeformodded = __instance.SubType - CPUModManager.Instance.VanillaCPUMaxType; - if (subtypeformodded > -1 && subtypeformodded < CPUModManager.Instance.CPUTypes.Count) + static void Postfix(PLCPU __instance, ref string __result) { - __result = CPUModManager.Instance.CPUTypes[subtypeformodded].GetStatLineLeft(__instance); + int subtypeformodded = __instance.SubType - CPUModManager.Instance.VanillaCPUMaxType; + if (subtypeformodded > -1 && subtypeformodded < CPUModManager.Instance.CPUTypes.Count) + { + __result = CPUModManager.Instance.CPUTypes[subtypeformodded].GetStatLineLeft(__instance); + } } } } diff --git a/PulsarModLoader/Content/Components/CaptainsChair/CaptainsChairMod.cs b/PulsarModLoader/Content/Components/CaptainsChair/CaptainsChairMod.cs index f108088..fec5086 100644 --- a/PulsarModLoader/Content/Components/CaptainsChair/CaptainsChairMod.cs +++ b/PulsarModLoader/Content/Components/CaptainsChair/CaptainsChairMod.cs @@ -1,7 +1,13 @@ namespace PulsarModLoader.Content.Components.CaptainsChair { + /// + /// Implements a captains chair to be loaded. + /// public abstract class CaptainsChairMod : ComponentModBase { + /// + /// Implements a captains chair to be loaded. + /// public CaptainsChairMod() { } diff --git a/PulsarModLoader/Content/Components/CaptainsChair/CaptainsChairModManager.cs b/PulsarModLoader/Content/Components/CaptainsChair/CaptainsChairModManager.cs index 0ecb89c..1c62feb 100644 --- a/PulsarModLoader/Content/Components/CaptainsChair/CaptainsChairModManager.cs +++ b/PulsarModLoader/Content/Components/CaptainsChair/CaptainsChairModManager.cs @@ -7,11 +7,18 @@ namespace PulsarModLoader.Content.Components.CaptainsChair { + /// + /// Manages Modded Captains Chairs + /// public class CaptainsChairModManager { - public readonly int VanillaCaptainsChairMaxType = 0; + readonly int VanillaCaptainsChairMaxType = 0; private static CaptainsChairModManager m_instance = null; - public readonly List CaptainsChairTypes = new List(); + readonly List CaptainsChairTypes = new List(); + + /// + /// Static Manager Instance. + /// public static CaptainsChairModManager Instance { get @@ -96,26 +103,27 @@ public static PLCaptainsChair CreateCaptainsChair(int Subtype, int level) } return InCaptainsChair; } - } - //Converts hashes to CaptainsChairs. - [HarmonyPatch(typeof(PLCaptainsChair), "CreateCaptainsChairFromHash")] - class CaptainsChairHashFix - { - static bool Prefix(int inSubType, int inLevel, ref PLShipComponent __result) + + //Converts hashes to CaptainsChairs. + [HarmonyPatch(typeof(PLCaptainsChair), "CreateCaptainsChairFromHash")] + class CaptainsChairHashFix { - __result = CaptainsChairModManager.CreateCaptainsChair(inSubType, inLevel); - return false; + static bool Prefix(int inSubType, int inLevel, ref PLShipComponent __result) + { + __result = CaptainsChairModManager.CreateCaptainsChair(inSubType, inLevel); + return false; + } } - } - [HarmonyPatch(typeof(PLCaptainsChair), "LateAddStats")] - class CaptainsChairLateAddStatsPatch - { - static void Postfix(PLShipStats inStats, PLCaptainsChair __instance) + [HarmonyPatch(typeof(PLCaptainsChair), "LateAddStats")] + class CaptainsChairLateAddStatsPatch { - int subtypeformodded = __instance.SubType - CaptainsChairModManager.Instance.VanillaCaptainsChairMaxType; - if (subtypeformodded > -1 && subtypeformodded < CaptainsChairModManager.Instance.CaptainsChairTypes.Count && inStats != null) + static void Postfix(PLShipStats inStats, PLCaptainsChair __instance) { - CaptainsChairModManager.Instance.CaptainsChairTypes[subtypeformodded].LateAddStats(__instance); + int subtypeformodded = __instance.SubType - CaptainsChairModManager.Instance.VanillaCaptainsChairMaxType; + if (subtypeformodded > -1 && subtypeformodded < CaptainsChairModManager.Instance.CaptainsChairTypes.Count && inStats != null) + { + CaptainsChairModManager.Instance.CaptainsChairTypes[subtypeformodded].LateAddStats(__instance); + } } } } diff --git a/PulsarModLoader/Content/Components/ComponentModBase.cs b/PulsarModLoader/Content/Components/ComponentModBase.cs index 56d30bb..9416575 100644 --- a/PulsarModLoader/Content/Components/ComponentModBase.cs +++ b/PulsarModLoader/Content/Components/ComponentModBase.cs @@ -2,6 +2,9 @@ namespace PulsarModLoader.Content.Components { + /// + /// Base Abstraction for Modded Components + /// public abstract class ComponentModBase { public virtual string Name diff --git a/PulsarModLoader/Content/Components/Extractor/ExtractorMod.cs b/PulsarModLoader/Content/Components/Extractor/ExtractorMod.cs index f7ce287..ace7b56 100644 --- a/PulsarModLoader/Content/Components/Extractor/ExtractorMod.cs +++ b/PulsarModLoader/Content/Components/Extractor/ExtractorMod.cs @@ -1,6 +1,9 @@ using System.Reflection; namespace PulsarModLoader.Content.Components.Extractor { + /// + /// Extractor Modded Component Abstraction + /// public abstract class ExtractorMod : ComponentModBase { public ExtractorMod() diff --git a/PulsarModLoader/Content/Items/ItemModManager.cs b/PulsarModLoader/Content/Items/ItemModManager.cs index d943141..71bd875 100644 --- a/PulsarModLoader/Content/Items/ItemModManager.cs +++ b/PulsarModLoader/Content/Items/ItemModManager.cs @@ -55,6 +55,8 @@ public static ItemModManager Instance /// Finds Item type equivilent to given name and returns MainType ID and SubType ID needed to spawn. Returns -1 if couldn't find Item. /// /// modded item's Name set in ItemMod.name + /// + /// /// Maintype and Subtype public void GetItemIDsFromName(string ItemName, out int MainType, out int SubType) { diff --git a/PulsarModLoader/PMLConfig.cs b/PulsarModLoader/PMLConfig.cs index 486e9f9..b402ab4 100644 --- a/PulsarModLoader/PMLConfig.cs +++ b/PulsarModLoader/PMLConfig.cs @@ -1,6 +1,7 @@ using System; using UnityEngine; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace PulsarModLoader { public static class PMLConfig @@ -25,3 +26,4 @@ public static void SetDefault() } } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/PulsarModLoader/Patches/HarmonyHelpers.cs b/PulsarModLoader/Patches/HarmonyHelpers.cs index e392ba4..5474d99 100644 --- a/PulsarModLoader/Patches/HarmonyHelpers.cs +++ b/PulsarModLoader/Patches/HarmonyHelpers.cs @@ -8,8 +8,22 @@ namespace PulsarModLoader.Patches { + /// + /// Provides helper functions for Harmony Transpilers. + /// public static class HarmonyHelpers { + /// + /// Modifies instructions targetSequence with patchSequence based on input PatchMode and CheckMode. + /// + /// Input pre-modified Transpiler Instructions here + /// Targeted Instructions collection + /// Inserted Instructions collection + /// + /// + /// + /// Modified instructions based on input values + /// public static IEnumerable PatchBySequence(IEnumerable instructions, IEnumerable targetSequence, IEnumerable patchSequence, PatchMode patchMode = PatchMode.AFTER, CheckMode checkMode = CheckMode.ALWAYS, bool showDebugOutput = false) { List Instructions = instructions.ToList(); //create new list to be modified and returned. diff --git a/PulsarModLoader/Patches/PLGlobalStart.cs b/PulsarModLoader/Patches/PLGlobalStart.cs index 4b0b1b1..2bb965c 100644 --- a/PulsarModLoader/Patches/PLGlobalStart.cs +++ b/PulsarModLoader/Patches/PLGlobalStart.cs @@ -29,8 +29,7 @@ static void Prefix() new MPModChecks.MPModCheckManager(); //ModLoading - string modsDir = Path.Combine(Directory.GetCurrentDirectory(), "Mods"); - ModManager.Instance.LoadModsDirectory(modsDir); + ModManager.Instance.LoadModsDirectory(ModManager.GetModsDir()); modsLoaded = true; } diff --git a/PulsarModLoader/PulsarModLoader.csproj b/PulsarModLoader/PulsarModLoader.csproj index 3f7fbea..55238b5 100644 --- a/PulsarModLoader/PulsarModLoader.csproj +++ b/PulsarModLoader/PulsarModLoader.csproj @@ -285,6 +285,9 @@ + + .editorconfig + diff --git a/PulsarModLoader/SaveData/PMLSaveData.cs b/PulsarModLoader/SaveData/PMLSaveData.cs index f0346f6..94bf483 100644 --- a/PulsarModLoader/SaveData/PMLSaveData.cs +++ b/PulsarModLoader/SaveData/PMLSaveData.cs @@ -1,11 +1,37 @@ namespace PulsarModLoader.SaveData { + /// + /// Abstract class for creation of modded Savegame Data. + /// public abstract class PMLSaveData { + /// + /// For internal use, do not modify + /// public PulsarMod MyMod; + + /// + /// Overridable Identifier for SaveData. Cannot have the Identifier between savedata in the same mod. + /// + /// public abstract string Identifier(); + + /// + /// VersionID. Defaults to 0, used to differenctiate savedata formats across multiple versions of a mod. + /// public virtual uint VersionID => 0; + + /// + /// Saves data returned via Byte format. + /// + /// public abstract byte[] SaveData(); + + /// + /// Loads data from savegame files. + /// + /// loaded data + /// public abstract void LoadData(byte[] Data, uint VersionID); } } diff --git a/PulsarModLoader/Utilities/Clipboard.cs b/PulsarModLoader/Utilities/Clipboard.cs index 2fb732b..820b9b1 100644 --- a/PulsarModLoader/Utilities/Clipboard.cs +++ b/PulsarModLoader/Utilities/Clipboard.cs @@ -1,5 +1,6 @@ using UnityEngine; +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member namespace PulsarModLoader.Utilities { public static class Clipboard @@ -15,3 +16,4 @@ public static string Paste() } } } +#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member diff --git a/PulsarModLoader/Utilities/Messaging.cs b/PulsarModLoader/Utilities/Messaging.cs index f55dc36..394ae8f 100644 --- a/PulsarModLoader/Utilities/Messaging.cs +++ b/PulsarModLoader/Utilities/Messaging.cs @@ -3,8 +3,17 @@ namespace PulsarModLoader.Utilities { + /// + /// Handles messages for local and other clients. + /// public static class Messaging { + /// + /// Inserts a line to text chat based on input params with sending player prefix + /// + /// + /// + /// public static void ChatMessage(PLPlayer recipient, string message, int sendingPlayerId = -1) { if (recipient == null || message == null) @@ -19,6 +28,12 @@ public static void ChatMessage(PLPlayer recipient, string message, int sendingPl ChatMessage(recipient.GetPhotonPlayer(), message, sendingPlayerId); } + /// + /// Inserts a line to text chat based on input params with sending player prefix + /// + /// + /// + /// public static void ChatMessage(PhotonPlayer recipient, string message, int sendingPlayerId = -1) { if (recipient == null || message == null) @@ -37,6 +52,12 @@ public static void ChatMessage(PhotonPlayer recipient, string message, int sendi }); } + /// + /// Inserts a line to text chat based on input params with sending player prefix + /// + /// + /// + /// public static void ChatMessage(PhotonTargets targets, string message, int sendingPlayerId = -1) { if (message == null) @@ -55,6 +76,11 @@ public static void ChatMessage(PhotonTargets targets, string message, int sendin }); } + /// + /// Inserts a line to text chat based on input params + /// + /// + /// public static void Echo(PLPlayer recipient, string message) { if (recipient == null || message == null) @@ -66,6 +92,11 @@ public static void Echo(PLPlayer recipient, string message) Echo(recipient.GetPhotonPlayer(), message); } + /// + /// Inserts a line to text chat based on input params + /// + /// + /// public static void Echo(PhotonPlayer recipient, string message) { if (recipient == null || message == null) @@ -79,6 +110,11 @@ public static void Echo(PhotonPlayer recipient, string message) }); } + /// + /// Inserts a line to text chat based on input params + /// + /// + /// public static void Echo(PhotonTargets targets, string message) { if (message == null) @@ -91,6 +127,15 @@ public static void Echo(PhotonTargets targets, string message) message }); } + + /// + /// Adds a Notification to the left side of the screen based on input params + /// + /// + /// + /// + /// + /// public static void Notification(string message, PLPlayer recipient = null, int subjectPlayerId = 0, int durationMs = 6000, bool addToShipLog = false) { if (recipient == null && PLNetworkManager.Instance != null) @@ -99,6 +144,15 @@ public static void Notification(string message, PLPlayer recipient = null, int s } Notification(message, recipient.GetPhotonPlayer(), subjectPlayerId, durationMs, addToShipLog); } + + /// + /// Adds a Notification to the left side of the screen based on input params + /// + /// + /// + /// + /// + /// public static void Notification(string message, PhotonPlayer recipient, int subjectPlayerId = 0, int durationMs = 6000, bool addToShipLog = false) { if (PLServer.Instance == null) @@ -121,6 +175,14 @@ public static void Notification(string message, PhotonPlayer recipient, int subj }); } + /// + /// Adds a Notification to the left side of the screen based on input params + /// + /// + /// + /// + /// + /// public static void Notification(string message, PhotonTargets targets, int subjectPlayerId = 0, int durationMs = 6000, bool addToShipLog = false) { if (PLServer.Instance == null) @@ -144,6 +206,14 @@ public static void Notification(string message, PhotonTargets targets, int subje }); } + /// + /// Adds a CenterPrint Message to the top of the screen based on input params + /// + /// + /// + /// + /// + /// public static void Centerprint(string message, PLPlayer recipient, string tag = "msg", Color color = new Color(), EWarningType type = EWarningType.E_NORMAL) { if (recipient == null || message == null || tag == null) @@ -155,6 +225,14 @@ public static void Notification(string message, PhotonTargets targets, int subje Centerprint(message, recipient.GetPhotonPlayer(), tag, color, type); } + /// + /// Adds a CenterPrint Message to the top of the screen based on input params + /// + /// + /// + /// + /// + /// public static void Centerprint(string message, PhotonPlayer recipient, string tag = "msg", Color color = new Color(), EWarningType type = EWarningType.E_NORMAL) { if (recipient == null || message == null || tag == null) @@ -171,6 +249,14 @@ public static void Notification(string message, PhotonTargets targets, int subje }); } + /// + /// Adds a CenterPrint Message to the top of the screen based on input params + /// + /// + /// + /// + /// + /// public static void Centerprint(string message, PhotonTargets targets, string tag = "msg", Color color = new Color(), EWarningType type = EWarningType.E_NORMAL) { if (message == null || tag == null) @@ -187,6 +273,17 @@ public static void Notification(string message, PhotonTargets targets, int subje }); } + /// + /// Adds entry to ship log based on input params + /// + /// + /// + /// + /// + /// + /// + /// + /// public static void ShipLog(string message, string tag = "msg", Color color = new Color(), bool addOnlyLocally = false, PLShipInfoBase source = null, PLShipInfoBase destination = null, int turretID = -1, int damage = 0) { if (PhotonNetwork.isMasterClient)