Skip to content

Commit

Permalink
Added some XML documentation, Reconfigured XML Warnings to silent.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagord committed Nov 30, 2023
1 parent cf68fcb commit f0bf196
Show file tree
Hide file tree
Showing 24 changed files with 313 additions and 96 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.cs]

# CS1591: Missing XML comment for publicly visible type or member
dotnet_diagnostic.CS1591.severity = silent
1 change: 1 addition & 0 deletions PulsarModLoader.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions PulsarModLoader/Chat/Commands/CommandRouter/ChatCommand.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@

using System.Text;
using System.Text;

namespace PulsarModLoader.Chat.Commands.CommandRouter
{
/// <summary>
/// Handles a command instance for use via in-game chat.
/// </summary>
public abstract class ChatCommand
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@

namespace PulsarModLoader.Chat.Commands
{
/// <summary>
/// Loads and handles chat commands
/// </summary>
public class ChatCommandRouter
{
private static ChatCommandRouter _instance = null;

/// <summary>
/// Static Instance of the command router
/// </summary>
public static ChatCommandRouter Instance
{
get
Expand Down
3 changes: 3 additions & 0 deletions PulsarModLoader/Chat/Commands/CommandRouter/PublicCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

namespace PulsarModLoader.Chat.Commands.CommandRouter
{
/// <summary>
/// Handles a public command instance for in-game chat
/// </summary>
public abstract class PublicCommand
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions PulsarModLoader/Chat/Commands/EchoCommand.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -25,4 +27,5 @@ public override void Execute(string arguments)
Messaging.Echo(PLNetworkManager.Instance.LocalPlayer.GetPhotonPlayer(), $"Echo: {arguments}");
}
}
#pragma warning restore CS1591
}
2 changes: 2 additions & 0 deletions PulsarModLoader/Chat/Extensions/ChatHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -354,3 +355,4 @@ public static void SetChat(PLNetworkManager instance)
}
}
}
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
2 changes: 2 additions & 0 deletions PulsarModLoader/Chat/Extensions/HarmonyColoredMessage.cs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace PulsarModLoader.Content.Components.AutoTurret
{
/// <summary>
/// Implements an AutoTurret to be loaded.
/// </summary>
public abstract class AutoTurretMod
{
public AutoTurretMod()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@

namespace PulsarModLoader.Content.Components.AutoTurret
{
/// <summary>
/// Manages Modded AutoTurrets
/// </summary>
public class AutoTurretModManager
{
public readonly int VanillaAutoTurretMaxType = 0;
readonly int VanillaAutoTurretMaxType = 0;
private static AutoTurretModManager m_instance = null;
public readonly List<AutoTurretMod> AutoTurretTypes = new List<AutoTurretMod>();
readonly List<AutoTurretMod> AutoTurretTypes = new List<AutoTurretMod>();

/// <summary>
/// Static Manager Instance
/// </summary>
public static AutoTurretModManager Instance
{
get
Expand Down Expand Up @@ -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;
}
}
}
3 changes: 3 additions & 0 deletions PulsarModLoader/Content/Components/CPU/CPUMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace PulsarModLoader.Content.Components.CPU
{
/// <summary>
/// Implements a CPU to be loaded.
/// </summary>
public abstract class CPUMod : ComponentModBase
{
public CPUMod()
Expand Down
131 changes: 73 additions & 58 deletions PulsarModLoader/Content/Components/CPU/CPUModManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@

namespace PulsarModLoader.Content.Components.CPU
{
/// <summary>
/// Manages Modded CPUs
/// </summary>
public class CPUModManager
{
public readonly int VanillaCPUMaxType = 0;
readonly int VanillaCPUMaxType = 0;
private static CPUModManager m_instance = null;
public readonly List<CPUMod> CPUTypes = new List<CPUMod>();
readonly List<CPUMod> CPUTypes = new List<CPUMod>();

/// <summary>
/// Static Manager Instance
/// </summary>
public static CPUModManager Instance
{
get
Expand Down Expand Up @@ -67,6 +74,13 @@ public int GetCPUIDFromName(string CPUName)
}
return -1;
}

/// <summary>
/// Creates a CPU based on input parameters.
/// </summary>
/// <param name="Subtype"></param>
/// <param name="level"></param>
/// <returns></returns>
public static PLCPU CreateCPU(int Subtype, int level)
{
PLCPU InCPU;
Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
namespace PulsarModLoader.Content.Components.CaptainsChair
{
/// <summary>
/// Implements a captains chair to be loaded.
/// </summary>
public abstract class CaptainsChairMod : ComponentModBase
{
/// <summary>
/// Implements a captains chair to be loaded.
/// </summary>
public CaptainsChairMod()
{
}
Expand Down
Loading

0 comments on commit f0bf196

Please sign in to comment.